summaryrefslogtreecommitdiff
path: root/src/tests/elementary/elm_test_check.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/elementary/elm_test_check.c')
-rw-r--r--src/tests/elementary/elm_test_check.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/tests/elementary/elm_test_check.c b/src/tests/elementary/elm_test_check.c
index 4881aaa..0cdc18f 100644
--- a/src/tests/elementary/elm_test_check.c
+++ b/src/tests/elementary/elm_test_check.c
@@ -6,6 +6,13 @@
6#include <Elementary.h> 6#include <Elementary.h>
7#include "elm_suite.h" 7#include "elm_suite.h"
8 8
9typedef struct _Check_Data
10{
11 Evas_Object *check1;
12 Evas_Object *check2;
13 int value;
14} Check_Data;
15
9EFL_START_TEST(elm_test_check_size) 16EFL_START_TEST(elm_test_check_size)
10{ 17{
11 Evas_Object *win, *check, *box; 18 Evas_Object *win, *check, *box;
@@ -146,6 +153,66 @@ EFL_START_TEST(elm_atspi_role_get)
146} 153}
147EFL_END_TEST 154EFL_END_TEST
148 155
156static void
157_check_changed_cb(void *ptr, Evas_Object *obj, void *e EINA_UNUSED)
158{
159 Check_Data *data = (Check_Data*) ptr;
160
161 if (obj == data->check1) {
162 elm_check_state_set(data->check2, EINA_TRUE);
163 } else if ( obj == data->check2) {
164 elm_check_state_set(data->check1, EINA_FALSE);
165 } else {
166 ck_assert(EINA_FALSE);
167 }
168 data->value ++;
169}
170
171EFL_START_TEST(elm_test_check_api_call)
172{
173 Evas_Object *win, *check1, *check2, *box;
174 Check_Data data ={0,};
175
176 win = elm_win_util_standard_add("check", "Check");
177
178 box = elm_box_add(win);
179 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
180 elm_win_resize_object_add(win, box);
181 evas_object_show(box);
182
183 data.check1 = check1 = elm_check_add(box);
184 elm_object_text_set(check1, "TEST TEST TEST");
185 evas_object_smart_callback_add(check1, "changed", _check_changed_cb, &data);
186 elm_box_pack_end(box, check1);
187 evas_object_show(check1);
188
189 data.check2 = check2 = elm_check_add(box);
190 elm_object_text_set(check2, "TEST TEST TEST");
191 evas_object_smart_callback_add(check2, "changed", _check_changed_cb, &data);
192 elm_box_pack_end(box, check2);
193 evas_object_show(check2);
194
195 evas_object_show(win);
196
197 get_me_to_those_events(check1);
198
199 data.value = 0;
200 click_object(data.check1);
201 ecore_main_loop_iterate();
202 ck_assert_int_eq(data.value, 1);
203
204 data.value = 0;
205 click_object(data.check2);
206 ecore_main_loop_iterate();
207 ck_assert_int_eq(data.value, 1);
208
209 data.value = 0;
210 click_object(data.check1);
211 ecore_main_loop_iterate();
212 ck_assert_int_eq(data.value, 1);
213}
214EFL_END_TEST
215
149void elm_test_check(TCase *tc) 216void elm_test_check(TCase *tc)
150{ 217{
151 tcase_add_test(tc, elm_test_check_size); 218 tcase_add_test(tc, elm_test_check_size);
@@ -154,4 +221,5 @@ void elm_test_check(TCase *tc)
154 tcase_add_test(tc, elm_test_check_state); 221 tcase_add_test(tc, elm_test_check_state);
155 tcase_add_loop_test(tc, elm_test_check_callbacks, 0, 2); 222 tcase_add_loop_test(tc, elm_test_check_callbacks, 0, 2);
156 tcase_add_test(tc, elm_atspi_role_get); 223 tcase_add_test(tc, elm_atspi_role_get);
224 tcase_add_test(tc, elm_test_check_api_call);
157} 225}