summaryrefslogtreecommitdiff
path: root/src/tests/edje
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-09-11 13:38:28 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-09-11 13:38:28 -0400
commit599d7f80dbed43a90c6e92bc3b2b62c6ff2c263b (patch)
tree8126ed45a053e08714c351353c8b593cde8f5888 /src/tests/edje
parent54894824847c69b1acaa0a4382de6e39bf83a66b (diff)
tests/edje: add comprehensive edje reloading test
Summary: this verifies: * successfully loading a file * emission of "load" signal when performing a file load * swallowing an object * no-op of file load operation on same file if mtime is unchanged * successfully reloading the same file if the mtime has changed * preserving user-defined data across file reloads Depends on D9877 Reviewers: cedric Reviewed By: cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9878
Diffstat (limited to 'src/tests/edje')
-rw-r--r--src/tests/edje/edje_test_edje.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index fb1e8e2..7f0f3b6 100644
--- a/src/tests/edje/edje_test_edje.c
+++ b/src/tests/edje/edje_test_edje.c
@@ -32,6 +32,51 @@ EFL_START_TEST(edje_test_edje_load)
32} 32}
33EFL_END_TEST 33EFL_END_TEST
34 34
35static void
36_callback(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
37{
38 int *called = data;
39 ck_assert_int_eq(*called, 0);
40 *called = 1;
41}
42
43EFL_START_TEST(edje_test_edje_reload)
44{
45 Evas *evas = _setup_evas();
46 Evas_Object *obj, *rect;
47 int called = 0;
48 struct timespec t[2] = {0};
49 const char *layout = test_layout_get("test_swallows.edj");
50
51 obj = edje_object_add(evas);
52 edje_object_signal_callback_add(obj, "load", "", _callback, &called);
53 fail_unless(edje_object_file_set(obj, layout, "test_group"));
54 rect = evas_object_rectangle_add(evas);
55 ck_assert(edje_object_part_swallow(obj, "swallow", rect));
56 edje_object_message_signal_process(obj);
57 /* load should be called */
58 ck_assert_int_eq(called, 1);
59
60 called = 0;
61 fail_unless(edje_object_file_set(obj, layout, "test_group"));
62 edje_object_message_signal_process(obj);
63 /* load should NOT be called */
64 ck_assert_int_eq(called, 0);
65
66 t[0].tv_nsec = t[1].tv_nsec = UTIME_NOW;
67 ck_assert(!utimensat(0, layout, t, 0));
68
69 called = 0;
70 fail_unless(edje_object_file_set(obj, layout, "test_group"));
71 edje_object_message_signal_process(obj);
72 /* layout mtime has changed; load should be called */
73 ck_assert_int_eq(called, 1);
74
75 /* verify that the object has actually loaded */
76 ck_assert_ptr_eq(edje_object_part_swallow_get(obj, "swallow"), rect);
77}
78EFL_END_TEST
79
35EFL_START_TEST(edje_test_load_simple_layout) 80EFL_START_TEST(edje_test_load_simple_layout)
36{ 81{
37 Evas *evas = _setup_evas(); 82 Evas *evas = _setup_evas();
@@ -241,6 +286,7 @@ void edje_test_edje(TCase *tc)
241 tcase_add_test(tc, edje_test_edje_init); 286 tcase_add_test(tc, edje_test_edje_init);
242 tcase_add_test(tc, edje_test_load_simple_layout); 287 tcase_add_test(tc, edje_test_load_simple_layout);
243 tcase_add_test(tc, edje_test_edje_load); 288 tcase_add_test(tc, edje_test_edje_load);
289 tcase_add_test(tc, edje_test_edje_reload);
244 tcase_add_test(tc, edje_test_simple_layout_geometry); 290 tcase_add_test(tc, edje_test_simple_layout_geometry);
245 tcase_add_test(tc, edje_test_complex_layout); 291 tcase_add_test(tc, edje_test_complex_layout);
246 tcase_add_test(tc, edje_test_calculate_parens); 292 tcase_add_test(tc, edje_test_calculate_parens);