summaryrefslogtreecommitdiff
path: root/src/tests/elementary
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/elementary')
-rw-r--r--src/tests/elementary/efl_ui_suite.c9
-rw-r--r--src/tests/elementary/efl_ui_suite.h5
-rw-r--r--src/tests/elementary/efl_ui_test_collection_view.c160
-rw-r--r--src/tests/elementary/efl_ui_test_config.c1
-rw-r--r--src/tests/elementary/efl_ui_test_grid.c7
-rw-r--r--src/tests/elementary/efl_ui_test_layout.c47
-rw-r--r--src/tests/elementary/efl_ui_test_list_collection.c4
-rw-r--r--src/tests/elementary/efl_ui_test_position_manager_common.c1
-rw-r--r--src/tests/elementary/efl_ui_test_relative_container.c (renamed from src/tests/elementary/efl_ui_test_relative_layout.c)58
-rw-r--r--src/tests/elementary/efl_ui_test_scroller.c51
-rw-r--r--src/tests/elementary/efl_ui_test_select_model.c13
-rw-r--r--src/tests/elementary/efl_ui_test_spin_button.c56
-rw-r--r--src/tests/elementary/efl_ui_test_spotlight.c115
-rw-r--r--src/tests/elementary/efl_ui_test_text.c266
-rw-r--r--src/tests/elementary/efl_ui_test_timepicker.c45
-rw-r--r--src/tests/elementary/efl_ui_test_vg_animation.c122
-rw-r--r--src/tests/elementary/elm_cxx_suite.cc15
-rw-r--r--src/tests/elementary/elm_test_check.c68
-rw-r--r--src/tests/elementary/elm_test_entry.c73
-rw-r--r--src/tests/elementary/elm_test_genlist.c194
-rw-r--r--src/tests/elementary/elm_test_layout.c62
-rw-r--r--src/tests/elementary/emoji_wink.json1
-rw-r--r--src/tests/elementary/meson.build5
-rw-r--r--src/tests/elementary/spec/efl_test_basics.c98
-rw-r--r--src/tests/elementary/spec/efl_test_clickable.c6
-rw-r--r--src/tests/elementary/spec/efl_test_content.c10
-rw-r--r--src/tests/elementary/spec/efl_test_format.c4
-rw-r--r--src/tests/elementary/spec/efl_test_gfx_view.c2
-rw-r--r--src/tests/elementary/spec/efl_test_multi_selectable.c84
-rw-r--r--src/tests/elementary/spec/efl_test_pack.c2
-rw-r--r--src/tests/elementary/spec/efl_test_pack_linear.c142
-rw-r--r--src/tests/elementary/spec/efl_test_range_display.c4
-rw-r--r--src/tests/elementary/spec/efl_ui_spec_suite.c56
-rw-r--r--src/tests/elementary/spec/efl_ui_spec_suite.h2
-rwxr-xr-xsrc/tests/elementary/spec/generator.py2
-rw-r--r--src/tests/elementary/spec/meson.build3
-rw-r--r--src/tests/elementary/suite_helpers.c97
-rw-r--r--src/tests/elementary/suite_helpers.h10
38 files changed, 1697 insertions, 203 deletions
diff --git a/src/tests/elementary/efl_ui_suite.c b/src/tests/elementary/efl_ui_suite.c
index efc6f51..b9d8e9b 100644
--- a/src/tests/elementary/efl_ui_suite.c
+++ b/src/tests/elementary/efl_ui_suite.c
@@ -19,7 +19,7 @@ static const Efl_Test_Case etc[] = {
19 { "efl_ui_box_stack", efl_ui_test_box_stack}, 19 { "efl_ui_box_stack", efl_ui_test_box_stack},
20 { "efl_ui_table", efl_ui_test_table}, 20 { "efl_ui_table", efl_ui_test_table},
21 { "efl_ui_grid", efl_ui_test_grid}, 21 { "efl_ui_grid", efl_ui_test_grid},
22 { "efl_ui_relative_layout", efl_ui_test_relative_layout}, 22 { "efl_ui_relative_container", efl_ui_test_relative_container},
23 { "efl_ui_image", efl_ui_test_image}, 23 { "efl_ui_image", efl_ui_test_image},
24 { "efl_ui_image_zoomable", efl_ui_test_image_zoomable}, 24 { "efl_ui_image_zoomable", efl_ui_test_image_zoomable},
25 { "efl_ui_layout", efl_ui_test_layout}, 25 { "efl_ui_layout", efl_ui_test_layout},
@@ -38,13 +38,18 @@ static const Efl_Test_Case etc[] = {
38 { "efl_ui_collection", efl_ui_test_item_container }, 38 { "efl_ui_collection", efl_ui_test_item_container },
39 { "efl_ui_grid_container", efl_ui_test_grid_container }, 39 { "efl_ui_grid_container", efl_ui_test_grid_container },
40 { "efl_ui_list_container", efl_ui_test_list_container }, 40 { "efl_ui_list_container", efl_ui_test_list_container },
41 { "efl_ui_collection_view", efl_ui_test_collection_view },
41 { "efl_ui_select_model", efl_ui_test_select_model }, 42 { "efl_ui_select_model", efl_ui_test_select_model },
42 { "efl_ui_view_model", efl_ui_test_view_model }, 43 { "efl_ui_view_model", efl_ui_test_view_model },
43 { "efl_ui_group_item", efl_ui_test_group_item }, 44 { "efl_ui_group_item", efl_ui_test_group_item },
45 { "efl_ui_text", efl_ui_test_text},
46#ifdef BUILD_VG_LOADER_JSON
47 { "efl_ui_vg_animation", efl_ui_test_vg_animation},
48#endif
44 { NULL, NULL } 49 { NULL, NULL }
45}; 50};
46 51
47EFL_CLASS_SIMPLE_CLASS(efl_ui_widget, "efl_ui_widget", EFL_UI_WIDGET_CLASS); 52EFL_CLASS_SIMPLE_CLASS(efl_ui_widget, "Efl.Ui.Widget", EFL_UI_WIDGET_CLASS);
48 53
49int 54int
50main(int argc, char **argv) 55main(int argc, char **argv)
diff --git a/src/tests/elementary/efl_ui_suite.h b/src/tests/elementary/efl_ui_suite.h
index c37d9ed..af58984 100644
--- a/src/tests/elementary/efl_ui_suite.h
+++ b/src/tests/elementary/efl_ui_suite.h
@@ -25,7 +25,7 @@ void efl_ui_test_box_flow(TCase *tc);
25void efl_ui_test_box_stack(TCase *tc); 25void efl_ui_test_box_stack(TCase *tc);
26void efl_ui_test_table(TCase *tc); 26void efl_ui_test_table(TCase *tc);
27void efl_ui_test_grid(TCase *tc); 27void efl_ui_test_grid(TCase *tc);
28void efl_ui_test_relative_layout(TCase *tc); 28void efl_ui_test_relative_container(TCase *tc);
29void efl_ui_test_atspi(TCase *tc); 29void efl_ui_test_atspi(TCase *tc);
30void efl_ui_test_image_zoomable(TCase *tc); 30void efl_ui_test_image_zoomable(TCase *tc);
31void efl_ui_test_layout(TCase *tc); 31void efl_ui_test_layout(TCase *tc);
@@ -46,12 +46,15 @@ void efl_ui_test_spin_button(TCase *tc);
46void efl_ui_test_item_container(TCase *tc); 46void efl_ui_test_item_container(TCase *tc);
47void efl_ui_test_list_container(TCase *tc); 47void efl_ui_test_list_container(TCase *tc);
48void efl_ui_test_grid_container(TCase *tc); 48void efl_ui_test_grid_container(TCase *tc);
49void efl_ui_test_collection_view(TCase *tc);
49void efl_ui_test_config(TCase *tc); 50void efl_ui_test_config(TCase *tc);
50void efl_ui_test_popup(TCase *tc); 51void efl_ui_test_popup(TCase *tc);
51void efl_ui_test_scroller(TCase *tc); 52void efl_ui_test_scroller(TCase *tc);
52void efl_ui_test_select_model(TCase *tc); 53void efl_ui_test_select_model(TCase *tc);
53void efl_ui_test_view_model(TCase *tc); 54void efl_ui_test_view_model(TCase *tc);
54void efl_ui_test_group_item(TCase *tc); 55void efl_ui_test_group_item(TCase *tc);
56void efl_ui_test_text(TCase *tc);
57void efl_ui_test_vg_animation(TCase *tc);
55 58
56void loop_timer_interval_set(Eo *obj, double in); 59void loop_timer_interval_set(Eo *obj, double in);
57 60
diff --git a/src/tests/elementary/efl_ui_test_collection_view.c b/src/tests/elementary/efl_ui_test_collection_view.c
new file mode 100644
index 0000000..5471dea
--- /dev/null
+++ b/src/tests/elementary/efl_ui_test_collection_view.c
@@ -0,0 +1,160 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Efl_Ui.h>
6#include "efl_ui_suite.h"
7
8#define NUM_ITEMS 50
9
10static Efl_Model*
11_make_model(Efl_Ui_Win *win)
12{
13 Eina_Value vi;
14 Efl_Generic_Model *model, *child;
15 unsigned int i;
16
17 model = efl_add(EFL_GENERIC_MODEL_CLASS, win);
18 model = efl_add(EFL_UI_VIEW_MODEL_CLASS, model,
19 efl_ui_view_model_set(efl_added, model));
20 eina_value_setup(&vi, EINA_VALUE_TYPE_INT);
21
22 efl_ui_view_model_property_string_add(model, "relative", "Relative index ${child.index}", "WRONG", "WRONG");
23 efl_ui_view_model_property_string_add(model, "title", "Initial index ${initial}", "WRONG", "WRONG");
24
25
26 for (i = 0; i < (NUM_ITEMS); i++)
27 {
28 child = efl_model_child_add(model);
29 eina_value_set(&vi, i);
30 efl_model_property_set(child, "initial", &vi);
31 }
32
33 eina_value_flush(&vi);
34 return model;
35}
36
37static Eina_Value
38_quit(Eo *obj, void *data EINA_UNUSED, const Eina_Value v)
39{
40 efl_loop_quit(efl_loop_get(obj), v);
41 return v;
42}
43
44static Eina_Value
45_children_get(Eo *obj EINA_UNUSED, void *data EINA_UNUSED, const Eina_Value v)
46{
47 Efl_Model *child;
48 Eina_Future **all;
49 unsigned int i, len;
50
51 all = calloc(1 + 1, sizeof(Eina_Future*));
52 if (!all) return eina_value_error_init(ENOMEM);
53
54 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
55 {
56 Eina_Value *rel_val, *title_val;
57 char *relative, *title;
58 if (i != 5) continue;
59 rel_val = efl_model_property_get(child, "relative");
60 title_val = efl_model_property_get(child, "title");
61 relative = eina_value_to_string(rel_val);
62 title = eina_value_to_string(title_val);
63
64 ck_assert(eina_streq(relative, "Relative index 5"));
65 ck_assert(eina_streq(title, "Initial index 5"));
66 free(relative);
67 free(title);
68 break;
69 }
70 return EINA_VALUE_EMPTY;
71}
72
73EFL_START_TEST(test_efl_ui_collection_view_basic)
74{
75 Efl_Ui_Win *win;
76 Efl_Model *model;
77 Efl_Ui_List_View *lv;
78 Efl_Ui_Factory *fl;
79 Eina_Future *f;
80 int count_realize = 0;
81 int count_unrealize = 0;
82
83 win = win_add();
84 efl_gfx_entity_size_set(win, EINA_SIZE2D(100, 100));
85
86 model = _make_model(win);
87 fl = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win,
88 efl_ui_property_bind(efl_added, "text", "title"),
89 efl_ui_widget_factory_item_class_set(efl_added, EFL_UI_LIST_DEFAULT_ITEM_CLASS));
90
91 lv = efl_add(EFL_UI_LIST_VIEW_CLASS, win,
92 efl_ui_collection_view_factory_set(efl_added, fl),
93 efl_ui_view_model_set(efl_added, model),
94 efl_event_callback_add(efl_added, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_REALIZED,
95 (void*)event_callback_that_increments_an_int_when_called, &count_realize),
96 efl_event_callback_add(efl_added, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_UNREALIZED,
97 (void*)event_callback_that_increments_an_int_when_called, &count_unrealize)
98 );
99 efl_content_set(win, lv);
100
101 get_me_to_those_events(lv);
102 ck_assert_int_gt(count_realize, 0);
103 /* FIXME: this should eventually be eq(0) */
104 ck_assert_int_gt(count_unrealize, 0);
105
106 f = efl_model_children_slice_get(lv, 0, efl_model_children_count_get(lv));
107 f = efl_future_then(lv, f, .success_type = EINA_VALUE_TYPE_ARRAY, .success = _children_get);
108 ecore_main_loop_iterate();
109 efl_event_callback_del(lv, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_REALIZED, (void*)event_callback_that_increments_an_int_when_called, &count_realize);
110 efl_event_callback_del(lv, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_UNREALIZED, (void*)event_callback_that_increments_an_int_when_called, &count_unrealize);
111}
112EFL_END_TEST
113
114EFL_START_TEST(test_efl_ui_collection_view_select)
115{
116 Efl_Ui_Win *win;
117 Efl_Model *model;
118 Efl_Ui_List_View *lv;
119 Efl_Ui_Factory *fl;
120 Eina_Value *sel_val;
121 unsigned long sel = 10000;
122
123 win = win_add();
124 efl_gfx_entity_size_set(win, EINA_SIZE2D(100, 100));
125
126 model = _make_model(win);
127 model = efl_add(EFL_UI_SELECT_MODEL_CLASS, efl_main_loop_get(), efl_ui_view_model_set(efl_added, model));
128 fl = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win,
129 efl_ui_property_bind(efl_added, "text", "title"),
130 efl_ui_widget_factory_item_class_set(efl_added, EFL_UI_LIST_DEFAULT_ITEM_CLASS));
131
132 lv = efl_add(EFL_UI_LIST_VIEW_CLASS, win,
133 efl_ui_collection_view_factory_set(efl_added, fl),
134 efl_ui_view_model_set(efl_added, model)
135 );
136 efl_content_set(win, lv);
137
138 get_me_to_those_events(lv);
139
140 /* nothing selected yet */
141 sel_val = efl_model_property_get(model, "child.selected");
142 ck_assert(eina_value_type_get(sel_val) == EINA_VALUE_TYPE_ERROR);
143
144 efl_future_then(model, efl_model_property_ready_get(model, "child.selected"), .success = _quit);
145
146 click_object_at(lv, 50, 5);
147 ecore_main_loop_begin();
148
149 sel_val = efl_model_property_get(model, "child.selected");
150 ck_assert(eina_value_type_get(sel_val) == EINA_VALUE_TYPE_ULONG);
151 ck_assert(eina_value_ulong_get(sel_val, &sel));
152 ck_assert_int_eq(sel, 0);
153}
154EFL_END_TEST
155
156void efl_ui_test_collection_view(TCase *tc)
157{
158 tcase_add_test(tc, test_efl_ui_collection_view_basic);
159 tcase_add_test(tc, test_efl_ui_collection_view_select);
160}
diff --git a/src/tests/elementary/efl_ui_test_config.c b/src/tests/elementary/efl_ui_test_config.c
index 40d0415..a9f31ea 100644
--- a/src/tests/elementary/efl_ui_test_config.c
+++ b/src/tests/elementary/efl_ui_test_config.c
@@ -68,7 +68,6 @@ EFL_START_TEST(efl_config_eoapi)
68 CONFIG_CHKD(scroll_thumbscroll_acceleration_time_limit, 0); 68 CONFIG_CHKD(scroll_thumbscroll_acceleration_time_limit, 0);
69 CONFIG_CHKD(scroll_thumbscroll_acceleration_weight, 0); 69 CONFIG_CHKD(scroll_thumbscroll_acceleration_weight, 0);
70 CONFIG_CHKE(focus_autoscroll_mode, EFL_UI_FOCUS_AUTOSCROLL_MODE_NONE, "none"); 70 CONFIG_CHKE(focus_autoscroll_mode, EFL_UI_FOCUS_AUTOSCROLL_MODE_NONE, "none");
71 CONFIG_CHKE(slider_indicator_visible_mode, EFL_UI_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS, "always");
72 CONFIG_CHKD(longpress_timeout, 0); 71 CONFIG_CHKD(longpress_timeout, 0);
73 CONFIG_CHKE(softcursor_mode, EFL_UI_SOFTCURSOR_MODE_ON, "on"); 72 CONFIG_CHKE(softcursor_mode, EFL_UI_SOFTCURSOR_MODE_ON, "on");
74 CONFIG_CHKD(tooltip_delay, 0); 73 CONFIG_CHKD(tooltip_delay, 0);
diff --git a/src/tests/elementary/efl_ui_test_grid.c b/src/tests/elementary/efl_ui_test_grid.c
index 7ec1763..db19e58 100644
--- a/src/tests/elementary/efl_ui_test_grid.c
+++ b/src/tests/elementary/efl_ui_test_grid.c
@@ -89,16 +89,15 @@ EFL_START_TEST(efl_ui_grid_unpack_all)
89 89
90 ck_assert(grid_item_pack(grid, count_before, NULL) != EINA_FALSE); 90 ck_assert(grid_item_pack(grid, count_before, NULL) != EINA_FALSE);
91 91
92 itor = efl_content_iterate(grid);
93 efl_pack_unpack_all(grid); 92 efl_pack_unpack_all(grid);
94 93
95 count = efl_content_count(grid); 94 count = efl_content_count(grid);
96 ck_assert(count == 0); 95 ck_assert(count == 0);
97 96
97 itor = efl_content_iterate(grid);
98 EINA_ITERATOR_FOREACH(itor, item) 98 EINA_ITERATOR_FOREACH(itor, item)
99 efl_del(item); 99 ck_assert(EINA_FALSE);
100 100 eina_iterator_free(itor);
101 free(itor);
102} 101}
103EFL_END_TEST 102EFL_END_TEST
104 103
diff --git a/src/tests/elementary/efl_ui_test_layout.c b/src/tests/elementary/efl_ui_test_layout.c
index 5aa64e0..86f4b1e 100644
--- a/src/tests/elementary/efl_ui_test_layout.c
+++ b/src/tests/elementary/efl_ui_test_layout.c
@@ -149,19 +149,46 @@ EFL_START_TEST(efl_ui_layout_test_layout_force)
149} 149}
150EFL_END_TEST 150EFL_END_TEST
151 151
152/* private */
153EAPI Eina_Bool elm_widget_theme_klass_set(Evas_Object *obj, const char *name);
154EAPI Eina_Bool elm_widget_theme_style_set(Evas_Object *obj, const char *name);
155
156EFL_START_TEST(efl_ui_layout_test_callback)
157{
158 Evas_Object *win;
159 int called = 0;
160 Eina_Bool klass, style;
161
162 win = win_add(NULL, "layout", EFL_UI_WIN_TYPE_BASIC);
163 efl_add(EFL_UI_LAYOUT_CLASS, win,
164 efl_event_callback_add(efl_added, EFL_UI_LAYOUT_EVENT_THEME_CHANGED, (void*)event_callback_single_call_int_data, &called),
165 klass = elm_widget_theme_klass_set(efl_added, "button"),
166 style = elm_widget_theme_style_set(efl_added, "anchor")
167 );
168 ck_assert_int_eq(klass, 1);
169 ck_assert_int_eq(style, 1);
170 ck_assert_int_eq(called, 1);
171}
172EFL_END_TEST
173
152EFL_START_TEST(efl_ui_layout_test_layout_theme) 174EFL_START_TEST(efl_ui_layout_test_layout_theme)
153{ 175{
154 Evas_Object *win; 176 Evas_Object *win;
155 const char *klass, *group, *style; 177 const char *klass, *group, *style;
178 Eina_Error err;
179 int called = 0;
156 180
157 win = win_add(NULL, "layout", EFL_UI_WIN_TYPE_BASIC); 181 win = win_add(NULL, "layout", EFL_UI_WIN_TYPE_BASIC);
158 Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, win, 182 Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, win,
159 efl_ui_layout_theme_set(efl_added, "win", "background", NULL) 183 efl_event_callback_add(efl_added, EFL_UI_LAYOUT_EVENT_THEME_CHANGED, (void*)event_callback_single_call_int_data, &called),
184 err = efl_ui_layout_theme_set(efl_added, "button", NULL, "anchor")
160 ); 185 );
186 ck_assert_int_eq(err, 0);
161 efl_ui_layout_theme_get(layout, &klass, &group, &style); 187 efl_ui_layout_theme_get(layout, &klass, &group, &style);
162 ck_assert_str_eq(klass, "win"); 188 ck_assert_str_eq(klass, "button");
163 ck_assert_str_eq(group, "background"); 189 ck_assert(!group);
164 ck_assert(!style); 190 ck_assert_str_eq(style, "anchor");
191 ck_assert_int_eq(called, 1);
165} 192}
166EFL_END_TEST 193EFL_END_TEST
167 194
@@ -181,6 +208,16 @@ EFL_START_TEST(efl_ui_layout_test_api_ordering)
181} 208}
182EFL_END_TEST 209EFL_END_TEST
183 210
211EFL_START_TEST(efl_ui_layout_test_versioning)
212{
213 Evas_Object *win;
214
215 win = win_add(NULL, "layout", EFL_UI_WIN_TYPE_BASIC);
216 Eo *layout = efl_add(EFL_UI_BUTTON_CLASS, win);
217 ck_assert_int_eq(efl_ui_layout_theme_version_get(layout), 123);
218}
219EFL_END_TEST
220
184void efl_ui_test_layout(TCase *tc) 221void efl_ui_test_layout(TCase *tc)
185{ 222{
186 tcase_add_test(tc, efl_ui_layout_test_property_bind); 223 tcase_add_test(tc, efl_ui_layout_test_property_bind);
@@ -189,5 +226,7 @@ void efl_ui_test_layout(TCase *tc)
189 tcase_add_test(tc, efl_ui_layout_test_layout_force); 226 tcase_add_test(tc, efl_ui_layout_test_layout_force);
190 tcase_add_test(tc, efl_ui_layout_test_layout_theme); 227 tcase_add_test(tc, efl_ui_layout_test_layout_theme);
191 tcase_add_test(tc, efl_ui_layout_test_api_ordering); 228 tcase_add_test(tc, efl_ui_layout_test_api_ordering);
229 tcase_add_test(tc, efl_ui_layout_test_callback);
192 tcase_add_test(tc, efl_ui_layout_test_property_bind_provider); 230 tcase_add_test(tc, efl_ui_layout_test_property_bind_provider);
231 tcase_add_test(tc, efl_ui_layout_test_versioning);
193} 232}
diff --git a/src/tests/elementary/efl_ui_test_list_collection.c b/src/tests/elementary/efl_ui_test_list_collection.c
index 1d4f913..94bafbd 100644
--- a/src/tests/elementary/efl_ui_test_list_collection.c
+++ b/src/tests/elementary/efl_ui_test_list_collection.c
@@ -161,7 +161,7 @@ EFL_START_TEST(placement_test_group)
161 r = efl_gfx_entity_geometry_get(core_item[i]); 161 r = efl_gfx_entity_geometry_get(core_item[i]);
162 162
163 ck_assert_int_eq(r.x, 1); 163 ck_assert_int_eq(r.x, 1);
164 ck_assert_int_eq(r.y, 21+(i - 1)*40); 164 ck_assert_int_eq(r.y, 22+(i - 1)*40);
165 ck_assert_int_eq(r.w, 183); // 200 - 2px border - X for the width of the scrollbar. 165 ck_assert_int_eq(r.w, 183); // 200 - 2px border - X for the width of the scrollbar.
166 ck_assert_int_eq(r.h, 40); 166 ck_assert_int_eq(r.h, 40);
167 } 167 }
@@ -181,7 +181,7 @@ EFL_START_TEST(placement_test_group)
181 r = efl_gfx_entity_geometry_get(core_item[i]); 181 r = efl_gfx_entity_geometry_get(core_item[i]);
182 182
183 ck_assert_int_eq(r.x, 1); 183 ck_assert_int_eq(r.x, 1);
184 ck_assert_int_eq(r.y, 1+(i-2)*40); 184 ck_assert_int_eq(r.y, 2+(i-2)*40);
185 ck_assert_int_eq(r.w, 183); // 200 - 2px border - X for the width of the scrollbar. 185 ck_assert_int_eq(r.w, 183); // 200 - 2px border - X for the width of the scrollbar.
186 ck_assert_int_eq(r.h, 40); 186 ck_assert_int_eq(r.h, 40);
187 } 187 }
diff --git a/src/tests/elementary/efl_ui_test_position_manager_common.c b/src/tests/elementary/efl_ui_test_position_manager_common.c
index 63e31d4..ea73d01 100644
--- a/src/tests/elementary/efl_ui_test_position_manager_common.c
+++ b/src/tests/elementary/efl_ui_test_position_manager_common.c
@@ -71,6 +71,7 @@ _initial_setup(void)
71 arr_size = eina_inarray_new(sizeof(Eina_Size2D), 10); 71 arr_size = eina_inarray_new(sizeof(Eina_Size2D), 10);
72 72
73 efl_ui_position_manager_data_access_v1_data_access_set(position_manager, 73 efl_ui_position_manager_data_access_v1_data_access_set(position_manager,
74 win,
74 NULL, _obj_accessor_get_at, NULL, 75 NULL, _obj_accessor_get_at, NULL,
75 NULL, _size_accessor_get_at, NULL, 76 NULL, _size_accessor_get_at, NULL,
76 0); 77 0);
diff --git a/src/tests/elementary/efl_ui_test_relative_layout.c b/src/tests/elementary/efl_ui_test_relative_container.c
index 3f68cc0..35cf5a2 100644
--- a/src/tests/elementary/efl_ui_test_relative_layout.c
+++ b/src/tests/elementary/efl_ui_test_relative_container.c
@@ -212,24 +212,24 @@ layout_setup()
212 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), 212 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
213 efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC)); 213 efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC));
214 214
215 layout = efl_add(EFL_UI_RELATIVE_LAYOUT_CLASS, win, 215 layout = efl_add(EFL_UI_RELATIVE_CONTAINER_CLASS, win,
216 efl_gfx_entity_size_set(efl_added, EINA_SIZE2D(200, 200))); 216 efl_gfx_entity_size_set(efl_added, EINA_SIZE2D(200, 200)));
217 217
218 efl_gfx_entity_size_set(win, EINA_SIZE2D(200, 200)); 218 efl_gfx_entity_size_set(win, EINA_SIZE2D(200, 200));
219} 219}
220 220
221EFL_START_TEST (efl_ui_relative_layout_class_check) 221EFL_START_TEST (efl_ui_relative_container_class_check)
222{ 222{
223 const char *class; 223 const char *class;
224 224
225 class = efl_class_name_get(layout); 225 class = efl_class_name_get(layout);
226 226
227 ck_assert(class != NULL); 227 ck_assert(class != NULL);
228 ck_assert(!strcmp(class, "Efl.Ui.Relative_Layout")); 228 ck_assert(!strcmp(class, "Efl.Ui.Relative_Container"));
229} 229}
230EFL_END_TEST 230EFL_END_TEST
231 231
232EFL_START_TEST (efl_ui_relative_layout_layout_update) 232EFL_START_TEST (efl_ui_relative_container_layout_update)
233{ 233{
234 int i, max_index = (sizeof(hints) / sizeof(Hint)); 234 int i, max_index = (sizeof(hints) / sizeof(Hint));
235 235
@@ -243,7 +243,7 @@ EFL_START_TEST (efl_ui_relative_layout_layout_update)
243} 243}
244EFL_END_TEST 244EFL_END_TEST
245 245
246EFL_START_TEST (efl_ui_relative_layout_layout_update_chain) 246EFL_START_TEST (efl_ui_relative_container_layout_update_chain)
247{ 247{
248 int i, max_index2, max_index3; 248 int i, max_index2, max_index3;
249 Eo *btn, *btn2, *btn3; 249 Eo *btn, *btn2, *btn3;
@@ -254,8 +254,8 @@ EFL_START_TEST (efl_ui_relative_layout_layout_update_chain)
254 max_index2 = ((sizeof(hints2) / sizeof(Hint)) / 2); 254 max_index2 = ((sizeof(hints2) / sizeof(Hint)) / 2);
255 max_index3 = ((sizeof(hints3) / sizeof(Hint)) / 3); 255 max_index3 = ((sizeof(hints3) / sizeof(Hint)) / 3);
256 256
257 efl_ui_relative_layout_relation_bottom_set(layout, btn, btn2, 0.0); 257 efl_ui_relative_container_relation_bottom_set(layout, btn, btn2, 0.0);
258 efl_ui_relative_layout_relation_top_set(layout, btn2, btn, 1.0); 258 efl_ui_relative_container_relation_top_set(layout, btn2, btn, 1.0);
259 259
260 for (i = 0; i < max_index2; i++) 260 for (i = 0; i < max_index2; i++)
261 { 261 {
@@ -266,8 +266,8 @@ EFL_START_TEST (efl_ui_relative_layout_layout_update_chain)
266 } 266 }
267 267
268 btn3 = efl_add(EFL_UI_BUTTON_CLASS, layout); 268 btn3 = efl_add(EFL_UI_BUTTON_CLASS, layout);
269 efl_ui_relative_layout_relation_bottom_set(layout, btn2, btn3, 0.0); 269 efl_ui_relative_container_relation_bottom_set(layout, btn2, btn3, 0.0);
270 efl_ui_relative_layout_relation_top_set(layout, btn3, btn2, 1.0); 270 efl_ui_relative_container_relation_top_set(layout, btn3, btn2, 1.0);
271 271
272 for (i = 0; i < max_index3; i++) 272 for (i = 0; i < max_index3; i++)
273 { 273 {
@@ -281,7 +281,7 @@ EFL_START_TEST (efl_ui_relative_layout_layout_update_chain)
281} 281}
282EFL_END_TEST 282EFL_END_TEST
283 283
284EFL_START_TEST (efl_ui_relative_layout_relation_set) 284EFL_START_TEST (efl_ui_relative_container_relation_set)
285{ 285{
286 Eo *btn; 286 Eo *btn;
287 Eo *target = NULL; 287 Eo *target = NULL;
@@ -290,48 +290,48 @@ EFL_START_TEST (efl_ui_relative_layout_relation_set)
290 btn = efl_add(EFL_UI_BUTTON_CLASS, layout); 290 btn = efl_add(EFL_UI_BUTTON_CLASS, layout);
291 291
292 // negative test 292 // negative test
293 efl_ui_relative_layout_relation_top_get(layout, NULL, &target, &relative); 293 efl_ui_relative_container_relation_top_get(layout, NULL, &target, &relative);
294 ck_assert_ptr_eq(target, NULL); 294 ck_assert_ptr_eq(target, NULL);
295 ck_assert(EINA_DBL_EQ(relative, 0.0)); 295 ck_assert(EINA_DBL_EQ(relative, 0.0));
296 296
297 efl_ui_relative_layout_relation_top_get(layout, btn, &target, &relative); 297 efl_ui_relative_container_relation_top_get(layout, btn, &target, &relative);
298 ck_assert_ptr_eq(target, NULL); 298 ck_assert_ptr_eq(target, NULL);
299 ck_assert(EINA_DBL_EQ(relative, 0.0)); 299 ck_assert(EINA_DBL_EQ(relative, 0.0));
300 300
301 efl_ui_relative_layout_relation_top_set(layout, NULL, NULL, 0.0); 301 efl_ui_relative_container_relation_top_set(layout, NULL, NULL, 0.0);
302 ck_assert_ptr_eq(target, NULL); 302 ck_assert_ptr_eq(target, NULL);
303 ck_assert(EINA_DBL_EQ(relative, 0.0)); 303 ck_assert(EINA_DBL_EQ(relative, 0.0));
304 304
305 // default value test 305 // default value test
306 efl_ui_relative_layout_relation_top_set(layout, btn, layout, 0.0); 306 efl_ui_relative_container_relation_top_set(layout, btn, layout, 0.0);
307 307
308 efl_ui_relative_layout_relation_top_get(layout, btn, &target, &relative); 308 efl_ui_relative_container_relation_top_get(layout, btn, &target, &relative);
309 ck_assert_ptr_eq(target, layout); 309 ck_assert_ptr_eq(target, layout);
310 ck_assert(EINA_DBL_EQ(relative, 0.0)); 310 ck_assert(EINA_DBL_EQ(relative, 0.0));
311 efl_ui_relative_layout_relation_bottom_get(layout, btn, &target, &relative); 311 efl_ui_relative_container_relation_bottom_get(layout, btn, &target, &relative);
312 ck_assert_ptr_eq(target, layout); 312 ck_assert_ptr_eq(target, layout);
313 ck_assert(EINA_DBL_EQ(relative, 1.0)); 313 ck_assert(EINA_DBL_EQ(relative, 1.0));
314 efl_ui_relative_layout_relation_left_get(layout, btn, &target, &relative); 314 efl_ui_relative_container_relation_left_get(layout, btn, &target, &relative);
315 ck_assert_ptr_eq(target, layout); 315 ck_assert_ptr_eq(target, layout);
316 ck_assert(EINA_DBL_EQ(relative, 0.0)); 316 ck_assert(EINA_DBL_EQ(relative, 0.0));
317 efl_ui_relative_layout_relation_right_get(layout, btn, &target, &relative); 317 efl_ui_relative_container_relation_right_get(layout, btn, &target, &relative);
318 ck_assert_ptr_eq(target, layout); 318 ck_assert_ptr_eq(target, layout);
319 ck_assert(EINA_DBL_EQ(relative, 1.0)); 319 ck_assert(EINA_DBL_EQ(relative, 1.0));
320 320
321 // positive test 321 // positive test
322 efl_ui_relative_layout_relation_top_set(layout, btn, layout, 0.123); 322 efl_ui_relative_container_relation_top_set(layout, btn, layout, 0.123);
323 efl_ui_relative_layout_relation_top_get(layout, btn, &target, &relative); 323 efl_ui_relative_container_relation_top_get(layout, btn, &target, &relative);
324 ck_assert_ptr_eq(target, layout); 324 ck_assert_ptr_eq(target, layout);
325 ck_assert(EINA_DBL_EQ(relative, 0.123)); 325 ck_assert(EINA_DBL_EQ(relative, 0.123));
326 326
327 efl_ui_relative_layout_relation_top_set(layout, btn, NULL, 0.456); 327 efl_ui_relative_container_relation_top_set(layout, btn, NULL, 0.456);
328 efl_ui_relative_layout_relation_top_get(layout, btn, &target, &relative); 328 efl_ui_relative_container_relation_top_get(layout, btn, &target, &relative);
329 ck_assert_ptr_eq(target, layout); 329 ck_assert_ptr_eq(target, layout);
330 ck_assert(EINA_DBL_EQ(relative, 0.456)); 330 ck_assert(EINA_DBL_EQ(relative, 0.456));
331} 331}
332EFL_END_TEST 332EFL_END_TEST
333 333
334EFL_START_TEST (efl_ui_relative_layout_pack) 334EFL_START_TEST (efl_ui_relative_container_pack)
335{ 335{
336 Eo *btn[3], *child; 336 Eo *btn[3], *child;
337 Eina_Iterator *it; 337 Eina_Iterator *it;
@@ -363,12 +363,12 @@ EFL_START_TEST (efl_ui_relative_layout_pack)
363} 363}
364EFL_END_TEST 364EFL_END_TEST
365 365
366void efl_ui_test_relative_layout(TCase *tc) 366void efl_ui_test_relative_container(TCase *tc)
367{ 367{
368 tcase_add_checked_fixture(tc, layout_setup, NULL); 368 tcase_add_checked_fixture(tc, layout_setup, NULL);
369 tcase_add_test(tc, efl_ui_relative_layout_class_check); 369 tcase_add_test(tc, efl_ui_relative_container_class_check);
370 tcase_add_test(tc, efl_ui_relative_layout_layout_update); 370 tcase_add_test(tc, efl_ui_relative_container_layout_update);
371 tcase_add_test(tc, efl_ui_relative_layout_layout_update_chain); 371 tcase_add_test(tc, efl_ui_relative_container_layout_update_chain);
372 tcase_add_test(tc, efl_ui_relative_layout_relation_set); 372 tcase_add_test(tc, efl_ui_relative_container_relation_set);
373 tcase_add_test(tc, efl_ui_relative_layout_pack); 373 tcase_add_test(tc, efl_ui_relative_container_pack);
374} 374}
diff --git a/src/tests/elementary/efl_ui_test_scroller.c b/src/tests/elementary/efl_ui_test_scroller.c
index e1aa4ef..78f8bfa 100644
--- a/src/tests/elementary/efl_ui_test_scroller.c
+++ b/src/tests/elementary/efl_ui_test_scroller.c
@@ -144,7 +144,58 @@ EFL_START_TEST(efl_ui_test_scroller_events)
144} 144}
145EFL_END_TEST 145EFL_END_TEST
146 146
147EFL_START_TEST(efl_ui_test_scroller_scrollbar)
148{
149 Eo *sc;
150
151 Eo *win = win_add();
152 Eina_Bool hbar_visible = EINA_FALSE, vbar_visible = EINA_FALSE;
153 efl_gfx_entity_size_set(win, EINA_SIZE2D(500, 500));
154
155 sc = efl_add(EFL_UI_SCROLLER_CLASS, win,
156 efl_ui_scrollbar_bar_mode_set(efl_added, EFL_UI_SCROLLBAR_MODE_AUTO, EFL_UI_SCROLLBAR_MODE_AUTO),
157 efl_content_set(win, efl_added));
158
159 /*Scrollbar auto mode test.*/
160 efl_loop_iterate(efl_main_loop_get());
161
162 efl_ui_scrollbar_bar_visibility_get(sc, &hbar_visible, &vbar_visible);
163 ck_assert(hbar_visible == EINA_FALSE);
164 ck_assert(vbar_visible == EINA_FALSE);
165
166 /*Scrollbar auto mode test.*/
167 efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_object_evas_get(sc),
168 efl_gfx_entity_size_set(efl_added, EINA_SIZE2D(5000, 5000)),
169 efl_content_set(sc, efl_added));
170
171 efl_loop_iterate(efl_main_loop_get());
172
173 efl_ui_scrollbar_bar_visibility_get(sc, &hbar_visible, &vbar_visible);
174 ck_assert(hbar_visible == EINA_TRUE);
175 ck_assert(vbar_visible == EINA_TRUE);
176
177 /*Scrollbar off mode test.*/
178 efl_ui_scrollbar_bar_mode_set(sc, EFL_UI_SCROLLBAR_MODE_OFF, EFL_UI_SCROLLBAR_MODE_OFF);
179
180 efl_loop_iterate(efl_main_loop_get());
181
182 efl_ui_scrollbar_bar_visibility_get(sc, &hbar_visible, &vbar_visible);
183 ck_assert(hbar_visible == EINA_FALSE);
184 ck_assert(vbar_visible == EINA_FALSE);
185
186 /*Scrollbar on mode test.*/
187 efl_ui_scrollbar_bar_mode_set(sc, EFL_UI_SCROLLBAR_MODE_ON, EFL_UI_SCROLLBAR_MODE_ON);
188
189 efl_loop_iterate(efl_main_loop_get());
190
191 efl_ui_scrollbar_bar_visibility_get(sc, &hbar_visible, &vbar_visible);
192 ck_assert(hbar_visible == EINA_TRUE);
193 ck_assert(vbar_visible == EINA_TRUE);
194}
195EFL_END_TEST
196
147void efl_ui_test_scroller(TCase *tc) 197void efl_ui_test_scroller(TCase *tc)
148{ 198{
149 tcase_add_test(tc, efl_ui_test_scroller_events); 199 tcase_add_test(tc, efl_ui_test_scroller_events);
200 tcase_add_test(tc, efl_ui_test_scroller_scrollbar);
150} 201}
diff --git a/src/tests/elementary/efl_ui_test_select_model.c b/src/tests/elementary/efl_ui_test_select_model.c
index e2b61c5..7825908 100644
--- a/src/tests/elementary/efl_ui_test_select_model.c
+++ b/src/tests/elementary/efl_ui_test_select_model.c
@@ -84,7 +84,7 @@ EFL_START_TEST(efl_test_select_model)
84 Efl_Ui_Select_Model *model; 84 Efl_Ui_Select_Model *model;
85 Eina_Future *future; 85 Eina_Future *future;
86 Eina_Iterator *it; 86 Eina_Iterator *it;
87 uint64_t *index; 87 unsigned int *index;
88 88
89 eina_value_setup(&v, EINA_VALUE_TYPE_INT); 89 eina_value_setup(&v, EINA_VALUE_TYPE_INT);
90 90
@@ -102,8 +102,11 @@ EFL_START_TEST(efl_test_select_model)
102 model = efl_add_ref(EFL_UI_SELECT_MODEL_CLASS, efl_main_loop_get(), 102 model = efl_add_ref(EFL_UI_SELECT_MODEL_CLASS, efl_main_loop_get(),
103 efl_ui_view_model_set(efl_added, base_model)); 103 efl_ui_view_model_set(efl_added, base_model));
104 ck_assert(!!model); 104 ck_assert(!!model);
105 future = efl_model_property_set(model, "child.selected", eina_value_int_new(2)); 105
106 future = efl_model_property_ready_get(model, "child.selected");
106 eina_future_then(future, _wait_propagate, NULL, NULL); 107 eina_future_then(future, _wait_propagate, NULL, NULL);
108
109 efl_model_property_set(model, "child.selected", eina_value_int_new(2));
107 ecore_main_loop_begin(); 110 ecore_main_loop_begin();
108 111
109 future = efl_model_children_slice_get(model, 0, efl_model_children_count_get(model)); 112 future = efl_model_children_slice_get(model, 0, efl_model_children_count_get(model));
@@ -111,15 +114,17 @@ EFL_START_TEST(efl_test_select_model)
111 114
112 ecore_main_loop_begin(); 115 ecore_main_loop_begin();
113 116
114 it = efl_ui_multi_selectable_async_selected_iterator_new(model); 117 it = efl_ui_multi_selectable_selected_ndx_iterator_new(model);
115 EINA_ITERATOR_FOREACH(it, index) 118 EINA_ITERATOR_FOREACH(it, index)
116 fail_if(*index != 2); 119 fail_if(*index != 2);
117 eina_iterator_free(it); 120 eina_iterator_free(it);
118 121
119 it = efl_ui_multi_selectable_async_unselected_iterator_new(model); 122 it = efl_ui_multi_selectable_unselected_ndx_iterator_new(model);
120 EINA_ITERATOR_FOREACH(it, index) 123 EINA_ITERATOR_FOREACH(it, index)
121 fail_if(*index == 2); 124 fail_if(*index == 2);
122 eina_iterator_free(it); 125 eina_iterator_free(it);
126
127 efl_model_property_set(model, "child.selected", eina_value_int_new(1));
123} 128}
124EFL_END_TEST 129EFL_END_TEST
125 130
diff --git a/src/tests/elementary/efl_ui_test_spin_button.c b/src/tests/elementary/efl_ui_test_spin_button.c
index a60314f..f723e34 100644
--- a/src/tests/elementary/efl_ui_test_spin_button.c
+++ b/src/tests/elementary/efl_ui_test_spin_button.c
@@ -156,6 +156,59 @@ EFL_START_TEST (spin_value_dec_min)
156} 156}
157EFL_END_TEST 157EFL_END_TEST
158 158
159EFL_START_TEST (spin_wraparound)
160{
161 efl_ui_spin_button_wraparound_set(spin, EINA_TRUE);
162 efl_ui_range_limits_set(spin, 10, 30);
163 efl_ui_range_step_set(spin, 20);
164
165 efl_ui_range_value_set(spin, 20);
166 click_spin_part(spin, "efl.inc_button");
167 ck_assert_int_eq(efl_ui_range_value_get(spin), 10);
168
169 efl_ui_range_value_set(spin, 20);
170 click_spin_part(spin, "efl.dec_button");
171 ck_assert_int_eq(efl_ui_range_value_get(spin), 30);
172
173}
174EFL_END_TEST
175
176EFL_START_TEST (spin_double_values)
177{
178 double step = 0.1;
179 efl_ui_range_limits_set(spin, 10, 30);
180 efl_ui_range_value_set(spin, 20);
181 efl_ui_range_step_set(spin, step);
182 ck_assert(EINA_DBL_EQ(efl_ui_range_step_get(spin), step));
183 get_me_to_those_events(spin);
184 ck_assert(EINA_DBL_EQ(efl_ui_range_value_get(spin), 20.0));
185
186 for (int i = 0; i < 5; ++i)
187 {
188 click_part(spin, "efl.inc_button");
189 get_me_to_those_events(spin);
190 }
191 ck_assert_int_eq(EINA_DBL_EQ(efl_ui_range_value_get(spin), 20.5), 1);
192}
193EFL_END_TEST
194
195EFL_START_TEST (spin_double_values_hitting_max_with_step)
196{
197 //idea is to check that spin button can hit max with inc, even if value is not multiple is 2.7
198 efl_ui_range_limits_set(spin, 10, 30);
199 efl_ui_range_value_set(spin, 27);
200 efl_ui_range_step_set(spin, 2.7);
201 get_me_to_those_events(spin);
202
203 for (int i = 0; i < 2; ++i)
204 {
205 click_part(spin, "efl.inc_button");
206 get_me_to_those_events(spin);
207 }
208 ck_assert_int_eq(EINA_DBL_EQ(efl_ui_range_value_get(spin), 30), 1);
209}
210EFL_END_TEST
211
159void efl_ui_test_spin_button(TCase *tc) 212void efl_ui_test_spin_button(TCase *tc)
160{ 213{
161 tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown); 214 tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
@@ -164,4 +217,7 @@ void efl_ui_test_spin_button(TCase *tc)
164 tcase_add_test(tc, spin_value_inc); 217 tcase_add_test(tc, spin_value_inc);
165 tcase_add_test(tc, spin_value_inc_max); 218 tcase_add_test(tc, spin_value_inc_max);
166 tcase_add_test(tc, spin_value_dec_min); 219 tcase_add_test(tc, spin_value_dec_min);
220 tcase_add_test(tc, spin_wraparound);
221 tcase_add_test(tc, spin_double_values);
222 tcase_add_test(tc, spin_double_values_hitting_max_with_step);
167} 223}
diff --git a/src/tests/elementary/efl_ui_test_spotlight.c b/src/tests/elementary/efl_ui_test_spotlight.c
index c093efb..e26acad 100644
--- a/src/tests/elementary/efl_ui_test_spotlight.c
+++ b/src/tests/elementary/efl_ui_test_spotlight.c
@@ -6,8 +6,8 @@
6#include "efl_ui_suite.h" 6#include "efl_ui_suite.h"
7#include "eo_internal.h" 7#include "eo_internal.h"
8 8
9EFL_CLASS_SIMPLE_CLASS(efl_ui_spotlight_manager, "efl_ui_spotlight_manager", EFL_UI_SPOTLIGHT_MANAGER_CLASS); 9EFL_CLASS_SIMPLE_CLASS(efl_ui_spotlight_manager, "Efl.Ui.Spotlight.Manager", EFL_UI_SPOTLIGHT_MANAGER_CLASS);
10EFL_CLASS_SIMPLE_CLASS(efl_ui_spotlight_indicator, "efl_ui_spotlight_indicator", EFL_UI_SPOTLIGHT_INDICATOR_CLASS); 10EFL_CLASS_SIMPLE_CLASS(efl_ui_spotlight_indicator, "Efl.Ui.Spotlight.Indicator", EFL_UI_SPOTLIGHT_INDICATOR_CLASS);
11 11
12static Efl_Ui_Win *win; 12static Efl_Ui_Win *win;
13static Efl_Ui_Spotlight_Container *container; 13static Efl_Ui_Spotlight_Container *container;
@@ -116,6 +116,7 @@ typedef struct {
116 } spotlight; 116 } spotlight;
117 struct { 117 struct {
118 int called; 118 int called;
119 Eina_Bool value;
119 } animation; 120 } animation;
120 double last_position; 121 double last_position;
121} Transition_Calls; 122} Transition_Calls;
@@ -187,7 +188,7 @@ static void
187_transition_animation_set(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Eina_Bool animation) 188_transition_animation_set(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Eina_Bool animation)
188{ 189{
189 transition_calls.animation.called++; 190 transition_calls.animation.called++;
190 ck_assert_int_eq(animation, EINA_TRUE); 191 transition_calls.animation.value = animation;
191} 192}
192 193
193static Eina_Bool 194static Eina_Bool
@@ -197,8 +198,8 @@ _transition_animation_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
197} 198}
198 199
199EFL_OPS_DEFINE(transition_tracker, 200EFL_OPS_DEFINE(transition_tracker,
200 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animation_enabled_set, _transition_animation_set), 201 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animated_transition_set, _transition_animation_set),
201 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animation_enabled_get, _transition_animation_get), 202 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animated_transition_get, _transition_animation_get),
202 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_content_add, _transition_content_add), 203 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_content_add, _transition_content_add),
203 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_content_del, _transition_content_del), 204 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_content_del, _transition_content_del),
204 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_switch_to, _transition_request_switch), 205 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_switch_to, _transition_request_switch),
@@ -254,18 +255,18 @@ EFL_START_TEST (efl_ui_spotlight_active_index)
254} 255}
255EFL_END_TEST 256EFL_END_TEST
256 257
257EFL_START_TEST (efl_ui_smart_transition_calls) 258static void
259_verify_transition_calls(int number_of_animation_calls, Eina_Bool animation_value)
258{ 260{
259 Efl_Ui_Widget *w, *w1, *w2; 261 Efl_Ui_Widget *w, *w1, *w2;
260 Efl_Ui_Spotlight_Manager*t = _create_transition();
261 262
262 w = efl_add(WIDGET_CLASS, win); 263 w = efl_add(WIDGET_CLASS, win);
263 w1 = efl_add(WIDGET_CLASS, win); 264 w1 = efl_add(WIDGET_CLASS, win);
264 w2 = efl_add(WIDGET_CLASS, win); 265 w2 = efl_add(WIDGET_CLASS, win);
265 266
266 efl_ui_spotlight_manager_set(container, t);
267 transition_calls.last_position = -2.0; 267 transition_calls.last_position = -2.0;
268 ck_assert_int_eq(transition_calls.animation.called, 1); 268 ck_assert_int_eq(transition_calls.animation.called, number_of_animation_calls);
269 ck_assert_int_eq(transition_calls.animation.value, animation_value);
269 ck_assert_int_eq(transition_calls.spotlight.called, 1); 270 ck_assert_int_eq(transition_calls.spotlight.called, 1);
270 ck_assert_ptr_eq(transition_calls.spotlight.spotlight, container); 271 ck_assert_ptr_eq(transition_calls.spotlight.spotlight, container);
271 //We cannot verify group 272 //We cannot verify group
@@ -343,6 +344,24 @@ EFL_START_TEST (efl_ui_smart_transition_calls)
343 ck_assert_ptr_eq(transition_calls.content_del.current_page_at_call, w2); 344 ck_assert_ptr_eq(transition_calls.content_del.current_page_at_call, w2);
344 transition_calls.content_del.called = 0; 345 transition_calls.content_del.called = 0;
345} 346}
347
348EFL_START_TEST (efl_ui_smart_transition_calls)
349{
350 Efl_Ui_Spotlight_Manager*t = _create_transition();
351 efl_ui_spotlight_manager_set(container, t);
352
353 _verify_transition_calls(2, EINA_TRUE);
354}
355EFL_END_TEST
356
357EFL_START_TEST (efl_ui_smart_transition_calls_no_animation)
358{
359 Efl_Ui_Spotlight_Manager*t = _create_transition();
360 efl_ui_spotlight_manager_set(container, t);
361 efl_ui_spotlight_animated_transition_set(container, EINA_FALSE);
362
363 _verify_transition_calls(3, EINA_FALSE);
364}
346EFL_END_TEST 365EFL_END_TEST
347 366
348 367
@@ -521,8 +540,8 @@ EFL_START_TEST (efl_ui_spotlight_test_push1)
521 } 540 }
522 Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win); 541 Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
523 efl_ui_spotlight_push(container, w); 542 efl_ui_spotlight_push(container, w);
524 ck_assert_int_eq(efl_pack_index_get(container, w), 0); 543 ck_assert_int_eq(efl_pack_index_get(container, w), 1);
525 ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), efl_pack_content_get(container, 0)); 544 ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), efl_pack_content_get(container, 1));
526} 545}
527EFL_END_TEST 546EFL_END_TEST
528 547
@@ -537,7 +556,7 @@ EFL_START_TEST (efl_ui_spotlight_test_push2)
537 } 556 }
538 Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win); 557 Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
539 efl_ui_spotlight_push(container, w); 558 efl_ui_spotlight_push(container, w);
540 ck_assert_int_eq(efl_pack_index_get(container, w), 3); 559 ck_assert_int_eq(efl_pack_index_get(container, w), 4);
541 ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w); 560 ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
542} 561}
543EFL_END_TEST 562EFL_END_TEST
@@ -618,6 +637,75 @@ EFL_START_TEST (efl_ui_spotlight_test_pop3)
618} 637}
619EFL_END_TEST 638EFL_END_TEST
620 639
640EFL_START_TEST (efl_ui_spotlight_animated_transition)
641{
642 //this checks animation handing with the plain manager, there is no animation that will be played, but the flag should be preserved
643 ck_assert_int_eq(efl_ui_spotlight_animated_transition_get(container), EINA_TRUE);
644 efl_ui_spotlight_animated_transition_set(container, EINA_FALSE);
645 ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(efl_ui_spotlight_manager_get(container)), EINA_FALSE);
646
647 //now check with a real spotlight manager
648 efl_ui_spotlight_manager_set(container, efl_new(EFL_UI_SPOTLIGHT_FADE_MANAGER_CLASS));
649 efl_ui_spotlight_animated_transition_set(container, EINA_TRUE);
650 ck_assert_int_eq(efl_ui_spotlight_animated_transition_get(container), EINA_TRUE);
651 ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(efl_ui_spotlight_manager_get(container)), EINA_TRUE);
652
653 efl_ui_spotlight_animated_transition_set(container, EINA_FALSE);
654 ck_assert_int_eq(efl_ui_spotlight_animated_transition_get(container), EINA_FALSE);
655 ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(efl_ui_spotlight_manager_get(container)), EINA_FALSE);
656
657 Eo *manager2 = efl_new(EFL_UI_SPOTLIGHT_FADE_MANAGER_CLASS);
658 Eina_Bool animated_transition_manager;
659 efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, win,
660 efl_ui_spotlight_manager_set(efl_added, manager2),
661 efl_ui_spotlight_animated_transition_set(efl_added, EINA_TRUE),
662 animated_transition_manager = efl_ui_spotlight_manager_animated_transition_get(manager2));
663 ck_assert_int_eq(animated_transition_manager, EINA_FALSE);
664 ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(manager2), EINA_TRUE);
665}
666EFL_END_TEST
667
668EFL_START_TEST (efl_ui_spotlight_min_max_sizing)
669{
670 Efl_Ui_Button *btn0, *btn1;
671 Eina_Size2D min, size;
672
673 btn0 = efl_add(WIDGET_CLASS, container);
674 efl_gfx_hint_size_min_set(btn0, EINA_SIZE2D(20, 200));
675
676 btn1 = efl_add(WIDGET_CLASS, container);
677 efl_gfx_hint_size_min_set(btn1, EINA_SIZE2D(200, 20));
678
679 efl_pack_end(container, btn0);
680 efl_pack_end(container, btn1);
681 min = efl_gfx_hint_size_restricted_min_get(container);
682 ck_assert_int_eq(min.w, 200);
683 ck_assert_int_eq(min.h, 200);
684
685 efl_gfx_hint_size_min_set(btn0, EINA_SIZE2D(20, 300));
686 efl_canvas_group_calculate(container);
687
688 min = efl_gfx_hint_size_restricted_min_get(container);
689 ck_assert_int_eq(min.w, 200);
690 ck_assert_int_eq(min.h, 300);
691
692 efl_gfx_hint_size_min_set(btn0, EINA_SIZE2D(20, 20));
693 efl_canvas_group_calculate(container);
694
695 min = efl_gfx_hint_size_restricted_min_get(container);
696 ck_assert_int_eq(min.w, 200);
697 ck_assert_int_eq(min.h, 20);
698
699 efl_ui_spotlight_size_set(container, EINA_SIZE2D(2000, 2000));
700
701 efl_gfx_entity_size_set(container, EINA_SIZE2D(200, 200));
702 size = efl_gfx_entity_size_get(btn0);
703 ck_assert_int_eq(size.w, 200);
704 ck_assert_int_eq(size.h, 200);
705
706}
707EFL_END_TEST
708
621static void 709static void
622spotlight_setup() 710spotlight_setup()
623{ 711{
@@ -644,6 +732,7 @@ void efl_ui_test_spotlight(TCase *tc)
644 tcase_add_test(tc, efl_ui_spotlight_init); 732 tcase_add_test(tc, efl_ui_spotlight_init);
645 tcase_add_test(tc, efl_ui_spotlight_active_index); 733 tcase_add_test(tc, efl_ui_spotlight_active_index);
646 tcase_add_test(tc, efl_ui_smart_transition_calls); 734 tcase_add_test(tc, efl_ui_smart_transition_calls);
735 tcase_add_test(tc, efl_ui_smart_transition_calls_no_animation);
647 tcase_add_test(tc, efl_ui_smart_transition_lifetime); 736 tcase_add_test(tc, efl_ui_smart_transition_lifetime);
648 tcase_add_test(tc, efl_ui_smart_indicator_calls); 737 tcase_add_test(tc, efl_ui_smart_indicator_calls);
649 tcase_add_test(tc, efl_ui_smart_indicator_transition_calls); 738 tcase_add_test(tc, efl_ui_smart_indicator_transition_calls);
@@ -653,4 +742,6 @@ void efl_ui_test_spotlight(TCase *tc)
653 tcase_add_test(tc, efl_ui_spotlight_test_pop1); 742 tcase_add_test(tc, efl_ui_spotlight_test_pop1);
654 tcase_add_test(tc, efl_ui_spotlight_test_pop2); 743 tcase_add_test(tc, efl_ui_spotlight_test_pop2);
655 tcase_add_test(tc, efl_ui_spotlight_test_pop3); 744 tcase_add_test(tc, efl_ui_spotlight_test_pop3);
745 tcase_add_test(tc, efl_ui_spotlight_animated_transition);
746 tcase_add_test(tc, efl_ui_spotlight_min_max_sizing);
656} 747}
diff --git a/src/tests/elementary/efl_ui_test_text.c b/src/tests/elementary/efl_ui_test_text.c
new file mode 100644
index 0000000..b788654
--- /dev/null
+++ b/src/tests/elementary/efl_ui_test_text.c
@@ -0,0 +1,266 @@
1#define EFL_NOLEGACY_API_SUPPORT
2#ifdef HAVE_CONFIG_H
3# include "elementary_config.h"
4#endif
5#define EFL_LAYOUT_CALC_PROTECTED
6#include <Efl_Ui.h>
7#include "efl_ui_suite.h"
8#include "Evas_Legacy.h"
9
10static void
11increment_int_changed(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
12{
13 int *value = data;
14 (*value)++;
15}
16
17EFL_START_TEST(text_cnp)
18{
19 Eo *txt;
20 Eo *win = win_add();
21
22 int i_copy = 0, i_paste = 0, i_cut = 0;
23
24 txt = efl_add(EFL_UI_TEXTBOX_CLASS, win,
25 efl_event_callback_add(efl_added, EFL_UI_TEXTBOX_EVENT_SELECTION_COPY, increment_int_changed, &i_copy),
26 efl_event_callback_add(efl_added, EFL_UI_TEXTBOX_EVENT_SELECTION_PASTE, increment_int_changed, &i_paste),
27 efl_event_callback_add(efl_added, EFL_UI_TEXTBOX_EVENT_SELECTION_CUT, increment_int_changed, &i_cut)
28 );
29
30 efl_text_set(txt, "Hello");
31 efl_text_interactive_all_select(txt);
32 efl_ui_textbox_selection_copy(txt);
33 efl_text_interactive_all_select(txt);
34 efl_ui_textbox_selection_cut(txt);
35 efl_ui_textbox_selection_paste(txt);
36 efl_ui_textbox_selection_paste(txt);
37 ecore_main_loop_iterate();
38 ck_assert_int_eq(i_copy, 1);
39 ck_assert_int_eq(i_cut, 1);
40 ck_assert_int_eq(i_paste, 2);
41 //FIXME
42 //fail_if(strcmp(efl_text_get(txt),"HelloHello"));
43 efl_del(txt);
44}
45EFL_END_TEST
46
47EFL_START_TEST(text_all_select_all_unselect)
48{
49 Eo *txt;
50 Eo *win = win_add();
51
52 int i_have_selection = 0, i_selection = 0;
53
54 txt = efl_add(EFL_UI_TEXTBOX_CLASS, win,
55 efl_event_callback_add(efl_added, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED,
56 increment_int_changed, &i_have_selection),
57 efl_event_callback_add(efl_added, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED,
58 increment_int_changed, &i_selection)
59 );
60
61 efl_text_set(txt, "Hello");
62 efl_text_interactive_all_select(txt);
63 Efl_Text_Cursor *c1=NULL, *c2 =NULL;
64 efl_text_interactive_selection_cursors_get(txt, &c1, &c2);
65 ck_assert_ptr_ne(c1, NULL);
66 ck_assert_ptr_ne(c2, NULL);
67 fail_if(!efl_text_interactive_have_selection_get(txt));
68 ck_assert_int_eq(efl_text_cursor_position_get(c1), 0);
69 ck_assert_int_eq(efl_text_cursor_position_get(c2), 5);
70 efl_text_interactive_all_unselect(txt);
71 fail_if(efl_text_interactive_have_selection_get(txt));
72 ecore_main_loop_iterate();
73 ck_assert_int_eq(i_have_selection, 2);
74 ck_assert_int_eq(i_selection, 1);
75
76 /*Partial select, the select all*/
77 Eo *sel1, *sel2;
78 i_selection = 0;
79 efl_text_interactive_selection_cursors_get(txt, &sel1, &sel2);
80 efl_text_cursor_position_set(sel1, 1);
81 efl_text_cursor_position_set(sel2, 2);
82 ck_assert_int_eq(i_selection, 2);
83 efl_text_interactive_all_select(txt);
84 ck_assert_int_eq(i_selection, 3);
85 ck_assert_int_eq(efl_text_cursor_position_get(sel1), 0);
86 ck_assert_int_eq(efl_text_cursor_position_get(sel2), 5);
87
88 Eo *cur1 = efl_ui_textbox_cursor_create(txt);
89 Eo *cur2 = efl_ui_textbox_cursor_create(txt);
90 efl_text_cursor_position_set(cur1, 1);
91 efl_text_cursor_position_set(cur2, 2);
92 efl_text_interactive_selection_cursors_set(txt, cur1, cur2);
93 ck_assert_int_eq(i_selection, 4);
94 efl_text_interactive_selection_cursors_get(txt, &sel1, &sel2);
95 ck_assert_int_eq(efl_text_cursor_position_get(sel1),1);
96 ck_assert_int_eq(efl_text_cursor_position_get(sel2),2);
97
98
99 /*Select part then select all*/
100 efl_text_interactive_all_unselect(txt);
101 i_have_selection = 0, i_selection = 0;
102 efl_text_cursor_position_set(cur1, 1);
103 efl_text_cursor_position_set(cur2, 2);
104 efl_text_interactive_selection_cursors_set(txt, cur1, cur2);
105 ck_assert_int_eq(i_selection, 1);
106 ck_assert_int_eq(i_have_selection, 1);
107 efl_text_interactive_all_select(txt);
108 ck_assert_int_eq(i_selection, 2);
109 ck_assert_int_eq(i_have_selection, 1);
110 efl_text_interactive_all_unselect(txt);
111 ck_assert_int_eq(i_have_selection, 2);
112
113
114 efl_del(txt);
115 efl_del(win);
116}
117EFL_END_TEST
118
119EFL_START_TEST(text_selection)
120{
121 Eo *txt;
122 Eo *win = win_add();
123
124 txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
125 efl_gfx_entity_size_set(txt, EINA_SIZE2D(300, 300));
126 efl_text_set(txt, "Hello");
127 get_me_to_those_events(txt);
128 drag_object(txt, 2, 2, 295, 295, EINA_TRUE);
129 ecore_main_loop_iterate();
130 Efl_Text_Cursor *c1=NULL, *c2 =NULL;
131 efl_text_interactive_selection_cursors_get(txt, &c1, &c2);
132 ck_assert_ptr_ne(c1, NULL);
133 ck_assert_ptr_ne(c2, NULL);
134 fail_if(!efl_text_interactive_have_selection_get(txt));
135 ck_assert_int_eq(efl_text_cursor_position_get(c1), 0);
136 ck_assert_int_eq(efl_text_cursor_position_get(c2), 5);
137 efl_text_interactive_all_unselect(txt);
138 fail_if(efl_text_interactive_have_selection_get(txt));
139 efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
140 drag_object(txt, 2, 2, 295, 295, EINA_TRUE);
141 ecore_main_loop_iterate();
142 fail_if(efl_text_interactive_have_selection_get(txt));
143 efl_del(txt);
144}
145EFL_END_TEST
146
147static void
148user_changed(void *data, const Efl_Event *ev)
149{
150 Efl_Text_Change_Info *info = (Efl_Text_Change_Info *)ev->info;
151 Efl_Text_Change_Info *stored = (Efl_Text_Change_Info *)data;
152 *stored = *info;
153}
154
155EFL_START_TEST(text_user_change)
156{
157 Eo *txt;
158 Eo *win = win_add();
159 Efl_Text_Change_Info info = {0};
160 txt = efl_add(EFL_UI_TEXTBOX_CLASS, win,
161 efl_event_callback_add(efl_added, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, user_changed, &info)
162 );
163
164 efl_text_set(txt, "Hello");
165 efl_gfx_entity_size_set(txt, EINA_SIZE2D(300, 300));
166 efl_text_interactive_all_select(txt);
167 efl_ui_textbox_selection_cut(txt);
168 ck_assert_int_eq(info.position, 0);
169 ck_assert_int_eq(info.length, 5);
170 efl_del(txt);
171 efl_del(win);
172}
173EFL_END_TEST
174
175EFL_START_TEST(text_scroll_mode)
176{
177 Eo *txt, *win, *cur;
178 win = win_add();
179 txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
180 cur = efl_text_interactive_main_cursor_get(txt);
181 efl_text_set(txt, "Hello");
182 /*scroll mode is false by default*/
183 fail_if(efl_ui_textbox_scrollable_get(txt));
184 efl_ui_textbox_scrollable_set(txt, !efl_ui_textbox_scrollable_get(txt));
185 efl_text_cursor_text_insert(cur, "World");
186 fail_if(!efl_ui_textbox_scrollable_get(txt));
187 efl_ui_textbox_scrollable_set(txt, !efl_ui_textbox_scrollable_get(txt));
188 efl_text_cursor_text_insert(cur, "!!!");
189
190 ck_assert_str_eq(efl_text_get(txt),"HelloWorld!!!");
191 efl_del(txt);
192 efl_del(win);
193}
194EFL_END_TEST
195
196EFL_START_TEST(text_change_event)
197{
198 Eo *txt;
199 Eo *win = win_add();
200
201 txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
202 efl_gfx_entity_size_set(txt, EINA_SIZE2D(300, 300));
203 efl_text_set(txt, "Hello");
204 int i_changed = 0;
205 efl_event_callback_add(txt, EFL_UI_TEXTBOX_EVENT_CHANGED, increment_int_changed, &i_changed);
206 efl_gfx_entity_visible_set(txt, EINA_TRUE);
207 Evas *e = evas_object_evas_get(txt);
208 efl_ui_focus_util_focus(txt);
209 evas_event_feed_key_down(e, "s", "s", "s", "s", time(NULL), NULL);
210 ecore_main_loop_iterate();
211 ck_assert_str_eq(efl_text_get(txt),"Hellos");
212 ck_assert_int_eq(i_changed,1);
213 ecore_main_loop_iterate();
214
215 efl_del(txt);
216 efl_del(win);
217}
218EFL_END_TEST
219
220EFL_START_TEST(text_keys_handler)
221{
222 Eo *txt;
223 Eo *win = win_add();
224
225 txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
226 efl_gfx_entity_size_set(txt, EINA_SIZE2D(300, 300));
227 efl_text_set(txt, "Hello");
228
229 efl_gfx_entity_visible_set(txt, EINA_TRUE);
230 Evas *e = evas_object_evas_get(txt);
231 efl_ui_focus_util_focus(txt);
232
233 efl_text_cursor_move(efl_text_interactive_main_cursor_get(txt), EFL_TEXT_CURSOR_MOVE_TYPE_LAST);
234 evas_key_modifier_on(e, "Control");
235 evas_event_feed_key_down(e, "BackSpace", "BackSpace", "\b", "\b", time(NULL), NULL);
236 ecore_main_loop_iterate();
237 ck_assert_str_eq(efl_text_get(txt),"");
238 ck_assert_int_eq(efl_text_cursor_position_get(efl_text_interactive_main_cursor_get(txt)), 0);
239 evas_event_feed_key_up(e, "BackSpace", "BackSpace", "\b", "\b", time(NULL), NULL);
240 ecore_main_loop_iterate();
241
242 efl_text_set(txt, "Hello");
243 efl_text_cursor_position_set(efl_text_interactive_main_cursor_get(txt), 0);
244 evas_key_modifier_on(e, "Control");
245 evas_event_feed_key_down(e, "Delete", "Delete", "\177", "\177", time(NULL), NULL);
246 ecore_main_loop_iterate();
247 ck_assert_str_eq(efl_text_get(txt),"");
248 ck_assert_int_eq(efl_text_cursor_position_get(efl_text_interactive_main_cursor_get(txt)), 0);
249 evas_event_feed_key_up(e, "Delete", "Delete", "\177", "\177", time(NULL), NULL);
250 ecore_main_loop_iterate();
251
252 efl_del(txt);
253 efl_del(win);
254}
255EFL_END_TEST
256
257void efl_ui_test_text(TCase *tc)
258{
259 tcase_add_test(tc, text_cnp);
260 tcase_add_test(tc, text_all_select_all_unselect);
261 tcase_add_test(tc, text_selection);
262 tcase_add_test(tc, text_user_change);
263 tcase_add_test(tc, text_scroll_mode);
264 tcase_add_test(tc, text_change_event);
265 tcase_add_test(tc, text_keys_handler);
266}
diff --git a/src/tests/elementary/efl_ui_test_timepicker.c b/src/tests/elementary/efl_ui_test_timepicker.c
new file mode 100644
index 0000000..1aca88c
--- /dev/null
+++ b/src/tests/elementary/efl_ui_test_timepicker.c
@@ -0,0 +1,45 @@
1#define EFL_NOLEGACY_API_SUPPORT
2#ifdef HAVE_CONFIG_H
3# include "elementary_config.h"
4#endif
5#define EFL_LAYOUT_CALC_PROTECTED
6#include <Efl_Ui.h>
7#include "efl_ui_suite.h"
8
9EFL_START_TEST(check_all_times)
10{
11 Eo *win = win_add();
12 Eo *timepicker = efl_add(EFL_UI_TIMEPICKER_CLASS, win);
13
14 for (int min = 0; min < 60; ++min)
15 {
16 for (int hour = 0; hour < 24; ++hour)
17 {
18 efl_ui_timepicker_time_set(timepicker, hour, min);
19 }
20 }
21}
22EFL_END_TEST
23
24EFL_START_TEST(check_all_times_24_mode)
25{
26 Eo *win = win_add();
27 Eo *timepicker = efl_add(EFL_UI_TIMEPICKER_CLASS, win,
28 efl_ui_timepicker_is_24hour_set(efl_added, EINA_TRUE));
29
30 for (int min = 0; min < 60; ++min)
31 {
32 for (int hour = 0; hour < 24; ++hour)
33 {
34 efl_ui_timepicker_time_set(timepicker, hour, min);
35 }
36 }
37}
38EFL_END_TEST
39
40void efl_ui_test_timepicker(TCase *tc)
41{
42 tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
43 tcase_add_test(tc, check_all_times);
44 tcase_add_test(tc, check_all_times_24_mode);
45}
diff --git a/src/tests/elementary/efl_ui_test_vg_animation.c b/src/tests/elementary/efl_ui_test_vg_animation.c
new file mode 100644
index 0000000..2da7d0f
--- /dev/null
+++ b/src/tests/elementary/efl_ui_test_vg_animation.c
@@ -0,0 +1,122 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Efl_Ui.h>
6#include "efl_ui_suite.h"
7
8#ifdef BUILD_VG_LOADER_JSON
9
10EFL_START_TEST(vg_anim_playing_control)
11{
12 Evas_Object *win, *vg_anim;
13 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
14 efl_text_set(efl_added, "Efl_Ui_Vg_Animation demo"),
15 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
16 vg_anim = efl_add(EFL_UI_VG_ANIMATION_CLASS, win,
17 efl_content_set(win, efl_added));
18
19 ck_assert_int_eq(efl_ui_vg_animation_state_get(vg_anim), EFL_UI_VG_ANIMATION_STATE_NOT_READY);
20
21 // File load
22 efl_file_simple_load(vg_anim, TESTS_SRC_DIR"/emoji_wink.json", NULL);
23 ck_assert(efl_file_loaded_get(vg_anim));
24 ck_assert_int_eq(efl_ui_vg_animation_state_get(vg_anim), EFL_UI_VG_ANIMATION_STATE_STOPPED);
25
26 // Play start
27 efl_player_playing_set(vg_anim, EINA_TRUE);
28 ck_assert_int_eq(efl_ui_vg_animation_state_get(vg_anim), EFL_UI_VG_ANIMATION_STATE_PLAYING);
29
30 // Play pause
31 efl_player_paused_set(vg_anim, EINA_TRUE);
32 ck_assert_int_eq(efl_ui_vg_animation_state_get(vg_anim), EFL_UI_VG_ANIMATION_STATE_PAUSED);
33
34 // Play resume
35 efl_player_paused_set(vg_anim, EINA_FALSE);
36 ck_assert_int_eq(efl_ui_vg_animation_state_get(vg_anim), EFL_UI_VG_ANIMATION_STATE_PLAYING);
37
38 // Playback speed
39 efl_player_playback_speed_set(vg_anim, 2.0);
40 ck_assert(EINA_DBL_EQ(efl_player_playback_speed_get(vg_anim), 2.0));
41
42 efl_player_playback_speed_set(vg_anim, -2.0);
43 ck_assert(EINA_DBL_EQ(efl_player_playback_speed_get(vg_anim), -2.0));
44
45 // playing backwards
46 ck_assert_int_eq(efl_ui_vg_animation_state_get(vg_anim), EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS);
47
48 // Play stop
49 efl_player_playing_set(vg_anim, EINA_FALSE);
50 ck_assert_int_eq(efl_ui_vg_animation_state_get(vg_anim), EFL_UI_VG_ANIMATION_STATE_STOPPED);
51
52 // Auto repeat
53 efl_ui_vg_animation_looping_set(vg_anim, EINA_TRUE);
54 ck_assert_int_eq(efl_ui_vg_animation_looping_get(vg_anim), EINA_TRUE);
55
56 // Auto play
57 efl_ui_vg_animation_autoplay_set(vg_anim, EINA_TRUE);
58 ck_assert_int_eq(efl_ui_vg_animation_autoplay_get(vg_anim), EINA_TRUE);
59}
60EFL_END_TEST
61
62EFL_START_TEST(vg_anim_frame_control)
63{
64 Evas_Object *win, *vg_anim;
65 int frame_count = 0;
66
67 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
68 efl_text_set(efl_added, "Efl_Ui_Vg_Animation demo"),
69 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
70 vg_anim = efl_add(EFL_UI_VG_ANIMATION_CLASS, win,
71 efl_content_set(win, efl_added));
72
73 ck_assert_int_eq(efl_ui_vg_animation_state_get(vg_anim), EFL_UI_VG_ANIMATION_STATE_NOT_READY);
74
75 // File load
76 // emoji_wink.json is 60 frames sample.
77 efl_file_simple_load(vg_anim, TESTS_SRC_DIR"/emoji_wink.json", NULL);
78 ck_assert(efl_file_loaded_get(vg_anim));
79 ck_assert_int_eq(efl_ui_vg_animation_state_get(vg_anim), EFL_UI_VG_ANIMATION_STATE_STOPPED);
80
81 // Total frame
82 frame_count = efl_ui_vg_animation_frame_count_get(vg_anim);
83 ck_assert_int_eq(frame_count, 60);
84
85 // Frame set, get
86 efl_ui_vg_animation_frame_set(vg_anim, 30);
87 ck_assert_int_eq(efl_ui_vg_animation_frame_get(vg_anim), 30);
88
89 // Frame set, get
90 efl_player_playback_progress_set(vg_anim, 0.3);
91 ck_assert(EINA_DBL_EQ(efl_player_playback_progress_get(vg_anim), 0.3));
92
93 // Min/Max frame set,get
94 efl_ui_vg_animation_min_frame_set(vg_anim, 5);
95 ck_assert_int_eq(efl_ui_vg_animation_min_frame_get(vg_anim), 5);
96 efl_ui_vg_animation_frame_set(vg_anim, 1);
97 ck_assert_int_eq(efl_ui_vg_animation_frame_get(vg_anim), 5);
98
99 efl_ui_vg_animation_max_frame_set(vg_anim, 55);
100 ck_assert_int_eq(efl_ui_vg_animation_max_frame_get(vg_anim), 55);
101 efl_ui_vg_animation_frame_set(vg_anim, 60);
102 ck_assert_int_eq(efl_ui_vg_animation_frame_get(vg_anim), 55);
103
104 // Min/Max progress set,get
105 efl_ui_vg_animation_min_progress_set(vg_anim, 0.2);
106 ck_assert(EINA_DBL_EQ(efl_ui_vg_animation_min_progress_get(vg_anim), 0.2));
107
108 efl_ui_vg_animation_max_progress_set(vg_anim, 0.8);
109 ck_assert(EINA_DBL_EQ(efl_ui_vg_animation_max_progress_get(vg_anim), 0.8));
110}
111EFL_END_TEST
112
113#endif
114
115void efl_ui_test_vg_animation(TCase *tc)
116{
117 tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
118#ifdef BUILD_VG_LOADER_JSON
119 tcase_add_test(tc, vg_anim_playing_control);
120 tcase_add_test(tc, vg_anim_frame_control);
121#endif
122}
diff --git a/src/tests/elementary/elm_cxx_suite.cc b/src/tests/elementary/elm_cxx_suite.cc
index eb88aa8..45e95c8 100644
--- a/src/tests/elementary/elm_cxx_suite.cc
+++ b/src/tests/elementary/elm_cxx_suite.cc
@@ -1,3 +1,18 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
1#include <Efl_Ui.hh> 16#include <Efl_Ui.hh>
2 17
3int main() 18int main()
diff --git a/src/tests/elementary/elm_test_check.c b/src/tests/elementary/elm_test_check.c
index 4881aaa..0cdc18f 100644
--- a/src/tests/elementary/elm_test_check.c
+++ b/src/tests/elementary/elm_test_check.c
@@ -6,6 +6,13 @@
6#include <Elementary.h> 6#include <Elementary.h>
7#include "elm_suite.h" 7#include "elm_suite.h"
8 8
9typedef struct _Check_Data
10{
11 Evas_Object *check1;
12 Evas_Object *check2;
13 int value;
14} Check_Data;
15
9EFL_START_TEST(elm_test_check_size) 16EFL_START_TEST(elm_test_check_size)
10{ 17{
11 Evas_Object *win, *check, *box; 18 Evas_Object *win, *check, *box;
@@ -146,6 +153,66 @@ EFL_START_TEST(elm_atspi_role_get)
146} 153}
147EFL_END_TEST 154EFL_END_TEST
148 155
156static void
157_check_changed_cb(void *ptr, Evas_Object *obj, void *e EINA_UNUSED)
158{
159 Check_Data *data = (Check_Data*) ptr;
160
161 if (obj == data->check1) {
162 elm_check_state_set(data->check2, EINA_TRUE);
163 } else if ( obj == data->check2) {
164 elm_check_state_set(data->check1, EINA_FALSE);
165 } else {
166 ck_assert(EINA_FALSE);
167 }
168 data->value ++;
169}
170
171EFL_START_TEST(elm_test_check_api_call)
172{
173 Evas_Object *win, *check1, *check2, *box;
174 Check_Data data ={0,};
175
176 win = elm_win_util_standard_add("check", "Check");
177
178 box = elm_box_add(win);
179 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
180 elm_win_resize_object_add(win, box);
181 evas_object_show(box);
182
183 data.check1 = check1 = elm_check_add(box);
184 elm_object_text_set(check1, "TEST TEST TEST");
185 evas_object_smart_callback_add(check1, "changed", _check_changed_cb, &data);
186 elm_box_pack_end(box, check1);
187 evas_object_show(check1);
188
189 data.check2 = check2 = elm_check_add(box);
190 elm_object_text_set(check2, "TEST TEST TEST");
191 evas_object_smart_callback_add(check2, "changed", _check_changed_cb, &data);
192 elm_box_pack_end(box, check2);
193 evas_object_show(check2);
194
195 evas_object_show(win);
196
197 get_me_to_those_events(check1);
198
199 data.value = 0;
200 click_object(data.check1);
201 ecore_main_loop_iterate();
202 ck_assert_int_eq(data.value, 1);
203
204 data.value = 0;
205 click_object(data.check2);
206 ecore_main_loop_iterate();
207 ck_assert_int_eq(data.value, 1);
208
209 data.value = 0;
210 click_object(data.check1);
211 ecore_main_loop_iterate();
212 ck_assert_int_eq(data.value, 1);
213}
214EFL_END_TEST
215
149void elm_test_check(TCase *tc) 216void elm_test_check(TCase *tc)
150{ 217{
151 tcase_add_test(tc, elm_test_check_size); 218 tcase_add_test(tc, elm_test_check_size);
@@ -154,4 +221,5 @@ void elm_test_check(TCase *tc)
154 tcase_add_test(tc, elm_test_check_state); 221 tcase_add_test(tc, elm_test_check_state);
155 tcase_add_loop_test(tc, elm_test_check_callbacks, 0, 2); 222 tcase_add_loop_test(tc, elm_test_check_callbacks, 0, 2);
156 tcase_add_test(tc, elm_atspi_role_get); 223 tcase_add_test(tc, elm_atspi_role_get);
224 tcase_add_test(tc, elm_test_check_api_call);
157} 225}
diff --git a/src/tests/elementary/elm_test_entry.c b/src/tests/elementary/elm_test_entry.c
index 1b383b29..4655a68 100644
--- a/src/tests/elementary/elm_test_entry.c
+++ b/src/tests/elementary/elm_test_entry.c
@@ -518,6 +518,78 @@ EFL_START_TEST(elm_entry_file_get_set)
518} 518}
519EFL_END_TEST 519EFL_END_TEST
520 520
521EFL_START_TEST(elm_entry_test_text_class)
522{
523 Evas_Object *win, *entry1, *entry2, *entry3, *entry4;
524 const char *filename = NULL;
525 int w1 = 0, h1 = 0, w2 = 0, h2 = 0, w3 = 0, h3 = 0;
526 const char *font;
527 int font_size;
528
529 win = win_add(NULL, "entry", ELM_WIN_BASIC);
530 entry1 = elm_entry_add(win);
531 entry2 = elm_entry_add(win);
532 entry3 = elm_entry_add(win);
533
534 elm_object_text_set(entry1, "hello");
535 elm_object_text_set(entry2, "hello");
536 elm_object_text_set(entry3, "hello");
537
538 edje_object_file_get(elm_layout_edje_get(entry1), &filename, NULL);
539 ck_assert(filename != NULL);
540
541 ck_assert(edje_file_text_class_set(filename, "entry_text", "Serif:Style=Bold", 24));
542
543 ck_assert(edje_object_text_class_get(elm_layout_edje_get(entry1), "entry_text", &font, &font_size));
544 ck_assert_int_eq(font_size, 24);
545 ck_assert_str_eq(font, "Serif:Style=Bold");
546 ck_assert(edje_object_text_class_get(elm_layout_edje_get(entry2), "entry_text", &font, &font_size));
547 ck_assert_int_eq(font_size, 24);
548 ck_assert_str_eq(font, "Serif:Style=Bold");
549 ck_assert(edje_object_text_class_get(elm_layout_edje_get(entry3), "entry_text", &font, &font_size));
550 ck_assert_int_eq(font_size, 24);
551 ck_assert_str_eq(font, "Serif:Style=Bold");
552
553 evas_object_textblock_size_formatted_get(elm_entry_textblock_get(entry1), &w1, &h1);
554 evas_object_textblock_size_formatted_get(elm_entry_textblock_get(entry2), &w2, &h2);
555 evas_object_textblock_size_formatted_get(elm_entry_textblock_get(entry3), &w3, &h3);
556
557 ck_assert_int_eq(w1, w2);
558 ck_assert_int_eq(h1, h2);
559 ck_assert_int_eq(w2, w3);
560 ck_assert_int_eq(h2, h3);
561
562 ck_assert(edje_object_text_class_set(elm_layout_edje_get(entry1), "entry_text", "Sans", 50));
563 ck_assert(edje_object_text_class_set(elm_layout_edje_get(entry2), "entry_text", "Serif", 20));
564
565 ck_assert(edje_object_text_class_get(elm_layout_edje_get(entry1), "entry_text", &font, &font_size));
566 ck_assert_int_eq(font_size, 50);
567 ck_assert_str_eq(font, "Sans");
568 ck_assert(edje_object_text_class_get(elm_layout_edje_get(entry2), "entry_text", &font, &font_size));
569 ck_assert_int_eq(font_size, 20);
570 ck_assert_str_eq(font, "Serif");
571 ck_assert(edje_object_text_class_get(elm_layout_edje_get(entry3), "entry_text", &font, &font_size));
572 ck_assert_int_eq(font_size, 24);
573 ck_assert_str_eq(font, "Serif:Style=Bold");
574
575 evas_object_textblock_size_formatted_get(elm_entry_textblock_get(entry1), &w1, &h1);
576 evas_object_textblock_size_formatted_get(elm_entry_textblock_get(entry2), &w2, &h2);
577 evas_object_textblock_size_formatted_get(elm_entry_textblock_get(entry3), &w3, &h3);
578
579 ck_assert_int_ne(w1, w2);
580 ck_assert_int_ne(h1, h2);
581 ck_assert_int_ne(w2, w3);
582 ck_assert_int_ne(h2, h3);
583
584 entry4 = elm_entry_add(win);
585
586 elm_object_text_set(entry4, "hello");
587 ck_assert(edje_object_text_class_get(elm_layout_edje_get(entry4), "entry_text", &font, &font_size));
588 ck_assert_int_eq(font_size, 24);
589 ck_assert_str_eq(font, "Serif:Style=Bold");
590}
591EFL_END_TEST
592
521void elm_test_entry(TCase *tc) 593void elm_test_entry(TCase *tc)
522{ 594{
523 tcase_add_test(tc, elm_entry_legacy_type_check); 595 tcase_add_test(tc, elm_entry_legacy_type_check);
@@ -535,4 +607,5 @@ void elm_test_entry(TCase *tc)
535 tcase_add_test(tc, elm_entry_text_set); 607 tcase_add_test(tc, elm_entry_text_set);
536 tcase_add_test(tc, elm_entry_magnifier); 608 tcase_add_test(tc, elm_entry_magnifier);
537 tcase_add_test(tc, elm_entry_file_get_set); 609 tcase_add_test(tc, elm_entry_file_get_set);
610 tcase_add_test(tc, elm_entry_test_text_class);
538} 611}
diff --git a/src/tests/elementary/elm_test_genlist.c b/src/tests/elementary/elm_test_genlist.c
index ce62580..81eca40 100644
--- a/src/tests/elementary/elm_test_genlist.c
+++ b/src/tests/elementary/elm_test_genlist.c
@@ -134,6 +134,15 @@ _item_content_get(void *data EINA_UNUSED, Evas_Object *obj, const char *part EIN
134 return ic; 134 return ic;
135} 135}
136 136
137static char *
138_item_text_get(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *part)
139{
140 char buf[128];
141 /* just some random-ish (not really) text */
142 snprintf(buf, sizeof(buf), "%p", part);
143 return strdup(buf);
144}
145
137EFL_START_TEST(elm_genlist_test_item_content) 146EFL_START_TEST(elm_genlist_test_item_content)
138{ 147{
139 Elm_Genlist_Item_Class *gtc; 148 Elm_Genlist_Item_Class *gtc;
@@ -383,6 +392,7 @@ EFL_START_TEST(elm_genlist_test_item_destroy)
383EFL_END_TEST 392EFL_END_TEST
384 393
385#define NUM_TREE_ITEMS 10 394#define NUM_TREE_ITEMS 10
395#define GL_ITEM_SIZE_ISH 30
386 396
387static Evas_Object * 397static Evas_Object *
388genlist_tree_test_content_get(void *data EINA_UNUSED, Evas_Object *obj, const char *part) 398genlist_tree_test_content_get(void *data EINA_UNUSED, Evas_Object *obj, const char *part)
@@ -499,6 +509,7 @@ EFL_START_TEST(elm_genlist_test_tree_expand)
499 509
500 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); 510 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
501 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 511 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
512 evas_object_size_hint_weight_set(win, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
502 elm_genlist_item_append(genlist, &itc, 513 elm_genlist_item_append(genlist, &itc,
503 NULL/* item data */, NULL/* parent */, 514 NULL/* item data */, NULL/* parent */,
504 ELM_GENLIST_ITEM_TREE, NULL/* func */, 515 ELM_GENLIST_ITEM_TREE, NULL/* func */,
@@ -510,9 +521,10 @@ EFL_START_TEST(elm_genlist_test_tree_expand)
510 NULL/* func data */); 521 NULL/* func data */);
511 522
512 evas_object_show(genlist); 523 evas_object_show(genlist);
513 evas_object_resize(genlist, 100, 10 + 10 * NUM_TREE_ITEMS); 524 evas_object_resize(genlist, 100, 10 + GL_ITEM_SIZE_ISH * NUM_TREE_ITEMS);
514 evas_object_show(win); 525 evas_object_show(win);
515 evas_object_resize(win, 100, 10 + 10 * NUM_TREE_ITEMS); 526 evas_object_resize(win, 100, 10 + GL_ITEM_SIZE_ISH * NUM_TREE_ITEMS);
527
516 ecore_main_loop_begin(); 528 ecore_main_loop_begin();
517} 529}
518EFL_END_TEST 530EFL_END_TEST
@@ -560,6 +572,182 @@ EFL_START_TEST(elm_genlist_test_focus_state)
560} 572}
561EFL_END_TEST 573EFL_END_TEST
562 574
575/* keep in sync with elm_genlist.c value */
576#define MAX_ITEMS_PER_BLOCK 32
577
578EFL_START_TEST(elm_genlist_test_events)
579{
580 unsigned int i, called[10] = {0};
581 Eina_Bool norender = EINA_FALSE;
582 /* need focus for item focus tests */
583 win = win_add_focused(NULL, "genlist", ELM_WIN_BASIC);
584
585 itc.func.text_get = _item_text_get;
586
587 genlist = elm_genlist_add(win);
588 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
589
590 for (i = 0; i < 2 * MAX_ITEMS_PER_BLOCK; i++)
591 elm_genlist_item_append(genlist, &itc,
592 NULL/* item data */, NULL/* parent */,
593 0, NULL/* func */,
594 NULL/* func data */);
595
596 /* show 10ish items */
597 evas_object_resize(genlist, 200, 10 + GL_ITEM_SIZE_ISH * 10);
598 evas_object_show(genlist);
599 evas_object_show(win);
600 evas_object_resize(win, 200, 10 + GL_ITEM_SIZE_ISH * 10);
601 get_me_to_those_events(genlist);
602
603/* add callbacks only for the name array passed,
604 * verify that each callback is triggered based on event callback type
605 * remove callbacks so they don't break successive testing
606 * note: order is not tested or useful
607 */
608#define CB_TEST(namearray, ev_func, ...) \
609 do { \
610 const char **names = namearray; \
611 memset(called, 0, sizeof(called)); \
612 norender = EINA_FALSE; \
613 for (i = 0; *names; i++, names++) \
614 evas_object_smart_callback_add(genlist, *names, ev_func, &(called[i])); \
615 __VA_ARGS__ \
616 if (!norender) \
617 get_me_to_those_events(genlist); \
618 for (i = 0, names = namearray; *names; i++, names++) \
619 { \
620 evas_object_smart_callback_del_full(genlist, *names, ev_func, &(called[i])); \
621 if (!called[i]) fprintf(stderr, "GENLIST EVENT TEST ERROR: \"%s\" failed to trigger as expected!\n", namearray[i]); \
622 if (ev_func == event_callback_that_increments_an_int_when_called) \
623 ck_assert_int_ge(called[i], 1); \
624 else \
625 ck_assert_int_eq(called[i], 1); \
626 } \
627 } while (0)
628#define NAMEARRAY(...) \
629 (const char*[]){__VA_ARGS__, NULL}
630
631 /* first item: double click ->
632 * "activated" + "clicked,double" + "selected" + "highlighted" */
633 CB_TEST(NAMEARRAY("activated", "clicked,double", "selected", "highlighted"),
634 event_callback_single_call_int_data,
635 click_object_at_flags(genlist, 5, 5, EVAS_BUTTON_DOUBLE_CLICK);
636 );
637
638 /* first item: right click ->
639 * "clicked,right" */
640 CB_TEST(
641 NAMEARRAY("clicked,right"),
642 event_callback_single_call_int_data,
643 Evas *e = evas_object_evas_get(genlist);
644 norender = EINA_TRUE;
645 evas_event_feed_mouse_move(e, 5, 5, 0, NULL);
646 /* no util function for this since we never use right click */
647 evas_event_feed_mouse_down(e, 3, 0, 0, NULL);
648 evas_event_feed_mouse_up(e, 3, 0, 0, NULL);
649 );
650 /* some other item:
651 * click ->
652 * "unselected" + "unhighlighted" + "item,unfocused" on first item
653 * "pressed" + "released" + "item,focused" on other item */
654 CB_TEST(
655 NAMEARRAY("unselected", "unhighlighted", "pressed", "released", "item,focused", "item,unfocused"),
656 event_callback_single_call_int_data,
657 /* click on some other random item to trigger different selection/highlight */
658 click_object_at(genlist, 5, 50);
659 );
660
661 /* wheel ->
662 * "realized" on unrealized items
663 * "unrealized" on first item */
664 CB_TEST(
665 NAMEARRAY("realized", "unrealized"),
666 event_callback_that_increments_an_int_when_called,
667 /* disable animations to avoid having to wait an indeterminate amount of time for scrolling */
668 elm_config_scroll_animation_disabled_set(EINA_TRUE);
669 /* wheel to trigger realize/unrealize */
670 wheel_object_at(genlist, 50, 50, 0, 1);
671 /* re-enable animations before failure to avoid triggering cascading test failures */
672 elm_config_scroll_animation_disabled_set(EINA_FALSE);
673 );
674
675 /* filter_set ->
676 * "filter,done"
677 */
678 CB_TEST(
679 NAMEARRAY("filter,done"),
680 event_callback_single_call_int_data,
681 elm_genlist_filter_set(genlist, "2");
682 );
683 elm_genlist_filter_set(genlist, NULL);
684
685 /* simple drag ->
686 * "swipe" + "drag,start,right" + "drag,stop"
687 * also multiple "drag" events
688 */
689 evas_object_smart_callback_add(genlist, "drag", event_callback_that_increments_an_int_when_called, &called[5]);
690 CB_TEST(
691 NAMEARRAY("swipe", "drag,start,right", "drag,stop"),
692 event_callback_single_call_int_data,
693 click_object_at(genlist, 5, 50);
694 drag_object(genlist, 5, 50, 150, 0, EINA_FALSE);
695 );
696 evas_object_smart_callback_del_full(genlist, "drag", event_callback_that_increments_an_int_when_called, &called[5]);
697 /* there should be DRAG_OBJECT_NUM_MOVES - 1 "drag" events */
698 ck_assert_int_eq(called[5], DRAG_OBJECT_NUM_MOVES - 1);
699
700 /* continuous simple drags ->
701 * "drag,start,left", "drag,start,up", "drag,start,down"
702 */
703 evas_object_smart_callback_add(genlist, "drag,stop", event_callback_that_increments_an_int_when_called, &called[3]);
704 CB_TEST(
705 NAMEARRAY("drag,start,left", "drag,start,up", "drag,start,down"),
706 event_callback_single_call_int_data,
707 /* left */
708 click_object_at(genlist, 155, 50);
709 drag_object(genlist, 155, 50, -150, 0, EINA_FALSE);
710 /* down */
711 click_object_at(genlist, 5, 50);
712 drag_object(genlist, 5, 50, 0, 100, EINA_FALSE);
713 /* up */
714 click_object_at(genlist, 5, 150);
715 drag_object(genlist, 5, 150, 0, -100, EINA_FALSE);
716 );
717 evas_object_smart_callback_del_full(genlist, "drag", event_callback_that_increments_an_int_when_called, &called[3]);
718 ck_assert_int_eq(called[3], DRAG_OBJECT_NUM_MOVES - 1);
719
720 /* intensive drag down ->
721 * "longpressed" + "moved" + ("moved,after" || "moved,before")
722 * also "index,update" on all affected items
723 */
724 evas_object_smart_callback_add(genlist, "index,update", event_callback_that_increments_an_int_when_called, &called[3]);
725 /* exactly one of these will be called */
726 evas_object_smart_callback_add(genlist, "moved,before", event_callback_single_call_int_data, &called[2]);
727 evas_object_smart_callback_add(genlist, "moved,after", event_callback_single_call_int_data, &called[2]);
728 CB_TEST(
729 /* "moved,before" can only be triggered on the first item and is a bit finnicky/unreliable
730 * to trigger in unit tests so it's being ignored for now
731 */
732 NAMEARRAY("longpressed", "moved"),
733 event_callback_single_call_int_data,
734 double lp = elm_genlist_longpress_timeout_get(genlist);
735 elm_genlist_reorder_mode_set(genlist, EINA_TRUE);
736 elm_genlist_longpress_timeout_set(genlist, 0);
737 click_object_at(genlist, 5, 5);
738 drag_object(genlist, 5, 5, 0, 90, EINA_TRUE);
739 elm_genlist_reorder_mode_set(genlist, EINA_FALSE);
740 elm_genlist_longpress_timeout_set(genlist, lp);
741 );
742 evas_object_smart_callback_del_full(genlist, "moved,before", event_callback_single_call_int_data, &called[2]);
743 evas_object_smart_callback_del_full(genlist, "moved,after", event_callback_single_call_int_data, &called[2]);
744 ck_assert_int_eq(called[2], 1);
745 evas_object_smart_callback_del_full(genlist, "index,update", event_callback_that_increments_an_int_when_called, &called[3]);
746 /* at minimum, 2 items should have been changed */
747 ck_assert_int_ge(called[3], 2);
748}
749EFL_END_TEST
750
563void elm_test_genlist(TCase *tc) 751void elm_test_genlist(TCase *tc)
564{ 752{
565 tcase_add_test(tc, elm_genlist_test_legacy_type_check); 753 tcase_add_test(tc, elm_genlist_test_legacy_type_check);
@@ -575,4 +763,6 @@ void elm_test_genlist(TCase *tc)
575 763
576 tcase_add_test(tc, elm_genlist_test_focus_state); 764 tcase_add_test(tc, elm_genlist_test_focus_state);
577 tcase_add_test(tc, elm_genlist_test_tree_expand); 765 tcase_add_test(tc, elm_genlist_test_tree_expand);
766
767 tcase_add_test(tc, elm_genlist_test_events);
578} 768}
diff --git a/src/tests/elementary/elm_test_layout.c b/src/tests/elementary/elm_test_layout.c
index 5184086..d08b9cb 100644
--- a/src/tests/elementary/elm_test_layout.c
+++ b/src/tests/elementary/elm_test_layout.c
@@ -70,9 +70,71 @@ EFL_START_TEST(elm_layout_test_swallows)
70} 70}
71EFL_END_TEST 71EFL_END_TEST
72 72
73EFL_START_TEST(elm_layout_test_sizing)
74{
75 Evas_Object *win, *ly, *rect;
76 int w, h;
77
78 win = win_add(NULL, "layout", ELM_WIN_BASIC);
79 evas_object_show(win);
80
81 rect = evas_object_rectangle_add(evas_object_evas_get(win));
82
83 ly = elm_button_add(win);
84 elm_object_text_set(ly, "test");
85 elm_object_content_set(ly, rect);
86 evas_object_show(ly);
87
88 /* verify that the button calc is the size of the text */
89 evas_object_smart_need_recalculate_set(ly, 1);
90 evas_object_smart_calculate(ly);
91 evas_object_size_hint_min_get(ly, &w, &h);
92 ck_assert_int_lt(w, 100);
93 ck_assert_int_gt(w, 0);
94 ck_assert_int_lt(h, 100);
95 ck_assert_int_gt(h, 0);
96
97 /* verify that the button calc is the size of the text + minsize of rect */
98 evas_object_size_hint_min_set(rect, 100, 100);
99 evas_object_smart_need_recalculate_set(ly, 1);
100 evas_object_smart_calculate(ly);
101 evas_object_size_hint_min_get(ly, &w, &h);
102 ck_assert_int_ge(w, 100);
103 ck_assert_int_ge(h, 100);
104
105 /* verify that the button calc is once again the size of the text */
106 evas_object_size_hint_min_set(rect, 0, 0);
107 evas_object_smart_need_recalculate_set(ly, 1);
108 evas_object_smart_calculate(ly);
109 evas_object_size_hint_min_get(ly, &w, &h);
110 ck_assert_int_lt(w, 100);
111 ck_assert_int_gt(w, 0);
112 ck_assert_int_lt(h, 100);
113 ck_assert_int_gt(h, 0);
114}
115EFL_END_TEST
116
117EFL_START_TEST(elm_layout_test_theme_changed_callback)
118{
119 Evas_Object *win, *ly;
120 int called = 0;
121
122 win = win_add(NULL, "layout", ELM_WIN_BASIC);
123 evas_object_show(win);
124
125 ly = elm_button_add(win);
126 evas_object_smart_callback_add(ly, "theme,changed", event_callback_single_call_int_data, &called);
127 evas_object_show(ly);
128 elm_object_style_set(ly, "anchor");
129 ck_assert_int_eq(called, 1);
130}
131EFL_END_TEST
132
73void elm_test_layout(TCase *tc) 133void elm_test_layout(TCase *tc)
74{ 134{
75 tcase_add_test(tc, elm_layout_test_legacy_type_check); 135 tcase_add_test(tc, elm_layout_test_legacy_type_check);
76 tcase_add_test(tc, elm_atspi_role_get); 136 tcase_add_test(tc, elm_atspi_role_get);
77 tcase_add_test(tc, elm_layout_test_swallows); 137 tcase_add_test(tc, elm_layout_test_swallows);
138 tcase_add_test(tc, elm_layout_test_sizing);
139 tcase_add_test(tc, elm_layout_test_theme_changed_callback);
78} 140}
diff --git a/src/tests/elementary/emoji_wink.json b/src/tests/elementary/emoji_wink.json
new file mode 100644
index 0000000..29b39a5
--- /dev/null
+++ b/src/tests/elementary/emoji_wink.json
@@ -0,0 +1 @@
{"v":"4.5.7","fr":30,"ip":0,"op":60,"w":100,"h":100,"ddd":0,"assets":[{"id":"comp_38","layers":[{"ddd":0,"ind":0,"ty":4,"nm":"round_normal","ks":{"o":{"a":0,"k":100},"r":{"a":0,"k":0},"p":{"a":0,"k":[50,50,0]},"a":{"a":0,"k":[-252,-412,0]},"s":{"a":0,"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"a":0,"k":{"i":[[-17.673,0],[0,-17.673],[17.673,0],[0,17.673]],"o":[[17.673,0],[0,17.673],[-17.673,0],[0,-17.673]],"v":[[-252,-444],[-220,-412],[-252,-380],[-284,-412]],"c":true}},"nm":"Path 1","mn":"ADBE Vector Shape - Group"},{"ty":"fl","c":{"a":0,"k":[1,0.88,0.59,1]},"o":{"a":0,"k":100},"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"mn":"ADBE Vector Group"}],"ip":0,"op":300,"st":0,"bm":0,"sr":1}]}],"layers":[{"ddd":0,"ind":0,"ty":4,"nm":"eyes_normal","parent":2,"ks":{"o":{"a":0,"k":100},"r":{"a":0,"k":0},"p":{"a":0,"k":[50,45.5,0]},"a":{"a":0,"k":[-252,-416.5,0]},"s":{"a":1,"k":[{"i":{"x":[0.516,0.831,0.667],"y":[0.516,1,0.667]},"o":{"x":[0.75,0.705,0.333],"y":[0.75,0,0.333]},"n":["0p516_0p516_0p75_0p75","0p831_1_0p705_0","0p667_0p667_0p333_0p333"],"t":40,"s":[100,100,100],"e":[100,0,100]},{"i":{"x":[0.667,0.667,0.667],"y":[0.667,1,0.667]},"o":{"x":[0.333,0.333,0.333],"y":[0.333,0,0.333]},"n":["0p667_0p667_0p333_0p333","0p667_1_0p333_0","0p667_0p667_0p333_0p333"],"t":45,"s":[100,0,100],"e":[100,110,100]},{"i":{"x":[0.298,0.276,0.667],"y":[0.298,1,0.667]},"o":{"x":[0.038,0.105,0.333],"y":[0.038,0,0.333]},"n":["0p298_0p298_0p038_0p038","0p276_1_0p105_0","0p667_0p667_0p333_0p333"],"t":50,"s":[100,110,100],"e":[100,98,100]},{"i":{"x":[0.667,0.667,0.667],"y":[0.667,1,0.667]},"o":{"x":[0.333,0.333,0.333],"y":[0.333,0,0.333]},"n":["0p667_0p667_0p333_0p333","0p667_1_0p333_0","0p667_0p667_0p333_0p333"],"t":55,"s":[100,98,100],"e":[100,100,100]},{"t":60}]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"a":1,"k":[{"i":{"x":0.313,"y":1},"o":{"x":0.467,"y":0},"n":"0p313_1_0p467_0","t":6,"s":[{"i":[[-1.933,0],[0,-1.933],[1.933,0],[0,1.933]],"o":[[1.933,0],[0,1.933],[-1.933,0],[0,-1.933]],"v":[[-237.5,-420],[-234,-416.5],[-237.5,-413],[-241,-416.5]],"c":true}],"e":[{"i":[[-1.933,0],[-0.312,-1.313],[1.933,0],[0,1.062]],"o":[[1.933,0],[0.174,0.732],[-1.933,0],[0,-1.25]],"v":[[-237.437,-418],[-231.25,-415.875],[-237.5,-416.938],[-243.188,-415.937]],"c":true}]},{"i":{"x":0.395,"y":1},"o":{"x":0.716,"y":0},"n":"0p395_1_0p716_0","t":16,"s":[{"i":[[-1.933,0],[-0.312,-1.313],[1.933,0],[0,1.062]],"o":[[1.933,0],[0.174,0.732],[-1.933,0],[0,-1.25]],"v":[[-237.437,-418],[-231.25,-415.875],[-237.5,-416.938],[-243.188,-415.937]],"c":true}],"e":[{"i":[[-1.933,0],[0,-1.933],[1.933,0],[0,1.933]],"o":[[1.933,0],[0,1.933],[-1.933,0],[0,-1.933]],"v":[[-237.5,-420],[-234,-416.5],[-237.5,-413],[-241,-416.5]],"c":true}]},{"t":29}]},"nm":"Path 1","mn":"ADBE Vector Shape - Group"},{"ind":1,"ty":"sh","ks":{"a":0,"k":{"i":[[-1.933,0],[0,-1.933],[1.933,0],[0,1.933]],"o":[[1.933,0],[0,1.933],[-1.933,0],[0,-1.933]],"v":[[-266.5,-420],[-263,-416.5],[-266.5,-413],[-270,-416.5]],"c":true}},"nm":"Path 2","mn":"ADBE Vector Shape - Group"},{"ty":"fl","c":{"a":0,"k":[0.33,0.33,0.28,1]},"o":{"a":0,"k":100},"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":4,"mn":"ADBE Vector Group"}],"ip":0,"op":61,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":1,"ty":4,"nm":"mouth_smile","parent":2,"ks":{"o":{"a":0,"k":100},"r":{"a":1,"k":[{"i":{"x":[0.25],"y":[1]},"o":{"x":[0.75],"y":[0]},"n":["0p25_1_0p75_0"],"t":4,"s":[0],"e":[-15]},{"i":{"x":[0.25],"y":[1]},"o":{"x":[0.75],"y":[0]},"n":["0p25_1_0p75_0"],"t":15,"s":[-15],"e":[0]},{"t":30}]},"p":{"a":0,"k":[50.862,57.489,0]},"a":{"a":0,"k":[-251.138,-404.511,0]},"s":{"a":0,"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"a":1,"k":[{"i":{"x":0.292,"y":1},"o":{"x":0.506,"y":0},"n":"0p292_1_0p506_0","t":0,"s":[{"i":[[6.254,0],[2.91,1.715],[-0.616,0.558],[-0.707,-0.436],[-2.276,0],[-3.615,1.995],[-0.52,-0.71],[0.737,-0.384]],"o":[[-6.249,0],[-0.716,-0.422],[0.615,-0.558],[3.273,2.017],[2.662,0],[0.728,-0.402],[0.324,0.602],[-3.252,1.696]],"v":[[-252.006,-391.01],[-263.629,-394.434],[-263.522,-396.373],[-261.398,-396.454],[-252.006,-394.02],[-242.635,-396.433],[-240.261,-396.227],[-240.405,-394.414]],"c":true}],"e":[{"i":[[6.233,0],[4.195,4.639],[-0.616,0.558],[-0.558,-0.615],[-5.401,0],[-3.206,6.717],[-0.615,-0.557],[0.338,-0.759]],"o":[[-6.249,0],[-0.557,-0.616],[0.615,-0.558],[3.626,4.01],[4.636,0],[0.358,-0.75],[0.616,0.557],[-2.811,6.323]],"v":[[-252.044,-390.197],[-266.129,-396.746],[-266.022,-398.873],[-263.898,-398.767],[-252.076,-392.959],[-239.687,-401.031],[-237.564,-401.138],[-237.457,-399.012]],"c":true}]},{"i":{"x":0.564,"y":1},"o":{"x":0.571,"y":0},"n":"0p564_1_0p571_0","t":15,"s":[{"i":[[6.233,0],[4.195,4.639],[-0.616,0.558],[-0.558,-0.615],[-5.401,0],[-3.206,6.717],[-0.615,-0.557],[0.338,-0.759]],"o":[[-6.249,0],[-0.557,-0.616],[0.615,-0.558],[3.626,4.01],[4.636,0],[0.358,-0.75],[0.616,0.557],[-2.811,6.323]],"v":[[-252.044,-390.197],[-266.129,-396.746],[-266.022,-398.873],[-263.898,-398.767],[-252.076,-392.959],[-239.687,-401.031],[-237.564,-401.138],[-237.457,-399.012]],"c":true}],"e":[{"i":[[6.254,0],[2.91,1.715],[-0.616,0.558],[-0.707,-0.436],[-2.276,0],[-3.615,1.995],[-0.52,-0.71],[0.737,-0.384]],"o":[[-6.249,0],[-0.716,-0.422],[0.615,-0.558],[3.273,2.017],[2.662,0],[0.728,-0.402],[0.324,0.602],[-3.252,1.696]],"v":[[-252.006,-391.01],[-263.629,-394.434],[-263.522,-396.373],[-261.398,-396.454],[-252.006,-394.02],[-242.635,-396.433],[-240.261,-396.227],[-240.405,-394.414]],"c":true}]},{"i":{"x":0.681,"y":0.833},"o":{"x":0.546,"y":0},"n":"0p681_0p833_0p546_0","t":30,"s":[{"i":[[6.254,0],[2.91,1.715],[-0.616,0.558],[-0.707,-0.436],[-2.276,0],[-3.615,1.995],[-0.52,-0.71],[0.737,-0.384]],"o":[[-6.249,0],[-0.716,-0.422],[0.615,-0.558],[3.273,2.017],[2.662,0],[0.728,-0.402],[0.324,0.602],[-3.252,1.696]],"v":[[-252.006,-391.01],[-263.629,-394.434],[-263.522,-396.373],[-261.398,-396.454],[-252.006,-394.02],[-242.635,-396.433],[-240.261,-396.227],[-240.405,-394.414]],"c":true}],"e":[{"i":[[6.254,0],[2.91,1.715],[-0.616,0.558],[-0.734,-0.389],[-2.276,0],[-3.487,2.248],[-0.52,-0.71],[0.673,-0.488]],"o":[[-6.249,0],[-0.716,-0.422],[0.615,-0.558],[3.089,1.638],[2.662,0],[0.699,-0.451],[0.324,0.602],[-2.905,2.105]],"v":[[-252.006,-391.01],[-264.507,-394.555],[-264.401,-396.494],[-262.276,-396.576],[-252.006,-394.02],[-242.076,-396.998],[-239.702,-396.793],[-239.845,-394.98]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.497,"y":0.261},"n":"0p667_1_0p497_0p261","t":40,"s":[{"i":[[6.254,0],[2.91,1.715],[-0.616,0.558],[-0.734,-0.389],[-2.276,0],[-3.487,2.248],[-0.52,-0.71],[0.673,-0.488]],"o":[[-6.249,0],[-0.716,-0.422],[0.615,-0.558],[3.089,1.638],[2.662,0],[0.699,-0.451],[0.324,0.602],[-2.905,2.105]],"v":[[-252.006,-391.01],[-264.507,-394.555],[-264.401,-396.494],[-262.276,-396.576],[-252.006,-394.02],[-242.076,-396.998],[-239.702,-396.793],[-239.845,-394.98]],"c":true}],"e":[{"i":[[6.254,0],[2.91,1.715],[-0.616,0.558],[-0.707,-0.436],[-2.276,0],[-3.615,1.995],[-0.52,-0.71],[0.737,-0.384]],"o":[[-6.249,0],[-0.716,-0.422],[0.615,-0.558],[3.273,2.017],[2.662,0],[0.728,-0.402],[0.324,0.602],[-3.252,1.696]],"v":[[-252.006,-391.01],[-263.629,-394.434],[-263.522,-396.373],[-261.398,-396.454],[-252.006,-394.02],[-242.635,-396.433],[-240.261,-396.227],[-240.405,-394.414]],"c":true}]},{"t":60}]},"nm":"Path 1","mn":"ADBE Vector Shape - Group"},{"ty":"fl","c":{"a":0,"k":[0.33,0.33,0.28,1]},"o":{"a":0,"k":100},"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"mn":"ADBE Vector Group"}],"ip":0,"op":61,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":2,"ty":0,"nm":"base_normal","refId":"comp_38","ks":{"o":{"a":0,"k":100},"r":{"a":1,"k":[{"i":{"x":[0.273],"y":[1]},"o":{"x":[0.464],"y":[0]},"n":["0p273_1_0p464_0"],"t":4,"s":[0],"e":[13]},{"i":{"x":[0.532],"y":[1]},"o":{"x":[0.578],"y":[0]},"n":["0p532_1_0p578_0"],"t":19,"s":[13],"e":[0]},{"t":40}]},"p":{"a":0,"k":[50,50,0]},"a":{"a":0,"k":[50,50,0]},"s":{"a":0,"k":[100,100,100]}},"ao":0,"w":100,"h":100,"ip":0,"op":61,"st":0,"bm":0,"sr":1}]} \ No newline at end of file
diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build
index 5495315..4540486 100644
--- a/src/tests/elementary/meson.build
+++ b/src/tests/elementary/meson.build
@@ -134,7 +134,7 @@ efl_ui_suite_src = [
134 'efl_ui_test_box_stack.c', 134 'efl_ui_test_box_stack.c',
135 'efl_ui_test_table.c', 135 'efl_ui_test_table.c',
136 'efl_ui_test_grid.c', 136 'efl_ui_test_grid.c',
137 'efl_ui_test_relative_layout.c', 137 'efl_ui_test_relative_container.c',
138 'efl_ui_test_image.c', 138 'efl_ui_test_image.c',
139 'efl_ui_test_image_zoomable.c', 139 'efl_ui_test_image_zoomable.c',
140 'efl_ui_test_layout.c', 140 'efl_ui_test_layout.c',
@@ -150,6 +150,7 @@ efl_ui_suite_src = [
150 'efl_ui_test_slider.c', 150 'efl_ui_test_slider.c',
151 'efl_ui_test_collection_common.c', 151 'efl_ui_test_collection_common.c',
152 'efl_ui_test_collection.c', 152 'efl_ui_test_collection.c',
153 'efl_ui_test_collection_view.c',
153 'efl_ui_test_list_collection.c', 154 'efl_ui_test_list_collection.c',
154 'efl_ui_test_grid_collection.c', 155 'efl_ui_test_grid_collection.c',
155 'efl_ui_test_position_manager_common.c', 156 'efl_ui_test_position_manager_common.c',
@@ -158,6 +159,8 @@ efl_ui_suite_src = [
158 'efl_ui_test_select_model.c', 159 'efl_ui_test_select_model.c',
159 'efl_ui_test_view_model.c', 160 'efl_ui_test_view_model.c',
160 'efl_ui_test_group_item.c', 161 'efl_ui_test_group_item.c',
162 'efl_ui_test_text.c',
163 'efl_ui_test_vg_animation.c',
161] 164]
162 165
163efl_ui_suite = executable('efl_ui_suite', 166efl_ui_suite = executable('efl_ui_suite',
diff --git a/src/tests/elementary/spec/efl_test_basics.c b/src/tests/elementary/spec/efl_test_basics.c
index 047e07d..2774b2a 100644
--- a/src/tests/elementary/spec/efl_test_basics.c
+++ b/src/tests/elementary/spec/efl_test_basics.c
@@ -17,6 +17,7 @@
17 "Efl.Ui.List_View", 17 "Efl.Ui.List_View",
18 "Efl.Ui.Tab_Bar", 18 "Efl.Ui.Tab_Bar",
19 "Efl.Ui.Tags", 19 "Efl.Ui.Tags",
20 "Efl.Ui.Textbox",
20 "Efl.Ui.Panel", 21 "Efl.Ui.Panel",
21 "Efl.Ui.Scroller", 22 "Efl.Ui.Scroller",
22 "Efl.Ui.Slider", 23 "Efl.Ui.Slider",
@@ -43,10 +44,13 @@
43 "Efl.Ui.Tab_Page", 44 "Efl.Ui.Tab_Page",
44 "Efl.Ui.Timepicker", 45 "Efl.Ui.Timepicker",
45 "Efl.Ui.Navigation_Bar", 46 "Efl.Ui.Navigation_Bar",
46 "Efl.Ui.Relative_Layout", 47 "Efl.Ui.Relative_Container",
47 "Efl.Ui.Animation_View", 48 "Efl.Ui.Vg_Animation",
48 "Efl.Ui.Table", 49 "Efl.Ui.Table",
49 "Efl.Ui.Flip" 50 "Efl.Ui.Flip",
51 "Efl.Ui.Stack",
52 "Efl.Ui.Pager",
53 "Efl.Ui.Separator"
50 ], 54 ],
51 "custom-mapping" : { 55 "custom-mapping" : {
52 "Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS", 56 "Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS",
@@ -63,6 +67,8 @@ EFL_START_TEST(no_leaking_canvas_object)
63 Eina_Iterator *iter = eo_objects_iterator_new(); 67 Eina_Iterator *iter = eo_objects_iterator_new();
64 Eo *obj; 68 Eo *obj;
65 69
70 if (efl_isa(widget, EFL_UI_FLIP_CLASS)) return; //FIXME Flip needs more work for this. However, flip should be redone as a spotlight manager, When this is done, we can add these classes to the check here.
71
66 EINA_ITERATOR_FOREACH(iter, obj) 72 EINA_ITERATOR_FOREACH(iter, obj)
67 { 73 {
68 if (!efl_alive_get(obj)) continue; 74 if (!efl_alive_get(obj)) continue;
@@ -72,6 +78,12 @@ EFL_START_TEST(no_leaking_canvas_object)
72 } 78 }
73 eina_iterator_free(iter); 79 eina_iterator_free(iter);
74 80
81 //Just overwrite the widget pointer, and expect errors, if any error is happening here, we are not interested in it, another testcase will take care of them
82 EXPECT_ERROR_START;
83 widget = efl_add(widget_klass, win);
84 expect_error_start = EINA_TRUE;
85 EXPECT_ERROR_END;
86
75 //now try to will those widgets 87 //now try to will those widgets
76 if (efl_isa(widget, EFL_PACK_LINEAR_INTERFACE)) 88 if (efl_isa(widget, EFL_PACK_LINEAR_INTERFACE))
77 { 89 {
@@ -102,7 +114,10 @@ EFL_START_TEST(no_leaking_canvas_object)
102 if (!efl_alive_get(obj)) continue; 114 if (!efl_alive_get(obj)) continue;
103 if (!efl_isa(obj, EFL_CANVAS_OBJECT_CLASS)) continue; 115 if (!efl_isa(obj, EFL_CANVAS_OBJECT_CLASS)) continue;
104 116
105 ck_assert_ptr_ne(eina_list_data_find(not_invalidate, obj), NULL); 117 if (eina_list_data_find(not_invalidate, obj) == NULL)
118 {
119 ck_abort_msg("Leak detected %s Evas-Parent: %s", efl_debug_name_get(obj), efl_class_name_get(efl_canvas_object_render_parent_get(obj)));
120 }
106 } 121 }
107 eina_iterator_free(iter); 122 eina_iterator_free(iter);
108 123
@@ -110,6 +125,13 @@ EFL_START_TEST(no_leaking_canvas_object)
110} 125}
111EFL_END_TEST 126EFL_END_TEST
112 127
128
129EFL_START_TEST(no_err_on_creation)
130{
131 widget = efl_add(widget_klass, win);
132}
133EFL_END_TEST
134
113EFL_START_TEST(no_err_on_shutdown) 135EFL_START_TEST(no_err_on_shutdown)
114{ 136{
115 efl_ref(widget); 137 efl_ref(widget);
@@ -118,9 +140,77 @@ EFL_START_TEST(no_err_on_shutdown)
118} 140}
119EFL_END_TEST 141EFL_END_TEST
120 142
143static Eina_Bool
144is_this_visible(Eo *obj)
145{
146 Eina_Size2D sz;
147
148 if (!efl_gfx_entity_visible_get(obj))
149 return EINA_FALSE;
150
151 sz = efl_gfx_entity_size_get(obj);
152 if ((!sz.w) || (!sz.h)) return EINA_FALSE;
153
154 for (Eo *clipper = efl_canvas_object_clipper_get(obj); clipper ; clipper = efl_canvas_object_clipper_get(clipper))
155 {
156 int r,g,b,a;
157
158 efl_gfx_color_get(clipper, &r, &g, &b, &a);
159
160 if (!efl_gfx_entity_visible_get(clipper)) return EINA_FALSE;
161
162 if (r == 0 && g == 0 && b == 0) return EINA_FALSE;
163 if (a == 0) return EINA_FALSE;
164 sz = efl_gfx_entity_size_get(clipper);
165 if ((!sz.w) || (!sz.h)) return EINA_FALSE;
166 }
167 return EINA_TRUE;
168}
169
170EFL_START_TEST(correct_visibility_setting)
171{
172 Eo *checker = NULL;
173
174 if (efl_isa(widget, EFL_UI_FLIP_CLASS)) return; //FIXME Flip needs more work for this. However, flip should be redone as a spotlight manager, When this is done, we can add these classes to the check here.
175
176 efl_gfx_entity_size_set(widget, EINA_SIZE2D(200, 200));
177 efl_gfx_hint_size_min_set(widget, EINA_SIZE2D(200, 200));
178 efl_gfx_entity_visible_set(widget, EINA_TRUE);
179 checker = create_test_widget();
180 efl_gfx_hint_size_min_set(checker, EINA_SIZE2D(100, 100));
181
182 if (efl_isa(widget, EFL_PACK_INTERFACE))
183 {
184 efl_pack(widget, checker);
185 }
186 else if (efl_isa(widget, EFL_CONTENT_INTERFACE))
187 {
188 efl_content_set(widget, checker);
189 }
190 else
191 return;
192
193 get_me_to_those_events(widget);
194
195 if (checker)
196 ck_assert_int_eq(is_this_visible(checker), EINA_TRUE);
197
198 efl_gfx_entity_visible_set(widget, EINA_FALSE);
199 get_me_to_those_events(widget);
200 if (checker)
201 ck_assert_int_eq(is_this_visible(checker), EINA_FALSE);
202
203 efl_gfx_entity_visible_set(widget, EINA_TRUE);
204 get_me_to_those_events(widget);
205 if (checker)
206 ck_assert_int_eq(is_this_visible(checker), EINA_TRUE);
207}
208EFL_END_TEST
121void 209void
122efl_ui_widget_behavior_test(TCase *tc) 210efl_ui_widget_behavior_test(TCase *tc)
123{ 211{
124 tcase_add_test(tc, no_leaking_canvas_object); 212 tcase_add_test(tc, no_leaking_canvas_object);
125 tcase_add_test(tc, no_err_on_shutdown); 213 tcase_add_test(tc, no_err_on_shutdown);
214 tcase_add_test(tc, correct_visibility_setting);
215 tcase_add_test(tc, no_err_on_creation);
126} 216}
diff --git a/src/tests/elementary/spec/efl_test_clickable.c b/src/tests/elementary/spec/efl_test_clickable.c
index e6991f8..d297d29 100644
--- a/src/tests/elementary/spec/efl_test_clickable.c
+++ b/src/tests/elementary/spec/efl_test_clickable.c
@@ -12,7 +12,7 @@
12#include "elm_widget.h" 12#include "elm_widget.h"
13/* spec-meta-start 13/* spec-meta-start
14 {"test-interface":"Efl.Ui.Clickable", 14 {"test-interface":"Efl.Ui.Clickable",
15 "test-widgets": ["Efl.Ui.Button", "Efl.Ui.Image", "Efl.Ui.Panes", "Efl.Ui.Frame", "Efl.Ui.Item.Realized", "Efl.Ui.Radio", "Efl.Ui.Check"] 15 "test-widgets": ["Efl.Ui.Button", "Efl.Ui.Image", "Efl.Ui.Panes", "Efl.Ui.Frame", "Efl.Ui.Grid_Default_Item", "Efl.Ui.List_Default_Item", "Efl.Ui.Radio", "Efl.Ui.Check"]
16 } 16 }
17 spec-meta-end 17 spec-meta-end
18 */ 18 */
@@ -64,10 +64,6 @@ prepare_window(void)
64 } 64 }
65 else if (efl_isa(widget, EFL_UI_ITEM_CLASS)) 65 else if (efl_isa(widget, EFL_UI_ITEM_CLASS))
66 { 66 {
67 elm_widget_theme_klass_set(widget, "grid_item");
68 elm_widget_theme_element_set(widget, NULL);
69 elm_widget_theme_style_set(widget, NULL);
70 efl_ui_widget_theme_apply(widget);
71 pos->x = 30; 67 pos->x = 30;
72 pos->y = 30; 68 pos->y = 30;
73 } 69 }
diff --git a/src/tests/elementary/spec/efl_test_content.c b/src/tests/elementary/spec/efl_test_content.c
index 4800a1b..98c3b36 100644
--- a/src/tests/elementary/spec/efl_test_content.c
+++ b/src/tests/elementary/spec/efl_test_content.c
@@ -27,6 +27,8 @@ EFL_START_TEST(content_set_get)
27 ck_assert_int_eq(efl_content_set(widget, (void*)0x1), EINA_FALSE); 27 ck_assert_int_eq(efl_content_set(widget, (void*)0x1), EINA_FALSE);
28 EXPECT_ERROR_END; 28 EXPECT_ERROR_END;
29 ck_assert_ptr_eq(efl_content_get(widget), NULL); 29 ck_assert_ptr_eq(efl_content_get(widget), NULL);
30
31 ck_assert_int_eq(efl_alive_get(w), EINA_FALSE);
30} 32}
31EFL_END_TEST 33EFL_END_TEST
32 34
@@ -39,7 +41,10 @@ EFL_START_TEST(content_set_get2)
39 ck_assert_ptr_eq(efl_content_get(widget), w); 41 ck_assert_ptr_eq(efl_content_get(widget), w);
40 42
41 ck_assert_int_eq(efl_content_set(widget, NULL), EINA_TRUE); 43 ck_assert_int_eq(efl_content_set(widget, NULL), EINA_TRUE);
44 ck_assert_int_eq(efl_alive_get(w), EINA_FALSE);
42 ck_assert_ptr_eq(efl_content_get(widget), NULL); 45 ck_assert_ptr_eq(efl_content_get(widget), NULL);
46
47 efl_del(widget);
43} 48}
44EFL_END_TEST 49EFL_END_TEST
45 50
@@ -49,8 +54,11 @@ EFL_START_TEST(content_unset)
49 Efl_Ui_Widget *w = create_test_widget(); 54 Efl_Ui_Widget *w = create_test_widget();
50 55
51 ck_assert_int_eq(efl_content_set(widget, w), EINA_TRUE); 56 ck_assert_int_eq(efl_content_set(widget, w), EINA_TRUE);
52 efl_content_unset(widget); 57 ck_assert_ptr_eq(efl_content_unset(widget), w);
53 ck_assert_ptr_eq(efl_content_get(widget), NULL); 58 ck_assert_ptr_eq(efl_content_get(widget), NULL);
59
60 efl_del(widget);
61 ck_assert_int_eq(efl_alive_get(w), EINA_TRUE);
54} 62}
55EFL_END_TEST 63EFL_END_TEST
56 64
diff --git a/src/tests/elementary/spec/efl_test_format.c b/src/tests/elementary/spec/efl_test_format.c
index c3fa7d4..7540829 100644
--- a/src/tests/elementary/spec/efl_test_format.c
+++ b/src/tests/elementary/spec/efl_test_format.c
@@ -24,7 +24,7 @@ EFL_START_TEST(format_values)
24 Eina_Strbuf *buf = eina_strbuf_new(); 24 Eina_Strbuf *buf = eina_strbuf_new();
25 Eina_Value eina_val; 25 Eina_Value eina_val;
26 26
27 efl_ui_format_values_set(widget, EINA_C_ARRAY_ACCESSOR_NEW(values)); 27 efl_ui_format_values_set(widget, EINA_C_ARRAY_ACCESSOR_PTR_NEW(values));
28 eina_val = eina_value_int_init(17); 28 eina_val = eina_value_int_init(17);
29 efl_ui_format_formatted_value_get(widget, buf, eina_val); 29 efl_ui_format_formatted_value_get(widget, buf, eina_val);
30 ck_assert_str_eq(eina_strbuf_string_get(buf), "seventeen"); // Check that value works 30 ck_assert_str_eq(eina_strbuf_string_get(buf), "seventeen"); // Check that value works
@@ -141,7 +141,7 @@ EFL_START_TEST(format_mixed)
141 141
142 // Now we check combinations of different options 142 // Now we check combinations of different options
143 // Each one should be used in turn when the previous one fails: values, func, string, fallback 143 // Each one should be used in turn when the previous one fails: values, func, string, fallback
144 efl_ui_format_values_set(widget, EINA_C_ARRAY_ACCESSOR_NEW(values)); 144 efl_ui_format_values_set(widget, EINA_C_ARRAY_ACCESSOR_PTR_NEW(values));
145 efl_ui_format_func_set(widget, NULL, _partial_format_func, NULL); 145 efl_ui_format_func_set(widget, NULL, _partial_format_func, NULL);
146 efl_ui_format_string_set(widget, "%d rabbits", EFL_UI_FORMAT_STRING_TYPE_SIMPLE); 146 efl_ui_format_string_set(widget, "%d rabbits", EFL_UI_FORMAT_STRING_TYPE_SIMPLE);
147 147
diff --git a/src/tests/elementary/spec/efl_test_gfx_view.c b/src/tests/elementary/spec/efl_test_gfx_view.c
index fc41113..e87419f 100644
--- a/src/tests/elementary/spec/efl_test_gfx_view.c
+++ b/src/tests/elementary/spec/efl_test_gfx_view.c
@@ -8,7 +8,7 @@
8 8
9/* spec-meta-start 9/* spec-meta-start
10 {"test-interface":"Efl.Gfx.View", 10 {"test-interface":"Efl.Gfx.View",
11 "test-widgets": ["Efl.Ui.Animation_View"]} 11 "test-widgets": ["Efl.Ui.Vg_Animation"]}
12 spec-meta-end */ 12 spec-meta-end */
13 13
14EFL_START_TEST(view_size) 14EFL_START_TEST(view_size)
diff --git a/src/tests/elementary/spec/efl_test_multi_selectable.c b/src/tests/elementary/spec/efl_test_multi_selectable.c
index edd445a..3a02ed9 100644
--- a/src/tests/elementary/spec/efl_test_multi_selectable.c
+++ b/src/tests/elementary/spec/efl_test_multi_selectable.c
@@ -36,7 +36,7 @@ EFL_START_TEST(test_multi_select)
36 int c = 0; 36 int c = 0;
37 37
38 Eina_Array *arr_selected; 38 Eina_Array *arr_selected;
39 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 39 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
40 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); 40 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
41 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); 41 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
42 42
@@ -52,7 +52,7 @@ EFL_START_TEST(test_multi_select)
52 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_TRUE); 52 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_TRUE);
53 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_TRUE); 53 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_TRUE);
54 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), efl_pack_content_get(widget, 2)); 54 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), efl_pack_content_get(widget, 2));
55 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 55 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
56 ck_assert_int_eq(eina_array_count(arr_selected), 2); 56 ck_assert_int_eq(eina_array_count(arr_selected), 2);
57 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); 57 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0));
58 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); 58 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2));
@@ -62,6 +62,7 @@ EFL_START_TEST(test_multi_select)
62 62
63 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); 63 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
64 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); 64 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
65 eina_array_free(arr_selected);
65} 66}
66EFL_END_TEST 67EFL_END_TEST
67 68
@@ -69,7 +70,7 @@ EFL_START_TEST(test_multi_select_removal)
69{ 70{
70 int c = 0; 71 int c = 0;
71 Eina_Array *arr_selected; 72 Eina_Array *arr_selected;
72 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 73 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
73 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); 74 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
74 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); 75 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
75 76
@@ -87,10 +88,11 @@ EFL_START_TEST(test_multi_select_removal)
87 c = 0; 88 c = 0;
88 89
89 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), NULL); 90 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), NULL);
90 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 91 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
91 ck_assert_int_eq(eina_array_count(arr_selected), 0); 92 ck_assert_int_eq(eina_array_count(arr_selected), 0);
92 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); 93 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
93 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); 94 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
95 eina_array_free(arr_selected);
94} 96}
95EFL_END_TEST 97EFL_END_TEST
96 98
@@ -99,7 +101,7 @@ EFL_START_TEST(test_single_select)
99 int c = 0; 101 int c = 0;
100 Eina_Array *arr_selected; 102 Eina_Array *arr_selected;
101 103
102 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE); 104 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE);
103 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); 105 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
104 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); 106 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
105 107
@@ -114,7 +116,7 @@ EFL_START_TEST(test_single_select)
114 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); 116 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE);
115 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_TRUE); 117 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_TRUE);
116 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), efl_pack_content_get(widget, 2)); 118 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), efl_pack_content_get(widget, 2));
117 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 119 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
118 ck_assert_int_eq(eina_array_count(arr_selected), 1); 120 ck_assert_int_eq(eina_array_count(arr_selected), 1);
119 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 2)); 121 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 2));
120 122
@@ -123,6 +125,7 @@ EFL_START_TEST(test_single_select)
123 125
124 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); 126 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
125 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); 127 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
128 eina_array_free(arr_selected);
126} 129}
127EFL_END_TEST 130EFL_END_TEST
128 131
@@ -131,7 +134,7 @@ EFL_START_TEST(test_none_select)
131 Eina_Array *arr_selected; 134 Eina_Array *arr_selected;
132 int c = 0; 135 int c = 0;
133 136
134 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE); 137 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE);
135 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); 138 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
136 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); 139 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
137 140
@@ -144,10 +147,11 @@ EFL_START_TEST(test_none_select)
144 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); 147 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE);
145 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_FALSE); 148 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_FALSE);
146 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), NULL); 149 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), NULL);
147 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 150 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
148 ck_assert_int_eq(eina_array_count(arr_selected), 0); 151 ck_assert_int_eq(eina_array_count(arr_selected), 0);
149 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); 152 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
150 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); 153 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
154 eina_array_free(arr_selected);
151} 155}
152EFL_END_TEST 156EFL_END_TEST
153 157
@@ -155,15 +159,16 @@ EFL_START_TEST(all_select_api)
155{ 159{
156 Eina_Array *arr_selected; 160 Eina_Array *arr_selected;
157 161
158 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 162 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
159 efl_ui_selectable_all_select(widget); 163 efl_ui_multi_selectable_all_select(widget);
160 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 164 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
161 165
162 ck_assert_int_eq(eina_array_count(arr_selected), 3); 166 ck_assert_int_eq(eina_array_count(arr_selected), 3);
163 167
164 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); 168 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0));
165 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 1)); 169 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 1));
166 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 2), efl_pack_content_get(widget, 2)); 170 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 2), efl_pack_content_get(widget, 2));
171 eina_array_free(arr_selected);
167} 172}
168EFL_END_TEST 173EFL_END_TEST
169 174
@@ -171,14 +176,15 @@ EFL_START_TEST(all_unselect_api)
171{ 176{
172 Eina_Array *arr_selected; 177 Eina_Array *arr_selected;
173 178
174 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 179 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
175 efl_ui_selectable_selected_set(efl_pack_content_get(widget, 0), EINA_TRUE); 180 efl_ui_selectable_selected_set(efl_pack_content_get(widget, 0), EINA_TRUE);
176 181
177 efl_ui_selectable_all_unselect(widget); 182 efl_ui_multi_selectable_all_unselect(widget);
178 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 183 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
179 184
180 ck_assert_int_eq(eina_array_count(arr_selected), 0); 185 ck_assert_int_eq(eina_array_count(arr_selected), 0);
181 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); 186 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE);
187 eina_array_free(arr_selected);
182} 188}
183EFL_END_TEST 189EFL_END_TEST
184 190
@@ -186,13 +192,14 @@ EFL_START_TEST(range_unselect)
186{ 192{
187 Eina_Array *arr_selected; 193 Eina_Array *arr_selected;
188 194
189 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 195 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
190 efl_ui_selectable_all_select(widget); 196 efl_ui_multi_selectable_all_select(widget);
191 197
192 efl_ui_selectable_range_unselect(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); 198 efl_ui_multi_selectable_range_unselect(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2));
193 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 199 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
194 ck_assert_int_eq(eina_array_count(arr_selected), 1); 200 ck_assert_int_eq(eina_array_count(arr_selected), 1);
195 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); 201 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0));
202 eina_array_free(arr_selected);
196} 203}
197EFL_END_TEST 204EFL_END_TEST
198 205
@@ -200,13 +207,14 @@ EFL_START_TEST(range_unselect2)
200{ 207{
201 Eina_Array *arr_selected; 208 Eina_Array *arr_selected;
202 209
203 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 210 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
204 efl_ui_selectable_all_select(widget); 211 efl_ui_multi_selectable_all_select(widget);
205 212
206 efl_ui_selectable_range_unselect(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); 213 efl_ui_multi_selectable_range_unselect(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1));
207 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 214 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
208 ck_assert_int_eq(eina_array_count(arr_selected), 1); 215 ck_assert_int_eq(eina_array_count(arr_selected), 1);
209 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); 216 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0));
217 eina_array_free(arr_selected);
210} 218}
211EFL_END_TEST 219EFL_END_TEST
212 220
@@ -214,12 +222,13 @@ EFL_START_TEST(range_select)
214{ 222{
215 Eina_Array *arr_selected; 223 Eina_Array *arr_selected;
216 224
217 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 225 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
218 efl_ui_selectable_range_select(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); 226 efl_ui_multi_selectable_range_select(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2));
219 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 227 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
220 ck_assert_int_eq(eina_array_count(arr_selected), 2); 228 ck_assert_int_eq(eina_array_count(arr_selected), 2);
221 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1)); 229 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1));
222 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); 230 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2));
231 eina_array_free(arr_selected);
223} 232}
224EFL_END_TEST 233EFL_END_TEST
225 234
@@ -227,12 +236,13 @@ EFL_START_TEST(range_select2)
227{ 236{
228 Eina_Array *arr_selected; 237 Eina_Array *arr_selected;
229 238
230 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 239 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
231 efl_ui_selectable_range_select(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); 240 efl_ui_multi_selectable_range_select(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1));
232 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 241 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
233 ck_assert_int_eq(eina_array_count(arr_selected), 2); 242 ck_assert_int_eq(eina_array_count(arr_selected), 2);
234 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1)); 243 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1));
235 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); 244 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2));
245 eina_array_free(arr_selected);
236} 246}
237EFL_END_TEST 247EFL_END_TEST
238 248
@@ -240,9 +250,9 @@ EFL_START_TEST(change_mode_from_multi_to_single)
240{ 250{
241 int sel = 0; 251 int sel = 0;
242 252
243 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 253 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
244 efl_ui_selectable_all_select(widget); 254 efl_ui_multi_selectable_all_select(widget);
245 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE); 255 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE);
246 for (int i = 0; i < efl_content_count(widget); ++i) 256 for (int i = 0; i < efl_content_count(widget); ++i)
247 { 257 {
248 if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i))) 258 if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i)))
@@ -257,9 +267,9 @@ EFL_START_TEST(change_mode_from_multi_to_none)
257{ 267{
258 int sel = 0; 268 int sel = 0;
259 269
260 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 270 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
261 efl_ui_selectable_all_select(widget); 271 efl_ui_multi_selectable_all_select(widget);
262 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE); 272 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE);
263 for (int i = 0; i < efl_content_count(widget); ++i) 273 for (int i = 0; i < efl_content_count(widget); ++i)
264 { 274 {
265 if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i))) 275 if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i)))
@@ -273,9 +283,9 @@ EFL_START_TEST(change_mode_from_single_to_none)
273{ 283{
274 int sel = 0; 284 int sel = 0;
275 285
276 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE); 286 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE);
277 efl_ui_selectable_all_select(widget); 287 efl_ui_multi_selectable_all_select(widget);
278 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE); 288 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE);
279 for (int i = 0; i < efl_content_count(widget); ++i) 289 for (int i = 0; i < efl_content_count(widget); ++i)
280 { 290 {
281 if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i))) 291 if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i)))
diff --git a/src/tests/elementary/spec/efl_test_pack.c b/src/tests/elementary/spec/efl_test_pack.c
index 9ecc356..05f1e1f 100644
--- a/src/tests/elementary/spec/efl_test_pack.c
+++ b/src/tests/elementary/spec/efl_test_pack.c
@@ -8,7 +8,7 @@
8 8
9/* spec-meta-start 9/* spec-meta-start
10 {"test-interface":"Efl.Pack", 10 {"test-interface":"Efl.Pack",
11 "test-widgets": ["Efl.Ui.Table", "Efl.Ui.Relative_Layout"]} 11 "test-widgets": ["Efl.Ui.Table", "Efl.Ui.Relative_Container"]}
12 12
13 spec-meta-end */ 13 spec-meta-end */
14 14
diff --git a/src/tests/elementary/spec/efl_test_pack_linear.c b/src/tests/elementary/spec/efl_test_pack_linear.c
index 0ecaacd..f4c8955 100644
--- a/src/tests/elementary/spec/efl_test_pack_linear.c
+++ b/src/tests/elementary/spec/efl_test_pack_linear.c
@@ -20,15 +20,6 @@
20 spec-meta-end */ 20 spec-meta-end */
21 21
22static void 22static void
23_fill_array(Efl_Ui_Widget *wid[3])
24{
25 for (int i = 0; i < 3; ++i)
26 {
27 wid[i] = create_test_widget();
28 }
29}
30
31static void
32_ordering_equals(Efl_Ui_Widget **wid, unsigned int len) 23_ordering_equals(Efl_Ui_Widget **wid, unsigned int len)
33{ 24{
34 for (unsigned int i = 0; i < len; ++i) 25 for (unsigned int i = 0; i < len; ++i)
@@ -43,10 +34,9 @@ EFL_START_TEST(pack_begin1)
43 Efl_Ui_Widget *wid[3]; 34 Efl_Ui_Widget *wid[3];
44 Efl_Ui_Widget *inv = create_test_widget(); 35 Efl_Ui_Widget *inv = create_test_widget();
45 36
46 _fill_array(wid);
47
48 for (int i = 2; i >= 0; i--) 37 for (int i = 2; i >= 0; i--)
49 { 38 {
39 wid[i] = create_test_widget();
50 efl_pack_begin(widget, wid[i]); 40 efl_pack_begin(widget, wid[i]);
51 ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget); 41 ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget);
52 } 42 }
@@ -62,10 +52,9 @@ EFL_START_TEST(pack_begin2)
62{ 52{
63 Efl_Ui_Widget *wid[3]; 53 Efl_Ui_Widget *wid[3];
64 54
65 _fill_array(wid);
66
67 for (int i = 2; i >= 0; i--) 55 for (int i = 2; i >= 0; i--)
68 { 56 {
57 wid[i] = create_test_widget();
69 efl_pack_begin(widget, wid[i]); 58 efl_pack_begin(widget, wid[i]);
70 ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget); 59 ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget);
71 } 60 }
@@ -82,10 +71,9 @@ EFL_START_TEST(pack_end1)
82 Efl_Ui_Widget *wid[3]; 71 Efl_Ui_Widget *wid[3];
83 Efl_Ui_Widget *inv = create_test_widget(); 72 Efl_Ui_Widget *inv = create_test_widget();
84 73
85 _fill_array(wid);
86
87 for (int i = 0; i < 3; i++) 74 for (int i = 0; i < 3; i++)
88 { 75 {
76 wid[i] = create_test_widget();
89 efl_pack_end(widget, wid[i]); 77 efl_pack_end(widget, wid[i]);
90 ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget); 78 ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget);
91 } 79 }
@@ -102,10 +90,9 @@ EFL_START_TEST(pack_end2)
102{ 90{
103 Efl_Ui_Widget *wid[3]; 91 Efl_Ui_Widget *wid[3];
104 92
105 _fill_array(wid);
106
107 for (int i = 0; i < 3; i++) 93 for (int i = 0; i < 3; i++)
108 { 94 {
95 wid[i] = create_test_widget();
109 efl_pack_end(widget, wid[i]); 96 efl_pack_end(widget, wid[i]);
110 ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget); 97 ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget);
111 } 98 }
@@ -122,10 +109,11 @@ EFL_START_TEST(pack_before1)
122 Efl_Ui_Widget *wid[3]; 109 Efl_Ui_Widget *wid[3];
123 Efl_Ui_Widget *inv = create_test_widget(); 110 Efl_Ui_Widget *inv = create_test_widget();
124 111
125 _fill_array(wid);
126
127 for (int i = 0; i < 3; i++) 112 for (int i = 0; i < 3; i++)
128 efl_pack_end(widget, wid[i]); 113 {
114 wid[i] = create_test_widget();
115 efl_pack_end(widget, wid[i]);
116 }
129 117
130 ck_assert_int_eq(efl_pack_before(widget, inv, wid[0]), EINA_TRUE); 118 ck_assert_int_eq(efl_pack_before(widget, inv, wid[0]), EINA_TRUE);
131 ck_assert_ptr_eq(efl_test_parent_get(inv), widget); 119 ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
@@ -145,10 +133,11 @@ EFL_START_TEST(pack_before2)
145 Efl_Ui_Widget *wid[3]; 133 Efl_Ui_Widget *wid[3];
146 Efl_Ui_Widget *inv = create_test_widget(); 134 Efl_Ui_Widget *inv = create_test_widget();
147 135
148 _fill_array(wid);
149
150 for (int i = 0; i < 3; i++) 136 for (int i = 0; i < 3; i++)
151 efl_pack_end(widget, wid[i]); 137 {
138 wid[i] = create_test_widget();
139 efl_pack_end(widget, wid[i]);
140 }
152 141
153 ck_assert_int_eq(efl_pack_before(widget, inv, wid[0]), EINA_TRUE); 142 ck_assert_int_eq(efl_pack_before(widget, inv, wid[0]), EINA_TRUE);
154 ck_assert_ptr_eq(efl_test_parent_get(inv), widget); 143 ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
@@ -167,10 +156,11 @@ EFL_START_TEST(pack_before3)
167 Efl_Ui_Widget *inv = create_test_widget(); 156 Efl_Ui_Widget *inv = create_test_widget();
168 Efl_Ui_Widget *inv2 = create_test_widget(); 157 Efl_Ui_Widget *inv2 = create_test_widget();
169 158
170 _fill_array(wid);
171
172 for (int i = 0; i < 3; i++) 159 for (int i = 0; i < 3; i++)
173 efl_pack_end(widget, wid[i]); 160 {
161 wid[i] = create_test_widget();
162 efl_pack_end(widget, wid[i]);
163 }
174 164
175 EXPECT_ERROR_START; 165 EXPECT_ERROR_START;
176 ck_assert_int_eq(efl_pack_before(widget, inv, inv2), EINA_FALSE); 166 ck_assert_int_eq(efl_pack_before(widget, inv, inv2), EINA_FALSE);
@@ -187,10 +177,11 @@ EFL_START_TEST(pack_before4)
187 Efl_Ui_Widget *wid[3]; 177 Efl_Ui_Widget *wid[3];
188 Efl_Ui_Widget *inv = create_test_widget(); 178 Efl_Ui_Widget *inv = create_test_widget();
189 179
190 _fill_array(wid);
191
192 for (int i = 0; i < 3; i++) 180 for (int i = 0; i < 3; i++)
193 efl_pack_end(widget, wid[i]); 181 {
182 wid[i] = create_test_widget();
183 efl_pack_end(widget, wid[i]);
184 }
194 185
195 ck_assert_int_eq(efl_pack_before(widget, inv, NULL), EINA_TRUE); 186 ck_assert_int_eq(efl_pack_before(widget, inv, NULL), EINA_TRUE);
196 ck_assert_ptr_eq(efl_pack_content_get(widget, 0), inv); 187 ck_assert_ptr_eq(efl_pack_content_get(widget, 0), inv);
@@ -202,10 +193,11 @@ EFL_START_TEST(pack_after1)
202 Efl_Ui_Widget *wid[3]; 193 Efl_Ui_Widget *wid[3];
203 Efl_Ui_Widget *inv = create_test_widget(); 194 Efl_Ui_Widget *inv = create_test_widget();
204 195
205 _fill_array(wid);
206
207 for (int i = 0; i < 3; i++) 196 for (int i = 0; i < 3; i++)
208 efl_pack_end(widget, wid[i]); 197 {
198 wid[i] = create_test_widget();
199 efl_pack_end(widget, wid[i]);
200 }
209 201
210 ck_assert_int_eq(efl_pack_after(widget, inv, wid[0]), EINA_TRUE); 202 ck_assert_int_eq(efl_pack_after(widget, inv, wid[0]), EINA_TRUE);
211 ck_assert_ptr_eq(efl_test_parent_get(inv), widget); 203 ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
@@ -225,10 +217,11 @@ EFL_START_TEST(pack_after2)
225 Efl_Ui_Widget *wid[3]; 217 Efl_Ui_Widget *wid[3];
226 Efl_Ui_Widget *inv = create_test_widget(); 218 Efl_Ui_Widget *inv = create_test_widget();
227 219
228 _fill_array(wid);
229
230 for (int i = 0; i < 3; i++) 220 for (int i = 0; i < 3; i++)
231 efl_pack_end(widget, wid[i]); 221 {
222 wid[i] = create_test_widget();
223 efl_pack_end(widget, wid[i]);
224 }
232 225
233 ck_assert_int_eq(efl_pack_after(widget, inv, wid[0]), EINA_TRUE); 226 ck_assert_int_eq(efl_pack_after(widget, inv, wid[0]), EINA_TRUE);
234 ck_assert_ptr_eq(efl_test_parent_get(inv), widget); 227 ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
@@ -247,10 +240,11 @@ EFL_START_TEST(pack_after3)
247 Efl_Ui_Widget *inv = create_test_widget(); 240 Efl_Ui_Widget *inv = create_test_widget();
248 Efl_Ui_Widget *inv2 = create_test_widget(); 241 Efl_Ui_Widget *inv2 = create_test_widget();
249 242
250 _fill_array(wid);
251
252 for (int i = 0; i < 3; i++) 243 for (int i = 0; i < 3; i++)
253 efl_pack_end(widget, wid[i]); 244 {
245 wid[i] = create_test_widget();
246 efl_pack_end(widget, wid[i]);
247 }
254 248
255 EXPECT_ERROR_START; 249 EXPECT_ERROR_START;
256 ck_assert_int_eq(efl_pack_after(widget, inv, inv2), EINA_FALSE); 250 ck_assert_int_eq(efl_pack_after(widget, inv, inv2), EINA_FALSE);
@@ -267,10 +261,11 @@ EFL_START_TEST(pack_after4)
267 Efl_Ui_Widget *wid[3]; 261 Efl_Ui_Widget *wid[3];
268 Efl_Ui_Widget *inv = create_test_widget(); 262 Efl_Ui_Widget *inv = create_test_widget();
269 263
270 _fill_array(wid);
271
272 for (int i = 0; i < 3; i++) 264 for (int i = 0; i < 3; i++)
273 efl_pack_end(widget, wid[i]); 265 {
266 wid[i] = create_test_widget();
267 efl_pack_end(widget, wid[i]);
268 }
274 269
275 ck_assert_int_eq(efl_pack_after(widget, inv, NULL), EINA_TRUE); 270 ck_assert_int_eq(efl_pack_after(widget, inv, NULL), EINA_TRUE);
276 ck_assert_ptr_eq(efl_pack_content_get(widget, 3), inv); 271 ck_assert_ptr_eq(efl_pack_content_get(widget, 3), inv);
@@ -285,9 +280,11 @@ EFL_START_TEST(pack_at1)
285 Efl_Ui_Widget *inv = create_test_widget(); 280 Efl_Ui_Widget *inv = create_test_widget();
286 unsigned int i; 281 unsigned int i;
287 282
288 _fill_array(wid);
289 for (int i = 0; i < 3; i++) 283 for (int i = 0; i < 3; i++)
290 efl_pack_end(widget, wid[i]); 284 {
285 wid[i] = create_test_widget();
286 efl_pack_end(widget, wid[i]);
287 }
291 288
292 efl_pack_at(widget, inv, x); 289 efl_pack_at(widget, inv, x);
293 ck_assert_ptr_eq(efl_test_parent_get(inv), widget); 290 ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
@@ -316,9 +313,11 @@ EFL_START_TEST(pack_at2)
316 Efl_Ui_Widget *inv = create_test_widget(); 313 Efl_Ui_Widget *inv = create_test_widget();
317 unsigned int i; 314 unsigned int i;
318 315
319 _fill_array(wid);
320 for (int i = 0; i < 3; i++) 316 for (int i = 0; i < 3; i++)
321 efl_pack_end(widget, wid[i]); 317 {
318 wid[i] = create_test_widget();
319 efl_pack_end(widget, wid[i]);
320 }
322 321
323 ck_assert_int_eq(efl_pack_at(widget, inv, x), EINA_TRUE); 322 ck_assert_int_eq(efl_pack_at(widget, inv, x), EINA_TRUE);
324 ck_assert_ptr_eq(efl_test_parent_get(inv), widget); 323 ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
@@ -350,9 +349,11 @@ EFL_START_TEST(pack_at3)
350 Efl_Ui_Widget *inv = create_test_widget(); 349 Efl_Ui_Widget *inv = create_test_widget();
351 Efl_Ui_Widget *inv2 = create_test_widget(); 350 Efl_Ui_Widget *inv2 = create_test_widget();
352 351
353 _fill_array(wid);
354 for (int i = 0; i < 3; i++) 352 for (int i = 0; i < 3; i++)
355 efl_pack_end(widget, wid[i]); 353 {
354 wid[i] = create_test_widget();
355 efl_pack_end(widget, wid[i]);
356 }
356 357
357 ck_assert_int_eq(efl_pack_at(widget, inv,-100000), EINA_TRUE); 358 ck_assert_int_eq(efl_pack_at(widget, inv,-100000), EINA_TRUE);
358 ck_assert_ptr_eq(efl_test_parent_get(inv), widget); 359 ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
@@ -366,20 +367,22 @@ EFL_END_TEST
366EFL_START_TEST(pack_content_get1) 367EFL_START_TEST(pack_content_get1)
367{ 368{
368 Efl_Ui_Widget *wid[3]; 369 Efl_Ui_Widget *wid[3];
369 370 int num_widgets = EINA_C_ARRAY_LENGTH(wid);
370 _fill_array(wid);
371 371
372 for (int i = 0; i < 3; i++) 372 for (int i = 0; i < 3; i++)
373 efl_pack_end(widget, wid[i]); 373 {
374 wid[i] = create_test_widget();
375 efl_pack_end(widget, wid[i]);
376 }
374 377
375 for (int i = -100000; i <= 100000; i++) 378 for (int i = -num_widgets - 1; i <= num_widgets + 1; i++)
376 { 379 {
377 if (i < -3) 380 if (i <= -num_widgets)
378 ck_assert_ptr_eq(efl_pack_content_get(widget, i), efl_pack_content_get(widget, 0)); 381 ck_assert_ptr_eq(efl_pack_content_get(widget, i), efl_pack_content_get(widget, 0));
379 else if (i >= -3 && i < 3) 382 else if (i >= num_widgets)
380 ck_assert_ptr_eq(efl_pack_content_get(widget, i), wid[(i + 3) % 3]);
381 else
382 ck_assert_ptr_eq(efl_pack_content_get(widget, i), efl_pack_content_get(widget, 2)); 383 ck_assert_ptr_eq(efl_pack_content_get(widget, i), efl_pack_content_get(widget, 2));
384 else
385 ck_assert_ptr_eq(efl_pack_content_get(widget, i), wid[(i + num_widgets) % num_widgets]);
383 } 386 }
384} 387}
385EFL_END_TEST 388EFL_END_TEST
@@ -389,9 +392,11 @@ EFL_START_TEST(pack_index_get1)
389 Efl_Ui_Widget *wid[3]; 392 Efl_Ui_Widget *wid[3];
390 Efl_Ui_Widget *inv = create_test_widget(); 393 Efl_Ui_Widget *inv = create_test_widget();
391 394
392 _fill_array(wid);
393 for (int i = 0; i < 3; i++) 395 for (int i = 0; i < 3; i++)
394 efl_pack_end(widget, wid[i]); 396 {
397 wid[i] = create_test_widget();
398 efl_pack_end(widget, wid[i]);
399 }
395 for (int i = 0; i < 3; i++) 400 for (int i = 0; i < 3; i++)
396 ck_assert_int_eq(efl_pack_index_get(widget, wid[i]), i); 401 ck_assert_int_eq(efl_pack_index_get(widget, wid[i]), i);
397 402
@@ -404,9 +409,11 @@ EFL_START_TEST(pack_unpack_at1)
404{ 409{
405 Efl_Ui_Widget *wid[3]; 410 Efl_Ui_Widget *wid[3];
406 411
407 _fill_array(wid);
408 for (int i = 0; i < 3; i++) 412 for (int i = 0; i < 3; i++)
409 efl_pack_end(widget, wid[i]); 413 {
414 wid[i] = create_test_widget();
415 efl_pack_end(widget, wid[i]);
416 }
410 for (int i = 0; i < 3; i++) 417 for (int i = 0; i < 3; i++)
411 ck_assert_int_eq(efl_pack_index_get(widget, wid[i]), i); 418 ck_assert_int_eq(efl_pack_index_get(widget, wid[i]), i);
412 419
@@ -427,9 +434,11 @@ EFL_START_TEST(pack_unpack_at2)
427{ 434{
428 Efl_Ui_Widget *wid[3]; 435 Efl_Ui_Widget *wid[3];
429 436
430 _fill_array(wid);
431 for (int i = 0; i < 3; i++) 437 for (int i = 0; i < 3; i++)
432 efl_pack_end(widget, wid[i]); 438 {
439 wid[i] = create_test_widget();
440 efl_pack_end(widget, wid[i]);
441 }
433 for (int i = 0; i < 3; i++) 442 for (int i = 0; i < 3; i++)
434 ck_assert_int_eq(efl_pack_index_get(widget, wid[i]), i); 443 ck_assert_int_eq(efl_pack_index_get(widget, wid[i]), i);
435 444
@@ -446,9 +455,11 @@ EFL_START_TEST(pack_unpack_at3)
446 { 455 {
447 Efl_Ui_Widget *wid[3]; 456 Efl_Ui_Widget *wid[3];
448 457
449 _fill_array(wid);
450 for (int i = 0; i < 3; i++) 458 for (int i = 0; i < 3; i++)
451 efl_pack_end(widget, wid[i]); 459 {
460 wid[i] = create_test_widget();
461 efl_pack_end(widget, wid[i]);
462 }
452 ck_assert_ptr_eq(efl_pack_unpack_at(widget, x), wid[(3+x)%3]); 463 ck_assert_ptr_eq(efl_pack_unpack_at(widget, x), wid[(3+x)%3]);
453 ck_assert_int_eq(efl_content_count(widget), 2); 464 ck_assert_int_eq(efl_content_count(widget), 2);
454 ck_assert_ptr_ne(efl_test_parent_get(wid[(3+x)%3]), widget); 465 ck_assert_ptr_ne(efl_test_parent_get(wid[(3+x)%3]), widget);
@@ -460,9 +471,10 @@ EFL_END_TEST
460void 471void
461object_setup(void) 472object_setup(void)
462{ 473{
463 if (efl_isa(widget, EFL_UI_GROUP_ITEM_CLASS)) 474 if (widget_klass == EFL_UI_GROUP_ITEM_CLASS)
464 { 475 {
465 Efl_Ui_Collection *collection = efl_add(EFL_UI_GRID_CLASS, win); 476 Efl_Ui_Collection *collection = collection_grid;
477 if (!collection) collection = efl_add(EFL_UI_GRID_CLASS, win);
466 efl_content_set(win, collection); 478 efl_content_set(win, collection);
467 efl_pack_end(collection, widget); 479 efl_pack_end(collection, widget);
468 } 480 }
diff --git a/src/tests/elementary/spec/efl_test_range_display.c b/src/tests/elementary/spec/efl_test_range_display.c
index f072e02..5704741 100644
--- a/src/tests/elementary/spec/efl_test_range_display.c
+++ b/src/tests/elementary/spec/efl_test_range_display.c
@@ -124,6 +124,10 @@ EFL_START_TEST (range_display_value_events)
124 changed = EINA_FALSE; 124 changed = EINA_FALSE;
125 min_reached = EINA_FALSE; 125 min_reached = EINA_FALSE;
126 max_reached = EINA_FALSE; 126 max_reached = EINA_FALSE;
127 efl_event_callback_del(widget, EFL_UI_RANGE_EVENT_CHANGED, _set_flag, &changed);
128 efl_event_callback_del(widget, EFL_UI_RANGE_EVENT_MIN_REACHED, _set_flag, &min_reached);
129 efl_event_callback_del(widget, EFL_UI_RANGE_EVENT_MAX_REACHED, _set_flag, &max_reached);
130
127} 131}
128EFL_END_TEST 132EFL_END_TEST
129 133
diff --git a/src/tests/elementary/spec/efl_ui_spec_suite.c b/src/tests/elementary/spec/efl_ui_spec_suite.c
index 50b32c3..49ca5a9 100644
--- a/src/tests/elementary/spec/efl_ui_spec_suite.c
+++ b/src/tests/elementary/spec/efl_ui_spec_suite.c
@@ -10,11 +10,17 @@
10 10
11Evas_Object *win = NULL; 11Evas_Object *win = NULL;
12Evas_Object *widget = NULL; 12Evas_Object *widget = NULL;
13Eo *collection_grid = NULL;
13const Efl_Class *test_content_klass = NULL; 14const Efl_Class *test_content_klass = NULL;
14EFL_CLASS_SIMPLE_CLASS(efl_ui_widget, "efl_ui_widget", EFL_UI_WIDGET_CLASS); 15const Efl_Class *widget_klass = NULL;
15EFL_CLASS_SIMPLE_CLASS(efl_ui_item, "efl_ui_item", EFL_UI_ITEM_CLASS); 16EFL_CLASS_SIMPLE_CLASS(efl_ui_widget, "Efl.Ui.Widget", EFL_UI_WIDGET_CLASS);
17EFL_CLASS_SIMPLE_CLASS(efl_ui_item, "Efl.Ui.Item", EFL_UI_ITEM_CLASS);
16#define EFL_UI_ITEM_REALIZED_CLASS efl_ui_item_realized_class_get() 18#define EFL_UI_ITEM_REALIZED_CLASS efl_ui_item_realized_class_get()
17 19
20
21#define NUM_TEST_WIDGETS 30
22static Eina_Hash *test_widgets;
23
18static void 24static void
19_setup_window_and_widget(const Efl_Class *klass, const Efl_Class *content_klass) 25_setup_window_and_widget(const Efl_Class *klass, const Efl_Class *content_klass)
20{ 26{
@@ -22,30 +28,56 @@ _setup_window_and_widget(const Efl_Class *klass, const Efl_Class *content_klass)
22 ck_assert(!widget); 28 ck_assert(!widget);
23 29
24 test_content_klass = content_klass; 30 test_content_klass = content_klass;
31 widget_klass = klass;
25 win = win_add(); 32 win = win_add();
26 widget = efl_add(klass, win); 33 widget = efl_add(klass, win);
27 efl_content_set(win, widget); 34 ck_assert(efl_content_set(win, widget));
28 35
29 ck_assert(win); 36 ck_assert(win);
30 ck_assert(widget); 37 ck_assert(widget);
31} 38 efl_wref_add(widget, &widget);
32 39 efl_wref_add(win, &win);
33static void
34_shutdown_fixture(void)
35{
36 //We just NULL them out, shutdown will delete them
37 win = NULL;
38 widget = NULL;
39} 40}
40 41
41Eo* 42Eo*
42create_test_widget(void) 43create_test_widget(void)
43{ 44{
45 static unsigned int i;
46
47 if (is_forked())
48 {
49 Eo **widgets = eina_hash_find(test_widgets, &test_content_klass);
50 ck_assert_int_lt(i, NUM_TEST_WIDGETS);
51 ck_assert(widgets[i]);
52 return widgets[i++];
53 }
44 Eo *ret = efl_add(test_content_klass, win); 54 Eo *ret = efl_add(test_content_klass, win);
45 55
46 return ret; 56 return ret;
47} 57}
48 58
59static void
60spec_suite_setup(Eo *global_win)
61{
62 const Efl_Class *test_classes[] =
63 {
64 EFL_UI_GRID_DEFAULT_ITEM_CLASS,
65 EFL_UI_LIST_DEFAULT_ITEM_CLASS,
66 EFL_UI_RADIO_CLASS,
67 EFL_UI_TAB_BAR_DEFAULT_ITEM_CLASS,
68 WIDGET_CLASS
69 };
70 collection_grid = efl_add(EFL_UI_GRID_CLASS, global_win);
71 test_widgets = eina_hash_pointer_new(NULL);
72 for (unsigned int t = 0; t < EINA_C_ARRAY_LENGTH(test_classes); t++)
73 {
74 Eo **widgets = malloc(NUM_TEST_WIDGETS * sizeof(void*));
75 for (unsigned int i = 0; i < NUM_TEST_WIDGETS; i++)
76 efl_wref_add(efl_add(test_classes[t], global_win), &widgets[i]);
77 eina_hash_set(test_widgets, &test_classes[t], widgets);
78 }
79}
80
49#include "efl_ui_spec_suite_gen.x" 81#include "efl_ui_spec_suite_gen.x"
50int 82int
51main(int argc, char **argv) 83main(int argc, char **argv)
@@ -58,6 +90,8 @@ main(int argc, char **argv)
58 if (!_efl_test_option_disp(argc, argv, etc)) 90 if (!_efl_test_option_disp(argc, argv, etc))
59 return 0; 91 return 0;
60 92
93 suite_setup_cb_set(spec_suite_setup);
94
61 failed_count = suite_setup(EINA_FALSE); 95 failed_count = suite_setup(EINA_FALSE);
62 96
63 failed_count += _efl_suite_build_and_run(argc - 1, (const char **)argv + 1, 97 failed_count += _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
diff --git a/src/tests/elementary/spec/efl_ui_spec_suite.h b/src/tests/elementary/spec/efl_ui_spec_suite.h
index 63c8b2c..463f44d 100644
--- a/src/tests/elementary/spec/efl_ui_spec_suite.h
+++ b/src/tests/elementary/spec/efl_ui_spec_suite.h
@@ -9,6 +9,8 @@
9 9
10extern Eo *win; 10extern Eo *win;
11extern Eo *widget; 11extern Eo *widget;
12extern Eo *collection_grid;
13extern const Efl_Class *widget_klass;
12 14
13void efl_pack_behavior_test(TCase *tc); 15void efl_pack_behavior_test(TCase *tc);
14void efl_pack_linear_behavior_test(TCase *tc); 16void efl_pack_linear_behavior_test(TCase *tc);
diff --git a/src/tests/elementary/spec/generator.py b/src/tests/elementary/spec/generator.py
index daf2e61..f831654 100755
--- a/src/tests/elementary/spec/generator.py
+++ b/src/tests/elementary/spec/generator.py
@@ -12,7 +12,7 @@ tcase_gen_template = """
12static void 12static void
13{}(TCase *tc) 13{}(TCase *tc)
14{{ 14{{
15 tcase_add_checked_fixture(tc, _{}_fixture, _shutdown_fixture); 15 tcase_add_checked_fixture(tc, _{}_fixture, NULL);
16 tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown); 16 tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
17 {}(tc); 17 {}(tc);
18}} 18}}
diff --git a/src/tests/elementary/spec/meson.build b/src/tests/elementary/spec/meson.build
index 8b28e2c..e0a5a3c 100644
--- a/src/tests/elementary/spec/meson.build
+++ b/src/tests/elementary/spec/meson.build
@@ -44,5 +44,6 @@ efl_ui_behavior_suite = executable('efl_ui_spec_suite',
44) 44)
45 45
46test('efl_ui_spec-suite', efl_ui_behavior_suite, 46test('efl_ui_spec-suite', efl_ui_behavior_suite,
47 env : test_env 47 env : test_env,
48 timeout: 60
48) 49)
diff --git a/src/tests/elementary/suite_helpers.c b/src/tests/elementary/suite_helpers.c
index a109f83..53c473a 100644
--- a/src/tests/elementary/suite_helpers.c
+++ b/src/tests/elementary/suite_helpers.c
@@ -24,18 +24,17 @@ Eina_Bool abort_on_warnings = EINA_FALSE;
24 24
25void elm_test_init(TCase *tc); 25void elm_test_init(TCase *tc);
26 26
27static char *args[] = { "exe" };
28
27SUITE_INIT(elm) 29SUITE_INIT(elm)
28{ 30{
29 char *args[] = { "exe" };
30 ck_assert_int_eq(elm_init(1, args), 1); 31 ck_assert_int_eq(elm_init(1, args), 1);
31} 32}
32 33
33void 34void
34_elm2_suite_init(void) 35_elm2_suite_init(void)
35{ 36{
36 char *args[] = { "exe" }; 37 if (is_forked())
37
38 if (getpid() != main_pid)
39 { 38 {
40 if (abort_on_warnings) 39 if (abort_on_warnings)
41 fail_on_errors_setup(); 40 fail_on_errors_setup();
@@ -60,7 +59,7 @@ _elm_suite_shutdown(void)
60 /* verify that ecore was de-initialized completely */ 59 /* verify that ecore was de-initialized completely */
61 ck_assert_int_eq(ecore_init(), 1); 60 ck_assert_int_eq(ecore_init(), 1);
62 /* avoid slowdowns in fork mode */ 61 /* avoid slowdowns in fork mode */
63 if (getpid() != main_pid) return; 62 if (is_forked()) return;
64 ck_assert_int_eq(ecore_shutdown(), 0); 63 ck_assert_int_eq(ecore_shutdown(), 0);
65} 64}
66 65
@@ -237,7 +236,7 @@ win_add(void)
237 evas_font_path_global_append(TEST_FONT_DIR); 236 evas_font_path_global_append(TEST_FONT_DIR);
238 font_path = EINA_TRUE; 237 font_path = EINA_TRUE;
239 } 238 }
240 if (getpid() != main_pid) 239 if (is_forked())
241 { 240 {
242 if (global_win) return global_win; 241 if (global_win) return global_win;
243 } 242 }
@@ -262,7 +261,7 @@ win_add_focused()
262{ 261{
263 Evas_Object *win; 262 Evas_Object *win;
264 263
265 if (getpid() != main_pid) 264 if (is_forked())
266 { 265 {
267 if (global_win) return global_win; 266 if (global_win) return global_win;
268 } 267 }
@@ -272,6 +271,26 @@ win_add_focused()
272 return win; 271 return win;
273} 272}
274 273
274Eina_Bool
275is_forked(void)
276{
277 return getpid() != main_pid;
278}
279
280Eina_Bool
281is_buffer(void)
282{
283 return buffer;
284}
285
286static void (*suite_setup_cb)(Eo*);
287
288void
289suite_setup_cb_set(void (*cb)(Eo*))
290{
291 suite_setup_cb = cb;
292}
293
275int 294int
276suite_setup(Eina_Bool legacy) 295suite_setup(Eina_Bool legacy)
277{ 296{
@@ -306,6 +325,7 @@ suite_setup(Eina_Bool legacy)
306 { 325 {
307 global_win = _elm_suite_win_create(); 326 global_win = _elm_suite_win_create();
308 force_focus_win(global_win); 327 force_focus_win(global_win);
328 if (suite_setup_cb) suite_setup_cb(global_win);
309 } 329 }
310 EINA_SAFETY_ON_TRUE_RETURN_VAL(failed_count, 255); 330 EINA_SAFETY_ON_TRUE_RETURN_VAL(failed_count, 255);
311 /* preload default theme */ 331 /* preload default theme */
@@ -430,23 +450,29 @@ attempt_to_find_the_right_point_for_mouse_positioning(Eo *obj, int dir)
430} 450}
431 451
432static void 452static void
433click_object_internal(Eo *obj, int dir) 453click_object_internal(Eo *obj, int dir, int flags)
434{ 454{
435 Evas *e = evas_object_evas_get(obj); 455 Evas *e = evas_object_evas_get(obj);
436 Eina_Position2D pos = attempt_to_find_the_right_point_for_mouse_positioning(obj, dir); 456 Eina_Position2D pos = attempt_to_find_the_right_point_for_mouse_positioning(obj, dir);
437 evas_event_feed_mouse_move(e, pos.x, pos.y, 0, NULL); 457 evas_event_feed_mouse_move(e, pos.x, pos.y, 0, NULL);
438 evas_event_feed_mouse_down(e, 1, 0, 0, NULL); 458 evas_event_feed_mouse_down(e, 1, flags, 0, NULL);
439 evas_event_feed_mouse_up(e, 1, 0, 0, NULL); 459 evas_event_feed_mouse_up(e, 1, 0, 0, NULL);
440} 460}
441 461
442void 462void
443click_object(Eo *obj) 463click_object(Eo *obj)
444{ 464{
445 click_object_internal(obj, NONE); 465 click_object_internal(obj, NONE, 0);
446} 466}
447 467
448void 468void
449click_part(Eo *obj, const char *part) 469click_object_flags(Eo *obj, int flags)
470{
471 click_object_internal(obj, NONE, flags);
472}
473
474void
475click_part_flags(Eo *obj, const char *part, int flags)
450{ 476{
451 Efl_Part *part_obj = efl_ref(efl_part(obj, part)); 477 Efl_Part *part_obj = efl_ref(efl_part(obj, part));
452 Eo *content; 478 Eo *content;
@@ -466,13 +492,19 @@ click_part(Eo *obj, const char *part)
466 else if (strstr(part, "bottom")) 492 else if (strstr(part, "bottom"))
467 dir |= BOTTOM; 493 dir |= BOTTOM;
468 } 494 }
469 click_object_internal(content, dir); 495 click_object_internal(content, dir, flags);
470 if (efl_isa(content, EFL_LAYOUT_SIGNAL_INTERFACE)) 496 if (efl_isa(content, EFL_LAYOUT_SIGNAL_INTERFACE))
471 edje_object_message_signal_process(content); 497 edje_object_message_signal_process(content);
472 edje_object_message_signal_process(obj); 498 edje_object_message_signal_process(obj);
473 efl_unref(part_obj); 499 efl_unref(part_obj);
474} 500}
475 501
502void
503click_part(Eo *obj, const char *part)
504{
505 click_part_flags(obj, part, 0);
506}
507
476static void 508static void
477wheel_object_internal(Eo *obj, int dir, Eina_Bool horiz, Eina_Bool down) 509wheel_object_internal(Eo *obj, int dir, Eina_Bool horiz, Eina_Bool down)
478{ 510{
@@ -524,6 +556,14 @@ event_callback_single_call_int_data(void *data, Evas_Object *obj EINA_UNUSED, vo
524} 556}
525 557
526void 558void
559event_callback_that_increments_an_int_when_called(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
560{
561 int *called = data;
562
563 *called += 1;
564}
565
566void
527event_callback_that_quits_the_main_loop_when_called() 567event_callback_that_quits_the_main_loop_when_called()
528{ 568{
529 ecore_main_loop_quit(); 569 ecore_main_loop_quit();
@@ -539,9 +579,42 @@ click_object_at(Eo *obj, int x, int y)
539} 579}
540 580
541void 581void
582click_object_at_flags(Eo *obj, int x, int y, int flags)
583{
584 Evas *e = evas_object_evas_get(obj);
585 evas_event_feed_mouse_move(e, x, y, 0, NULL);
586 evas_event_feed_mouse_down(e, 1, flags, 0, NULL);
587 evas_event_feed_mouse_up(e, 1, 0, 0, NULL);
588}
589
590void
542wheel_object_at(Eo *obj, int x, int y, Eina_Bool horiz, Eina_Bool down) 591wheel_object_at(Eo *obj, int x, int y, Eina_Bool horiz, Eina_Bool down)
543{ 592{
544 Evas *e = evas_object_evas_get(obj); 593 Evas *e = evas_object_evas_get(obj);
545 evas_event_feed_mouse_move(e, x, y, 0, NULL); 594 evas_event_feed_mouse_move(e, x, y, 0, NULL);
546 evas_event_feed_mouse_wheel(e, horiz, down, 0, NULL); 595 evas_event_feed_mouse_wheel(e, horiz, down, 0, NULL);
547} 596}
597
598void
599drag_object(Eo *obj, int x, int y, int dx, int dy, Eina_Bool iterate)
600{
601 Evas *e = evas_object_evas_get(obj);
602 int i;
603 evas_event_feed_mouse_move(e, x, y, 0, NULL);
604 evas_event_feed_mouse_down(e, 1, 0, 0, NULL);
605 if (iterate)
606 {
607 /* iterate twice to trigger timers */
608 ecore_main_loop_iterate();
609 ecore_main_loop_iterate();
610 }
611 /* create DRAG_OBJECT_NUM_MOVES move events distinct from up/down */
612 for (i = 0; i < DRAG_OBJECT_NUM_MOVES; i++)
613 {
614 evas_event_feed_mouse_move(e, x + (i * dx / DRAG_OBJECT_NUM_MOVES), y + (i * dy / DRAG_OBJECT_NUM_MOVES), 0, NULL);
615 /* also trigger smart calc if we're iterating just in case that's important */
616 evas_smart_objects_calculate(e);
617 }
618 evas_event_feed_mouse_move(e, x + dx, y + dy, 0, NULL);
619 evas_event_feed_mouse_up(e, 1, 0, 0, NULL);
620}
diff --git a/src/tests/elementary/suite_helpers.h b/src/tests/elementary/suite_helpers.h
index d0ada37..40c8dec 100644
--- a/src/tests/elementary/suite_helpers.h
+++ b/src/tests/elementary/suite_helpers.h
@@ -3,20 +3,30 @@
3 3
4#include <Evas.h> 4#include <Evas.h>
5 5
6#define DRAG_OBJECT_NUM_MOVES 4
7
6int suite_setup(Eina_Bool legacy); 8int suite_setup(Eina_Bool legacy);
7void _elm2_suite_init(void); 9void _elm2_suite_init(void);
8void _elm_suite_shutdown(void); 10void _elm_suite_shutdown(void);
9void *real_timer_add(double in, Ecore_Task_Cb cb, void *data); 11void *real_timer_add(double in, Ecore_Task_Cb cb, void *data);
10void fail_on_errors_teardown(void); 12void fail_on_errors_teardown(void);
11void fail_on_errors_setup(void); 13void fail_on_errors_setup(void);
14Eina_Bool is_forked(void);
15Eina_Bool is_buffer(void);
16void suite_setup_cb_set(void (*cb)(Eo*));
12 17
13void get_me_to_those_events(Eo *obj); 18void get_me_to_those_events(Eo *obj);
14void click_object(Eo *obj); 19void click_object(Eo *obj);
20void click_object_flags(Eo *obj, int flags);
15void click_part(Eo *obj, const char *part); 21void click_part(Eo *obj, const char *part);
22void click_part_flags(Eo *obj, const char *part, int flags);
16void click_object_at(Eo *obj, int x, int y); 23void click_object_at(Eo *obj, int x, int y);
24void click_object_at_flags(Eo *obj, int x, int y, int flags);
25void drag_object(Eo *obj, int x, int y, int dx, int dy, Eina_Bool iterate);
17void wheel_object(Eo *obj, Eina_Bool horiz, Eina_Bool down); 26void wheel_object(Eo *obj, Eina_Bool horiz, Eina_Bool down);
18void wheel_part(Eo *obj, const char *part, Eina_Bool horiz, Eina_Bool down); 27void wheel_part(Eo *obj, const char *part, Eina_Bool horiz, Eina_Bool down);
19void wheel_object_at(Eo *obj, int x, int y, Eina_Bool horiz, Eina_Bool down); 28void wheel_object_at(Eo *obj, int x, int y, Eina_Bool horiz, Eina_Bool down);
20void event_callback_single_call_int_data(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); 29void event_callback_single_call_int_data(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
21void event_callback_that_quits_the_main_loop_when_called(); 30void event_callback_that_quits_the_main_loop_when_called();
31void event_callback_that_increments_an_int_when_called(void *data, Evas_Object *obj, void *event_info);
22#endif 32#endif