summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-08 09:12:46 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-08-08 09:12:46 -0400
commit090588f58b61527a03970f772b44ab447340a717 (patch)
treebc4bf7042a26d8db3a15ce9857156a3fc204fc05 /src/tests
parent5f1e44ddadf3e83306d72f2cf3212faf455a3e66 (diff)
efl_ui_selectable: add spec test suite for this
Summary: this brings a spec test suite for Efl.Ui.Selectable Depends on D9517 Reviewers: zmike, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9518
Diffstat (limited to 'src/tests')
-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([