summaryrefslogtreecommitdiff
path: root/src/tests/edje
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-09-13 14:13:33 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-09-13 14:13:33 -0400
commitcfae5ba28579b37932dc516a9622eb58cfebefa1 (patch)
tree52d1ed1a287cd6f3520d6843805acfe243659103 /src/tests/edje
parent51265dea6b84a6b6191abc03e89087d710d31883 (diff)
tests/edje: handle file modifications properly on windows
Summary: we don't have access to utimensat and I'm too busy to figure out why Reviewers: vtorri, bu5hm4n, devilhorns Reviewed By: vtorri Subscribers: cedric, #reviewers, #committers Tags: #efl_build Differential Revision: https://phab.enlightenment.org/D9914
Diffstat (limited to 'src/tests/edje')
-rw-r--r--src/tests/edje/edje_test_edje.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index 17eb7d5..fed2dde 100644
--- a/src/tests/edje/edje_test_edje.c
+++ b/src/tests/edje/edje_test_edje.c
@@ -9,7 +9,9 @@
9#define EFL_CANVAS_LAYOUT_BETA 9#define EFL_CANVAS_LAYOUT_BETA
10 10
11#include "edje_suite.h" 11#include "edje_suite.h"
12 12#ifdef _WIN32
13# include <windows.h>
14#endif
13#define EVAS_DATA_DIR TESTS_SRC_DIR "/../../lib/evas" 15#define EVAS_DATA_DIR TESTS_SRC_DIR "/../../lib/evas"
14 16
15EFL_START_TEST(edje_test_edje_init) 17EFL_START_TEST(edje_test_edje_init)
@@ -44,7 +46,6 @@ EFL_START_TEST(edje_test_edje_reload)
44 Evas *evas = _setup_evas(); 46 Evas *evas = _setup_evas();
45 Evas_Object *obj, *rect; 47 Evas_Object *obj, *rect;
46 int called = 0; 48 int called = 0;
47 struct timespec t[2] = {0};
48 const char *layout = test_layout_get("test_swallows.edj"); 49 const char *layout = test_layout_get("test_swallows.edj");
49 50
50 obj = edje_object_add(evas); 51 obj = edje_object_add(evas);
@@ -62,8 +63,27 @@ EFL_START_TEST(edje_test_edje_reload)
62 /* load should NOT be called */ 63 /* load should NOT be called */
63 ck_assert_int_eq(called, 0); 64 ck_assert_int_eq(called, 0);
64 65
66#ifdef _WIN32
67 HANDLE handle;
68 FILETIME modtime;
69 SYSTEMTIME st;
70 wchar_t date[80], time[80];
71 handle = CreateFile(layout,
72 GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
73 NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
74 NULL);
75 ck_assert(handle != INVALID_HANDLE_VALUE);
76 GetSystemTime(&st);
77 ck_assert(GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &st, NULL, date, sizeof(date) / sizeof(date[0])));
78 ck_assert(GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL, time, sizeof(time) / sizeof(time[0])));
79 ck_assert(SystemTimeToFileTime(&st, &modtime));
80 ck_assert(SetFileTime(handle, NULL, NULL, &modtime));
81 CloseHandle(handle);
82#else
83 struct timespec t[2] = {0};
65 t[0].tv_nsec = t[1].tv_nsec = UTIME_NOW; 84 t[0].tv_nsec = t[1].tv_nsec = UTIME_NOW;
66 ck_assert(!utimensat(0, layout, t, 0)); 85 ck_assert(!utimensat(0, layout, t, 0));
86#endif
67 87
68 called = 0; 88 called = 0;
69 fail_unless(edje_object_file_set(obj, layout, "test_group")); 89 fail_unless(edje_object_file_set(obj, layout, "test_group"));