summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-22 13:10:27 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-22 13:13:55 +0200
commitffe2bcfda0f50ff5538d408fa29384ccf993d2c4 (patch)
treeb47e1d10027c2b13d663f2c98e1a53b919f83d70
parent3fa5d40504d09fc0396afbd8c3e96a552fcc0559 (diff)
efl_ui_spec: add test suite for range_display eventsdevs/bu5hm4n/work_range_display
this test case ensures the correct emittation of the newly added events. ref T7895 Differential Revision: https://phab.enlightenment.org/D9373
-rw-r--r--src/tests/elementary/efl_ui_test_spin_button.c37
-rw-r--r--src/tests/elementary/spec/efl_test_range_display.c47
2 files changed, 47 insertions, 37 deletions
diff --git a/src/tests/elementary/efl_ui_test_spin_button.c b/src/tests/elementary/efl_ui_test_spin_button.c
index f9e6bce6b9..e3a5ed603d 100644
--- a/src/tests/elementary/efl_ui_test_spin_button.c
+++ b/src/tests/elementary/efl_ui_test_spin_button.c
@@ -46,42 +46,6 @@ click_spin_part(Eo *obj, const char *part)
46 click_part(obj, part); 46 click_part(obj, part);
47} 47}
48 48
49EFL_START_TEST (spin_value_events)
50{
51 Eina_Bool changed = EINA_FALSE, min_reached = EINA_FALSE, max_reached = EINA_FALSE;
52
53 efl_ui_range_limits_set(spin, -3.0, 3.0);
54 efl_ui_range_value_set(spin, 0.0);
55 efl_event_callback_add(spin, EFL_UI_RANGE_EVENT_CHANGED, _set_flag, &changed);
56 efl_event_callback_add(spin, EFL_UI_RANGE_EVENT_MIN_REACHED, _set_flag, &min_reached);
57 efl_event_callback_add(spin, EFL_UI_RANGE_EVENT_MAX_REACHED, _set_flag, &max_reached);
58
59 efl_ui_range_value_set(spin, 1.0);
60 ck_assert_int_eq(changed, EINA_TRUE);
61 ck_assert_int_eq(min_reached, EINA_FALSE);
62 ck_assert_int_eq(max_reached, EINA_FALSE);
63 changed = EINA_FALSE;
64 min_reached = EINA_FALSE;
65 max_reached = EINA_FALSE;
66
67 efl_ui_range_value_set(spin, 3.0);
68 ck_assert_int_eq(changed, EINA_TRUE);
69 ck_assert_int_eq(min_reached, EINA_FALSE);
70 ck_assert_int_eq(max_reached, EINA_TRUE);
71 changed = EINA_FALSE;
72 min_reached = EINA_FALSE;
73 max_reached = EINA_FALSE;
74
75 efl_ui_range_value_set(spin, -3.0);
76 ck_assert_int_eq(changed, EINA_TRUE);
77 ck_assert_int_eq(min_reached, EINA_TRUE);
78 ck_assert_int_eq(max_reached, EINA_FALSE);
79 changed = EINA_FALSE;
80 min_reached = EINA_FALSE;
81 max_reached = EINA_FALSE;
82}
83EFL_END_TEST
84
85EFL_START_TEST (spin_wheel_test) 49EFL_START_TEST (spin_wheel_test)
86{ 50{
87 Eina_Bool changed = EINA_FALSE, min_reached = EINA_FALSE, max_reached = EINA_FALSE; 51 Eina_Bool changed = EINA_FALSE, min_reached = EINA_FALSE, max_reached = EINA_FALSE;
@@ -195,7 +159,6 @@ void efl_ui_test_spin_button(TCase *tc)
195{ 159{
196 tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown); 160 tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
197 tcase_add_checked_fixture(tc, spin_setup, NULL); 161 tcase_add_checked_fixture(tc, spin_setup, NULL);
198 tcase_add_test(tc, spin_value_events);
199 tcase_add_test(tc, spin_wheel_test); 162 tcase_add_test(tc, spin_wheel_test);
200 tcase_add_test(tc, spin_value_inc); 163 tcase_add_test(tc, spin_value_inc);
201 tcase_add_test(tc, spin_value_inc_max); 164 tcase_add_test(tc, spin_value_inc_max);
diff --git a/src/tests/elementary/spec/efl_test_range_display.c b/src/tests/elementary/spec/efl_test_range_display.c
index 338dfb2496..f072e02c10 100644
--- a/src/tests/elementary/spec/efl_test_range_display.c
+++ b/src/tests/elementary/spec/efl_test_range_display.c
@@ -81,10 +81,57 @@ EFL_START_TEST(value_setting)
81} 81}
82EFL_END_TEST 82EFL_END_TEST
83 83
84static void
85_set_flag(void *data, const Efl_Event *ev)
86{
87 Eina_Bool *b = data;
88
89 ck_assert_int_eq(*b, EINA_FALSE);
90 *b = EINA_TRUE;
91 ck_assert_ptr_eq(ev->info, NULL);
92}
93
94EFL_START_TEST (range_display_value_events)
95{
96 Eina_Bool changed = EINA_FALSE, min_reached = EINA_FALSE, max_reached = EINA_FALSE;
97
98 efl_ui_range_limits_set(widget, -3.0, 3.0);
99 efl_ui_range_value_set(widget, 0.0);
100 efl_event_callback_add(widget, EFL_UI_RANGE_EVENT_CHANGED, _set_flag, &changed);
101 efl_event_callback_add(widget, EFL_UI_RANGE_EVENT_MIN_REACHED, _set_flag, &min_reached);
102 efl_event_callback_add(widget, EFL_UI_RANGE_EVENT_MAX_REACHED, _set_flag, &max_reached);
103
104 efl_ui_range_value_set(widget, 1.0);
105 ck_assert_int_eq(changed, EINA_TRUE);
106 ck_assert_int_eq(min_reached, EINA_FALSE);
107 ck_assert_int_eq(max_reached, EINA_FALSE);
108 changed = EINA_FALSE;
109 min_reached = EINA_FALSE;
110 max_reached = EINA_FALSE;
111
112 efl_ui_range_value_set(widget, 3.0);
113 ck_assert_int_eq(changed, EINA_TRUE);
114 ck_assert_int_eq(min_reached, EINA_FALSE);
115 ck_assert_int_eq(max_reached, EINA_TRUE);
116 changed = EINA_FALSE;
117 min_reached = EINA_FALSE;
118 max_reached = EINA_FALSE;
119
120 efl_ui_range_value_set(widget, -3.0);
121 ck_assert_int_eq(changed, EINA_TRUE);
122 ck_assert_int_eq(min_reached, EINA_TRUE);
123 ck_assert_int_eq(max_reached, EINA_FALSE);
124 changed = EINA_FALSE;
125 min_reached = EINA_FALSE;
126 max_reached = EINA_FALSE;
127}
128EFL_END_TEST
129
84void 130void
85efl_ui_range_display_behavior_test(TCase *tc) 131efl_ui_range_display_behavior_test(TCase *tc)
86{ 132{
87 tcase_add_test(tc, value_setting_limits); 133 tcase_add_test(tc, value_setting_limits);
88 tcase_add_test(tc, limit_setting); 134 tcase_add_test(tc, limit_setting);
89 tcase_add_test(tc, value_setting); 135 tcase_add_test(tc, value_setting);
136 tcase_add_test(tc, range_display_value_events);
90} 137}