summaryrefslogtreecommitdiff
path: root/src/tests/elementary/spec
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/elementary/spec')
-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
13 files changed, 286 insertions, 129 deletions
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)