summaryrefslogtreecommitdiff
path: root/src/tests/edje
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-05-30 13:34:57 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-05-30 14:39:24 +0900
commitbca55bb52f2325b9816b809c250e97b44da01f35 (patch)
tree5099dad1ebbabd3a401dda80ea2e5d034827c71a /src/tests/edje
parent63518c4c2c8b08dcdd410b274d788c9dcb48a60a (diff)
edje: Add test case for signal_recursive_process
Diffstat (limited to 'src/tests/edje')
-rw-r--r--src/tests/edje/data/test_messages.edc2
-rw-r--r--src/tests/edje/data/test_signals.edc124
-rw-r--r--src/tests/edje/edje_test_edje.c34
3 files changed, 160 insertions, 0 deletions
diff --git a/src/tests/edje/data/test_messages.edc b/src/tests/edje/data/test_messages.edc
index bd207cd81f..fe5195640b 100644
--- a/src/tests/edje/data/test_messages.edc
+++ b/src/tests/edje/data/test_messages.edc
@@ -65,3 +65,5 @@ collections {
65 } 65 }
66 } 66 }
67 } 67 }
68}
69
diff --git a/src/tests/edje/data/test_signals.edc b/src/tests/edje/data/test_signals.edc
new file mode 100644
index 0000000000..185b9d4443
--- /dev/null
+++ b/src/tests/edje/data/test_signals.edc
@@ -0,0 +1,124 @@
1// compile: edje_cc edje_signal_test.edc
2collections {
3 group {
4 name: "level1";
5
6 parts {
7 part {
8 name: "group";
9 type: GROUP;
10 source: "level2";
11 description {
12 state: "default" 0.0;
13 rel1 {
14 relative: 0.0 0.0;
15 offset: 0 0;
16 }
17 rel2 {
18 relative: 1.0 1.0;
19 offset: -1 -1;
20 }
21 }
22 }
23 }
24 }
25 group {
26 name: "level2";
27
28 parts {
29 part {
30 name: "group";
31 type: GROUP;
32 source: "level3";
33 description {
34 state: "default" 0.0;
35 rel1 {
36 relative: 0.0 0.0;
37 offset: 0 0;
38 }
39 rel2 {
40 relative: 1.0 1.0;
41 offset: -1 -1;
42 }
43 }
44 }
45 }
46 }
47 group {
48 name: "level3"; // must be the same as in edje_example.c
49
50 parts {
51 part {
52 name: "background";
53 type: RECT; // plain boring rectangle
54 mouse_events: 0; // we don't need any mouse event on the background
55
56 // just one state "default"
57 description {
58 state: "default" 0.0; // must always exist
59 color: 255 255 255 255; // white
60
61 // define part coordinates:
62
63 rel1 { // top-left point at (0, 0) [WIDTH * 0 + 0, HEIGHT * 0 + 0]
64 relative: 0.0 0.0;
65 offset: 0 0;
66 }
67 rel2 { // bottom-right point at (WIDTH * 1.0 - 1, HEIGHT * 1.0 - 1)
68 relative: 1.0 1.0;
69 offset: -1 -1;
70 }
71 }
72 }
73
74 part {
75 name: "text";
76 type: TEXT;
77 mouse_events: 1; // we want to change the color on mouse-over
78
79 // 2 states, one "default" and another "over" to be used
80 // on mouse over effect
81
82 description {
83 state: "default" 0.0;
84 color: 255 0 0 255; // red
85
86 // define part coordinates:
87
88 rel1 { // top-left at (WIDTH * 0.1 + 5, HEIGHT * 0.2 + 10)
89 relative: 0.1 0.2;
90 offset: 5 10;
91 }
92 rel2 { // bottom-right at (WIDTH * 0.9 - 6, HEIGHT * 0.8 - 11)
93 relative: 0.9 0.8;
94 offset: -6 -11;
95 }
96
97 // define text specific state details
98 text {
99 font: "Sans"; // using fontconfig name!
100 size: 10;
101 text: "hello world";
102 }
103 }
104
105 description {
106 state: "over" 0.0;
107 inherit: "default" 0.0; // copy everything from "default" at this point
108
109 color: 0 255 0 255; // override color, now it is green
110 }
111 }
112
113 programs {
114 program {
115 signal: "mouse,in";
116 source: "text";
117
118 action: STATE_SET "over" 0.0;
119 target: "text";
120 }
121 }
122 }
123 }
124}
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index 9d31544fd6..af88fa8d84 100644
--- a/src/tests/edje/edje_test_edje.c
+++ b/src/tests/edje/edje_test_edje.c
@@ -867,6 +867,39 @@ START_TEST(edje_test_message_send_eo)
867} 867}
868END_TEST 868END_TEST
869 869
870START_TEST(edje_test_signals)
871{
872 Evas *evas;
873 Evas_Object *obj;
874 const char *state;
875
876 evas = EDJE_TEST_INIT_EVAS();
877
878 obj = efl_add(EDJE_OBJECT_CLASS, evas,
879 efl_file_set(efl_added, test_layout_get("test_signals.edj"), "level1"),
880 efl_gfx_size_set(efl_added, 320, 240),
881 efl_gfx_visible_set(efl_added, 1));
882
883 edje_object_signal_emit(obj, "mouse,in", "text");
884
885 edje_object_message_signal_process(obj);
886 state = edje_object_part_state_get(obj, "group:group:text", NULL);
887 ck_assert_str_eq(state, "default");
888
889 edje_object_message_signal_process(obj);
890 state = edje_object_part_state_get(obj, "group:group:text", NULL);
891 ck_assert_str_eq(state, "default");
892
893 edje_object_message_signal_recursive_process(obj);
894 state = edje_object_part_state_get(obj, "group:group:text", NULL);
895 ck_assert_str_eq(state, "over");
896
897 efl_del(obj);
898
899 EDJE_TEST_FREE_EVAS();
900}
901END_TEST
902
870void edje_test_edje(TCase *tc) 903void edje_test_edje(TCase *tc)
871{ 904{
872 tcase_add_test(tc, edje_test_edje_init); 905 tcase_add_test(tc, edje_test_edje_init);
@@ -890,4 +923,5 @@ void edje_test_edje(TCase *tc)
890 tcase_add_test(tc, edje_test_combine_keywords); 923 tcase_add_test(tc, edje_test_combine_keywords);
891 tcase_add_test(tc, edje_test_message_send_legacy); 924 tcase_add_test(tc, edje_test_message_send_legacy);
892 tcase_add_test(tc, edje_test_message_send_eo); 925 tcase_add_test(tc, edje_test_message_send_eo);
926 tcase_add_test(tc, edje_test_signals);
893} 927}