summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-09-05 10:53:59 -0400
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-18 18:18:57 +0200
commite6878050749ad715be85f5b56672fd3c8848eafb (patch)
tree7affccadd3e2193745a649a9fc8e45e00990c4e3 /src/tests
parent99174b10f604bdfaed13ff7585a15b60f88b1c55 (diff)
tests/elm: add eventing test for normal check widget, verify api compatibility
legacy check widgets should not emit a "changed" event when using the api to change the widget's state Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9852
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/elementary/elm_test_check.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/tests/elementary/elm_test_check.c b/src/tests/elementary/elm_test_check.c
index 3f801e5aed..74af40f235 100644
--- a/src/tests/elementary/elm_test_check.c
+++ b/src/tests/elementary/elm_test_check.c
@@ -53,12 +53,14 @@ EFL_START_TEST(elm_test_check_callbacks)
53{ 53{
54 Evas_Object *win, *check; 54 Evas_Object *win, *check;
55 int called = 0; 55 int called = 0;
56 int i;
56 57
57 win = win_add(NULL, "check", ELM_WIN_BASIC); 58 win = win_add(NULL, "check", ELM_WIN_BASIC);
58 evas_object_resize(win, 500, 500); 59 evas_object_resize(win, 500, 500);
59 60
60 check = elm_check_add(win); 61 check = elm_check_add(win);
61 elm_object_style_set(check, "toggle"); 62 if (_i)
63 elm_object_style_set(check, "toggle");
62 elm_object_text_set(check, "TEST TEST TEST"); 64 elm_object_text_set(check, "TEST TEST TEST");
63 evas_object_smart_callback_add(check, "changed", event_callback_single_call_int_data, &called); 65 evas_object_smart_callback_add(check, "changed", event_callback_single_call_int_data, &called);
64 66
@@ -67,16 +69,17 @@ EFL_START_TEST(elm_test_check_callbacks)
67 evas_object_show(check); 69 evas_object_show(check);
68 get_me_to_those_events(check); 70 get_me_to_those_events(check);
69 71
70 click_object_at(check, 150, 50); 72 for (i = 0; i < 4; i++)
71 ecore_main_loop_iterate(); 73 {
72 ck_assert_int_eq(elm_check_state_get(check), 1); 74 called = 0;
73 ck_assert_int_eq(called, 1); 75 if (_i)
74 76 click_object_at(check, 150, 50);
75 called = 0; 77 else
76 click_object_at(check, 150, 50); 78 click_object(check);
77 ecore_main_loop_iterate(); 79 ecore_main_loop_iterate();
78 ck_assert_int_eq(elm_check_state_get(check), 0); 80 ck_assert_int_eq(elm_check_state_get(check), !(i % 2));
79 ck_assert_int_eq(called, 1); 81 ck_assert_int_eq(called, 1);
82 }
80} 83}
81EFL_END_TEST 84EFL_END_TEST
82 85
@@ -84,6 +87,7 @@ EFL_START_TEST(elm_test_check_state)
84{ 87{
85 Evas_Object *win, *check; 88 Evas_Object *win, *check;
86 Eina_Bool state = EINA_TRUE; 89 Eina_Bool state = EINA_TRUE;
90 int called = 0;
87 91
88 win = win_add(NULL, "check", ELM_WIN_BASIC); 92 win = win_add(NULL, "check", ELM_WIN_BASIC);
89 93
@@ -92,9 +96,11 @@ EFL_START_TEST(elm_test_check_state)
92 ck_assert(elm_check_state_get(check) == EINA_TRUE); 96 ck_assert(elm_check_state_get(check) == EINA_TRUE);
93 ck_assert(state == EINA_TRUE); 97 ck_assert(state == EINA_TRUE);
94 98
99 evas_object_smart_callback_add(check, "changed", event_callback_single_call_int_data, &called);
95 elm_check_state_set(check, EINA_FALSE); 100 elm_check_state_set(check, EINA_FALSE);
96 ck_assert(elm_check_state_get(check) == EINA_FALSE); 101 ck_assert(elm_check_state_get(check) == EINA_FALSE);
97 ck_assert(state == EINA_FALSE); 102 ck_assert(state == EINA_FALSE);
103 ck_assert_int_eq(called, 0);
98 104
99} 105}
100EFL_END_TEST 106EFL_END_TEST
@@ -119,6 +125,6 @@ void elm_test_check(TCase *tc)
119 tcase_add_test(tc, elm_test_check_legacy_type_check); 125 tcase_add_test(tc, elm_test_check_legacy_type_check);
120 tcase_add_test(tc, elm_test_check_onoff_text); 126 tcase_add_test(tc, elm_test_check_onoff_text);
121 tcase_add_test(tc, elm_test_check_state); 127 tcase_add_test(tc, elm_test_check_state);
122 tcase_add_test(tc, elm_test_check_callbacks); 128 tcase_add_loop_test(tc, elm_test_check_callbacks, 0, 2);
123 tcase_add_test(tc, elm_atspi_role_get); 129 tcase_add_test(tc, elm_atspi_role_get);
124} 130}