aboutsummaryrefslogtreecommitdiffstats
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
parentefl_ui_*: add the new events to the widgets (diff)
downloadefl-devs/bu5hm4n/work_range_display.tar.gz
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 https://phab.enlightenment.org/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)
click_part(obj, part);
}
-EFL_START_TEST (spin_value_events)
-{
- Eina_Bool changed = EINA_FALSE, min_reached = EINA_FALSE, max_reached = EINA_FALSE;
-
- efl_ui_range_limits_set(spin, -3.0, 3.0);
- efl_ui_range_value_set(spin, 0.0);
- efl_event_callback_add(spin, EFL_UI_RANGE_EVENT_CHANGED, _set_flag, &changed);
- efl_event_callback_add(spin, EFL_UI_RANGE_EVENT_MIN_REACHED, _set_flag, &min_reached);
- efl_event_callback_add(spin, EFL_UI_RANGE_EVENT_MAX_REACHED, _set_flag, &max_reached);
-
- efl_ui_range_value_set(spin, 1.0);
- ck_assert_int_eq(changed, EINA_TRUE);
- ck_assert_int_eq(min_reached, EINA_FALSE);
- ck_assert_int_eq(max_reached, EINA_FALSE);
- changed = EINA_FALSE;
- min_reached = EINA_FALSE;
- max_reached = EINA_FALSE;
-
- efl_ui_range_value_set(spin, 3.0);
- ck_assert_int_eq(changed, EINA_TRUE);
- ck_assert_int_eq(min_reached, EINA_FALSE);
- ck_assert_int_eq(max_reached, EINA_TRUE);
- changed = EINA_FALSE;
- min_reached = EINA_FALSE;
- max_reached = EINA_FALSE;
-
- efl_ui_range_value_set(spin, -3.0);
- ck_assert_int_eq(changed, EINA_TRUE);
- ck_assert_int_eq(min_reached, EINA_TRUE);
- ck_assert_int_eq(max_reached, EINA_FALSE);
- changed = EINA_FALSE;
- min_reached = EINA_FALSE;
- max_reached = EINA_FALSE;
-}
-EFL_END_TEST
-
EFL_START_TEST (spin_wheel_test)
{
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)
{
tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
tcase_add_checked_fixture(tc, spin_setup, NULL);
- tcase_add_test(tc, spin_value_events);
tcase_add_test(tc, spin_wheel_test);
tcase_add_test(tc, spin_value_inc);
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)
}
EFL_END_TEST
+static void
+_set_flag(void *data, const Efl_Event *ev)
+{
+ Eina_Bool *b = data;
+
+ ck_assert_int_eq(*b, EINA_FALSE);
+ *b = EINA_TRUE;
+ ck_assert_ptr_eq(ev->info, NULL);
+}
+
+EFL_START_TEST (range_display_value_events)
+{
+ Eina_Bool changed = EINA_FALSE, min_reached = EINA_FALSE, max_reached = EINA_FALSE;
+
+ efl_ui_range_limits_set(widget, -3.0, 3.0);
+ efl_ui_range_value_set(widget, 0.0);
+ efl_event_callback_add(widget, EFL_UI_RANGE_EVENT_CHANGED, _set_flag, &changed);
+ efl_event_callback_add(widget, EFL_UI_RANGE_EVENT_MIN_REACHED, _set_flag, &min_reached);
+ efl_event_callback_add(widget, EFL_UI_RANGE_EVENT_MAX_REACHED, _set_flag, &max_reached);
+
+ efl_ui_range_value_set(widget, 1.0);
+ ck_assert_int_eq(changed, EINA_TRUE);
+ ck_assert_int_eq(min_reached, EINA_FALSE);
+ ck_assert_int_eq(max_reached, EINA_FALSE);
+ changed = EINA_FALSE;
+ min_reached = EINA_FALSE;
+ max_reached = EINA_FALSE;
+
+ efl_ui_range_value_set(widget, 3.0);
+ ck_assert_int_eq(changed, EINA_TRUE);
+ ck_assert_int_eq(min_reached, EINA_FALSE);
+ ck_assert_int_eq(max_reached, EINA_TRUE);
+ changed = EINA_FALSE;
+ min_reached = EINA_FALSE;
+ max_reached = EINA_FALSE;
+
+ efl_ui_range_value_set(widget, -3.0);
+ ck_assert_int_eq(changed, EINA_TRUE);
+ ck_assert_int_eq(min_reached, EINA_TRUE);
+ ck_assert_int_eq(max_reached, EINA_FALSE);
+ changed = EINA_FALSE;
+ min_reached = EINA_FALSE;
+ max_reached = EINA_FALSE;
+}
+EFL_END_TEST
+
void
efl_ui_range_display_behavior_test(TCase *tc)
{
tcase_add_test(tc, value_setting_limits);
tcase_add_test(tc, limit_setting);
tcase_add_test(tc, value_setting);
+ tcase_add_test(tc, range_display_value_events);
}