summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-31 15:19:32 +0200
committerCedric BAIL <cedric.bail@free.fr>2019-08-01 14:36:50 -0700
commitbd8fcab8b203940d51f7b4d49636b80da9a41839 (patch)
tree5abff97ba0480553530f8d280467ec2a9aafac06 /src/tests
parent45b763a2dc2a3ba773353d5be17722aad86fea7c (diff)
efl_ui_spec: add a test suite for the steady event
this checks that the steady event is correctly emitted after some time. Right now this test does notthing for EFL_UI_SPIN_CLASS. Reason for this is that Spin is not interactive, even if it implements the interface for it. Maybe something we should resolve in future. ref T7894 Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D9460
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/elementary/spec/efl_test_range_interactive.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/tests/elementary/spec/efl_test_range_interactive.c b/src/tests/elementary/spec/efl_test_range_interactive.c
index 9753046acd..b7fd4ad793 100644
--- a/src/tests/elementary/spec/efl_test_range_interactive.c
+++ b/src/tests/elementary/spec/efl_test_range_interactive.c
@@ -3,7 +3,9 @@
3#endif 3#endif
4 4
5#include <Efl_Ui.h> 5#include <Efl_Ui.h>
6#include <Elementary.h>
6#include "efl_ui_spec_suite.h" 7#include "efl_ui_spec_suite.h"
8#include "efl_ui_suite.h"
7#include "suite_helpers.h" 9#include "suite_helpers.h"
8 10
9/* spec-meta-start 11/* spec-meta-start
@@ -30,9 +32,60 @@ EFL_START_TEST(step_setting)
30} 32}
31EFL_END_TEST 33EFL_END_TEST
32 34
35static void
36_steady_cb(void *data, const Efl_Event *ev EINA_UNUSED)
37{
38 int *count = data;
39 *count = *count + 1;
40 efl_loop_quit(efl_main_loop_get(), EINA_VALUE_EMPTY);
41}
42
43static Eina_Value
44_quit_ml(void *data EINA_UNUSED, const Eina_Value v EINA_UNUSED, const Eina_Future *dead_future EINA_UNUSED)
45{
46 efl_loop_quit(efl_main_loop_get(), EINA_VALUE_EMPTY);
47 return EINA_VALUE_EMPTY;
48}
49
50EFL_START_TEST(steady_event)
51{
52 Evas *e;
53 int count = 0;
54
55 if (efl_isa(widget, EFL_UI_SPIN_CLASS)) return;
56
57 efl_event_callback_add(widget, EFL_UI_RANGE_EVENT_STEADY, _steady_cb, &count),
58 efl_ui_range_limits_set(widget, 0, 100);
59 efl_ui_range_step_set(widget, 10);
60 efl_ui_range_value_set(widget, 20);
61
62 e = evas_object_evas_get(win);
63
64 efl_layout_signal_process(widget, EINA_TRUE);
65 get_me_to_those_events(widget);
66
67 int x, y, w, h;
68
69 evas_object_geometry_get(widget, &x, &y, &w, &h);
70 evas_event_feed_mouse_in(e, 0, NULL);
71 evas_event_feed_mouse_move(e, x + (w / 2), y + (h / 2), 0, NULL);
72 evas_event_feed_mouse_wheel(e, -1, 1, 0, NULL);
73 evas_event_feed_mouse_up(e, 1, 0, 0, NULL);
74 efl_layout_signal_process(widget, EINA_TRUE);
75 ck_assert_int_eq(efl_ui_range_value_get(widget), 10);
76
77 Eina_Future *f = efl_loop_timeout(efl_main_loop_get(), 10.0);
78 eina_future_then(f, _quit_ml);
79
80 efl_loop_begin(efl_main_loop_get());
81 ck_assert_int_eq(count, 1);
82}
83EFL_END_TEST
84
33void 85void
34efl_ui_range_display_interactive_behavior_test(TCase *tc) 86efl_ui_range_display_interactive_behavior_test(TCase *tc)
35{ 87{
36 tcase_add_test(tc, step_setting); 88 tcase_add_test(tc, step_setting);
89 tcase_add_test(tc, steady_event);
37} 90}
38 91