summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-22 15:06:22 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-29 08:29:58 +0200
commitd445e5240b03ddf659b3c16c74d982956a2a7b67 (patch)
tree783ad8be965445c207fb6a6757d303409faf3ebb /src/tests
parentc6e338bb9ad392f074e1dd3704d2e36cc26fcab3 (diff)
efl_ui_radio_group: migrate to Efl.Ui.Single_Selectable
with this the whole thing is migrated to single_selectable. The group is added to the spec test suite. The elm_test case of radio_group now also has a fallback option to demonstrate the usage of it. This also fixes a broken testcase, where a flag was forgotten to be checked. ref T8024 Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D9706
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/elementary/efl_ui_test_radio_group.c38
-rw-r--r--src/tests/elementary/spec/efl_test_single_selectable.c13
2 files changed, 30 insertions, 21 deletions
diff --git a/src/tests/elementary/efl_ui_test_radio_group.c b/src/tests/elementary/efl_ui_test_radio_group.c
index 664819dd41..5b00b02318 100644
--- a/src/tests/elementary/efl_ui_test_radio_group.c
+++ b/src/tests/elementary/efl_ui_test_radio_group.c
@@ -65,20 +65,20 @@ EFL_START_TEST(active_selected_value_setting)
65 efl_ui_radio_group_register(radio_group, r2); 65 efl_ui_radio_group_register(radio_group, r2);
66 66
67 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), -1); 67 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), -1);
68 ck_assert_ptr_eq(efl_ui_radio_group_selected_object_get(radio_group), NULL); 68 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(radio_group), NULL);
69 69
70 RESET_EVT 70 RESET_EVT
71 efl_ui_radio_group_selected_value_set(radio_group, 1); 71 efl_ui_radio_group_selected_value_set(radio_group, 1);
72 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 1); 72 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 1);
73 ck_assert_ptr_eq(efl_ui_radio_group_selected_object_get(radio_group), r1); 73 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(radio_group), r1);
74 ck_assert_int_eq(efl_ui_selectable_selected_get(r1), EINA_TRUE); 74 ck_assert_int_eq(efl_ui_selectable_selected_get(r1), EINA_TRUE);
75 ck_assert_int_eq(efl_ui_selectable_selected_get(r2), EINA_FALSE); 75 ck_assert_int_eq(efl_ui_selectable_selected_get(r2), EINA_FALSE);
76 EXPECT_EVT(1,1); 76 EXPECT_EVT(1,1);
77 77
78 RESET_EVT 78 RESET_EVT
79 efl_ui_radio_group_selected_object_set(radio_group, r2); 79 efl_ui_selectable_selected_set(r2, EINA_TRUE);
80 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 2); 80 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 2);
81 ck_assert_ptr_eq(efl_ui_radio_group_selected_object_get(radio_group), r2); 81 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(radio_group), r2);
82 ck_assert_int_eq(efl_ui_selectable_selected_get(r1), EINA_FALSE); 82 ck_assert_int_eq(efl_ui_selectable_selected_get(r1), EINA_FALSE);
83 ck_assert_int_eq(efl_ui_selectable_selected_get(r2), EINA_TRUE); 83 ck_assert_int_eq(efl_ui_selectable_selected_get(r2), EINA_TRUE);
84 EXPECT_EVT(1,2); 84 EXPECT_EVT(1,2);
@@ -96,20 +96,20 @@ EFL_START_TEST(active_selection_setting)
96 efl_ui_radio_group_register(radio_group, r2); 96 efl_ui_radio_group_register(radio_group, r2);
97 97
98 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), -1); 98 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), -1);
99 ck_assert_ptr_eq(efl_ui_radio_group_selected_object_get(radio_group), NULL); 99 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(radio_group), NULL);
100 100
101 RESET_EVT 101 RESET_EVT
102 efl_ui_radio_group_selected_object_set(radio_group, r1); 102 efl_ui_selectable_selected_set(r1, EINA_TRUE);
103 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 1); 103 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 1);
104 ck_assert_ptr_eq(efl_ui_radio_group_selected_object_get(radio_group), r1); 104 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(radio_group), r1);
105 ck_assert_int_eq(efl_ui_selectable_selected_get(r1), EINA_TRUE); 105 ck_assert_int_eq(efl_ui_selectable_selected_get(r1), EINA_TRUE);
106 ck_assert_int_eq(efl_ui_selectable_selected_get(r2), EINA_FALSE); 106 ck_assert_int_eq(efl_ui_selectable_selected_get(r2), EINA_FALSE);
107 EXPECT_EVT(1,1); 107 EXPECT_EVT(1,1);
108 108
109 RESET_EVT 109 RESET_EVT
110 efl_ui_radio_group_selected_object_set(radio_group, r2); 110 efl_ui_selectable_selected_set(r2, EINA_TRUE);
111 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 2); 111 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 2);
112 ck_assert_ptr_eq(efl_ui_radio_group_selected_object_get(radio_group), r2); 112 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(radio_group), r2);
113 ck_assert_int_eq(efl_ui_selectable_selected_get(r1), EINA_FALSE); 113 ck_assert_int_eq(efl_ui_selectable_selected_get(r1), EINA_FALSE);
114 ck_assert_int_eq(efl_ui_selectable_selected_get(r2), EINA_TRUE); 114 ck_assert_int_eq(efl_ui_selectable_selected_get(r2), EINA_TRUE);
115 EXPECT_EVT(1,2); 115 EXPECT_EVT(1,2);
@@ -126,10 +126,10 @@ EFL_START_TEST(active_selection_object_setting)
126 126
127 RESET_EVT 127 RESET_EVT
128 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), -1); 128 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), -1);
129 ck_assert_ptr_eq(efl_ui_radio_group_selected_object_get(radio_group), NULL); 129 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(radio_group), NULL);
130 efl_ui_selectable_selected_set(r, EINA_TRUE); 130 efl_ui_selectable_selected_set(r, EINA_TRUE);
131 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 1); 131 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 1);
132 ck_assert_ptr_eq(efl_ui_radio_group_selected_object_get(radio_group), r); 132 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(radio_group), r);
133 EXPECT_EVT(1,1); 133 EXPECT_EVT(1,1);
134} 134}
135EFL_END_TEST 135EFL_END_TEST
@@ -143,14 +143,14 @@ EFL_START_TEST(unregister_setted)
143 efl_ui_radio_group_register(radio_group, radio()); 143 efl_ui_radio_group_register(radio_group, radio());
144 144
145 RESET_EVT 145 RESET_EVT
146 efl_ui_radio_group_selected_object_set(radio_group, r); 146 efl_ui_selectable_selected_set(r, EINA_TRUE);
147 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 1); 147 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 1);
148 ck_assert_ptr_eq(efl_ui_radio_group_selected_object_get(radio_group), r); 148 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(radio_group), r);
149 EXPECT_EVT(1,1); 149 EXPECT_EVT(1,1);
150 RESET_EVT 150 RESET_EVT
151 efl_ui_radio_group_unregister(radio_group, r); 151 efl_ui_radio_group_unregister(radio_group, r);
152 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), -1); 152 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), -1);
153 ck_assert_ptr_eq(efl_ui_radio_group_selected_object_get(radio_group), NULL); 153 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(radio_group), NULL);
154 EXPECT_EVT(1,-1); 154 EXPECT_EVT(1,-1);
155} 155}
156EFL_END_TEST 156EFL_END_TEST
@@ -163,14 +163,14 @@ EFL_START_TEST(delete_setted)
163 efl_ui_radio_group_register(radio_group, r); 163 efl_ui_radio_group_register(radio_group, r);
164 efl_ui_radio_group_register(radio_group, radio()); 164 efl_ui_radio_group_register(radio_group, radio());
165 RESET_EVT 165 RESET_EVT
166 efl_ui_radio_group_selected_object_set(radio_group, r); 166 efl_ui_selectable_selected_set(r, EINA_TRUE);
167 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 1); 167 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 1);
168 ck_assert_ptr_eq(efl_ui_radio_group_selected_object_get(radio_group), r); 168 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(radio_group), r);
169 EXPECT_EVT(1,1); 169 EXPECT_EVT(1,1);
170 RESET_EVT 170 RESET_EVT
171 efl_del(r); 171 efl_del(r);
172 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), -1); 172 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), -1);
173 ck_assert_ptr_eq(efl_ui_radio_group_selected_object_get(radio_group), NULL); 173 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(radio_group), NULL);
174 EXPECT_EVT(1,-1); 174 EXPECT_EVT(1,-1);
175} 175}
176EFL_END_TEST 176EFL_END_TEST
@@ -185,12 +185,12 @@ EFL_START_TEST(external_setting)
185 RESET_EVT 185 RESET_EVT
186 efl_ui_selectable_selected_set(r, EINA_TRUE); 186 efl_ui_selectable_selected_set(r, EINA_TRUE);
187 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 1); 187 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), 1);
188 ck_assert_ptr_eq(efl_ui_radio_group_selected_object_get(radio_group), r); 188 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(radio_group), r);
189 EXPECT_EVT(1,1); 189 EXPECT_EVT(1,1);
190 RESET_EVT 190 RESET_EVT
191 efl_ui_selectable_selected_set(r, EINA_FALSE); 191 efl_ui_selectable_selected_set(r, EINA_FALSE);
192 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), -1); 192 ck_assert_int_eq(efl_ui_radio_group_selected_value_get(radio_group), -1);
193 ck_assert_ptr_eq(efl_ui_radio_group_selected_object_get(radio_group), NULL); 193 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(radio_group), NULL);
194 EXPECT_EVT(1,-1); 194 EXPECT_EVT(1,-1);
195} 195}
196EFL_END_TEST 196EFL_END_TEST
diff --git a/src/tests/elementary/spec/efl_test_single_selectable.c b/src/tests/elementary/spec/efl_test_single_selectable.c
index fd4b5e0a8b..5ec40b2747 100644
--- a/src/tests/elementary/spec/efl_test_single_selectable.c
+++ b/src/tests/elementary/spec/efl_test_single_selectable.c
@@ -8,10 +8,11 @@
8 8
9/* spec-meta-start 9/* spec-meta-start
10 {"test-interface":"Efl.Ui.Single_Selectable", 10 {"test-interface":"Efl.Ui.Single_Selectable",
11 "test-widgets": ["Efl.Ui.Grid", "Efl.Ui.List"], 11 "test-widgets": ["Efl.Ui.Grid", "Efl.Ui.List", "Efl.Ui.Radio_Box"],
12 "custom-mapping" : { 12 "custom-mapping" : {
13 "Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS", 13 "Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS",
14 "Efl.Ui.List" : "EFL_UI_LIST_DEFAULT_ITEM_CLASS" 14 "Efl.Ui.List" : "EFL_UI_LIST_DEFAULT_ITEM_CLASS",
15 "Efl.Ui.Radio_Box" : "EFL_UI_RADIO_CLASS"
15 } 16 }
16 } 17 }
17 18
@@ -49,9 +50,17 @@ EFL_START_TEST(last_selectable_check)
49 50
50 efl_ui_selectable_selected_set(c2, EINA_TRUE); 51 efl_ui_selectable_selected_set(c2, EINA_TRUE);
51 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), c2); 52 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), c2);
53 if (c == 0) efl_loop_begin(efl_main_loop_get());
54 ck_assert_int_eq(c, 1);
55 c = 0;
56
52 efl_ui_selectable_selected_set(c1, EINA_FALSE); 57 efl_ui_selectable_selected_set(c1, EINA_FALSE);
53 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), c2); 58 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), c2);
54 efl_ui_selectable_selected_set(c2, EINA_FALSE); 59 efl_ui_selectable_selected_set(c2, EINA_FALSE);
60 if (c == 0) efl_loop_begin(efl_main_loop_get());
61 ck_assert_int_eq(c, 1);
62 c = 0;
63
55 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), NULL); 64 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), NULL);
56} 65}
57EFL_END_TEST 66EFL_END_TEST