summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-06 22:34:12 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-07 15:02:16 +0200
commitf47fdfc072decc8477c6afa8dcabd78f5082f06f (patch)
tree680fa3e8ed7dcda03ec39cf872796e1895ef565b
parentd11551050d74b0a6d832e65ebf8561031828158d (diff)
efl_ui_selectable: add spec test suite for this
this brings a spec test suite for Efl.Ui.Selectable Differential Revision: https://phab.enlightenment.org/D9518
-rw-r--r--src/tests/elementary/spec/efl_test_selectable.c57
-rw-r--r--src/tests/elementary/spec/efl_ui_spec_suite.h1
-rw-r--r--src/tests/elementary/spec/meson.build1
3 files changed, 59 insertions, 0 deletions
diff --git a/src/tests/elementary/spec/efl_test_selectable.c b/src/tests/elementary/spec/efl_test_selectable.c
new file mode 100644
index 0000000000..fc569ad803
--- /dev/null
+++ b/src/tests/elementary/spec/efl_test_selectable.c
@@ -0,0 +1,57 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Efl_Ui.h>
6#include "efl_ui_spec_suite.h"
7#include "suite_helpers.h"
8
9/* spec-meta-start
10 {"test-interface":"Efl.Ui.Selectable",
11 "test-widgets": ["Efl.Ui.Item.Realized", "Efl.Ui.Check"]}
12
13 spec-meta-end */
14
15static void
16_callback_assert_called_once(void *data, const Efl_Event *ev EINA_UNUSED)
17{
18 int *callback_called = data;
19 ck_assert_int_eq(*callback_called, 0);
20 *callback_called = *callback_called + 1;
21}
22
23EFL_START_TEST(selectable_events)
24{
25 int callback_called = 0;
26 efl_event_callback_add(widget, EFL_UI_EVENT_SELECTED_CHANGED, _callback_assert_called_once, &callback_called);
27 efl_ui_selectable_selected_set(widget, EINA_TRUE);
28 ck_assert_int_eq(efl_ui_selectable_selected_get(widget), EINA_TRUE);
29 ck_assert_int_eq(callback_called, 1);
30 callback_called = 0;
31 efl_ui_selectable_selected_set(widget, EINA_FALSE);
32 ck_assert_int_eq(efl_ui_selectable_selected_get(widget), EINA_FALSE);
33 ck_assert_int_eq(callback_called, 1);
34 callback_called = 0;
35 efl_ui_selectable_selected_set(widget, EINA_TRUE);
36 callback_called = 0;
37 efl_ui_selectable_selected_set(widget, EINA_TRUE);
38 ck_assert_int_eq(callback_called, 0);
39}
40EFL_END_TEST
41
42EFL_START_TEST(selectable_set)
43{
44 ck_assert_int_eq(efl_ui_selectable_selected_get(widget), EINA_FALSE);
45 efl_ui_selectable_selected_set(widget, EINA_TRUE);
46 ck_assert_int_eq(efl_ui_selectable_selected_get(widget), EINA_TRUE);
47 efl_ui_selectable_selected_set(widget, EINA_FALSE);
48 ck_assert_int_eq(efl_ui_selectable_selected_get(widget), EINA_FALSE);
49}
50EFL_END_TEST
51
52void
53efl_ui_selectable_behavior_test(TCase *tc)
54{
55 tcase_add_test(tc, selectable_set);
56 tcase_add_test(tc, selectable_events);
57}
diff --git a/src/tests/elementary/spec/efl_ui_spec_suite.h b/src/tests/elementary/spec/efl_ui_spec_suite.h
index 187d87b0c0..a4bceeaf54 100644
--- a/src/tests/elementary/spec/efl_ui_spec_suite.h
+++ b/src/tests/elementary/spec/efl_ui_spec_suite.h
@@ -21,6 +21,7 @@ void efl_ui_range_display_interactive_behavior_test(TCase *tc);
21void efl_ui_view_behavior_test(TCase *tc); 21void efl_ui_view_behavior_test(TCase *tc);
22void efl_ui_single_selectable_behavior_test(TCase *tc); 22void efl_ui_single_selectable_behavior_test(TCase *tc);
23void efl_ui_multi_selectable_behavior_test(TCase *tc); 23void efl_ui_multi_selectable_behavior_test(TCase *tc);
24void efl_ui_selectable_behavior_test(TCase *tc);
24 25
25void efl_test_container_content_equal(Efl_Ui_Widget **wid, unsigned int len); 26void efl_test_container_content_equal(Efl_Ui_Widget **wid, unsigned int len);
26void efl_test_container_expect_evt_content_added(Efl_Ui_Widget *widget, const Efl_Event_Description *ev, Eina_Bool *flag, void *event_data); 27void efl_test_container_expect_evt_content_added(Efl_Ui_Widget *widget, const Efl_Event_Description *ev, Eina_Bool *flag, void *event_data);
diff --git a/src/tests/elementary/spec/meson.build b/src/tests/elementary/spec/meson.build
index 4de4037eb4..0da3494dfd 100644
--- a/src/tests/elementary/spec/meson.build
+++ b/src/tests/elementary/spec/meson.build
@@ -10,6 +10,7 @@ efl_ui_suite_behavior_test_files = files([
10 'efl_test_ui_view.c', 10 'efl_test_ui_view.c',
11 'efl_test_single_selectable.c', 11 'efl_test_single_selectable.c',
12 'efl_test_multi_selectable.c', 12 'efl_test_multi_selectable.c',
13 'efl_test_selectable.c',
13]) 14])
14 15
15efl_ui_suite_behavior_src = files([ 16efl_ui_suite_behavior_src = files([