summaryrefslogtreecommitdiff
path: root/src/tests/elementary
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-24 15:41:39 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-26 12:06:02 +0200
commit7aa9ea071a231896a545f496acf7f43ac695d811 (patch)
treee2ca2bb96eea56add0aa9f5b4b2a59c938d20d7b /src/tests/elementary
parentf3b9f7f0d8aee9bee9d9b16221a0477e21e23712 (diff)
efl_pack: split algin and padding property
the pack interface is a general interface for how we pack things into a container. the align and padding property has less to nothing to do with this. Hence this commit splits the two properties into theire own interface. fix T7825 Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es> Differential Revision: https://phab.enlightenment.org/D8699
Diffstat (limited to 'src/tests/elementary')
-rw-r--r--src/tests/elementary/efl_ui_test_box.c24
-rw-r--r--src/tests/elementary/efl_ui_test_box_flow.c2
-rw-r--r--src/tests/elementary/efl_ui_test_box_stack.c2
-rw-r--r--src/tests/elementary/efl_ui_test_table.c28
-rw-r--r--src/tests/elementary/spec/efl_test_gfx_arrangement.c61
-rw-r--r--src/tests/elementary/spec/efl_test_pack.c44
-rw-r--r--src/tests/elementary/spec/efl_ui_spec_suite.h1
-rw-r--r--src/tests/elementary/spec/meson.build1
8 files changed, 91 insertions, 72 deletions
diff --git a/src/tests/elementary/efl_ui_test_box.c b/src/tests/elementary/efl_ui_test_box.c
index ca9b0c134e..a0fcb141ec 100644
--- a/src/tests/elementary/efl_ui_test_box.c
+++ b/src/tests/elementary/efl_ui_test_box.c
@@ -252,7 +252,7 @@ EFL_START_TEST (efl_ui_box_layout_update)
252{ 252{
253 int i, max_index = (sizeof(hints) / sizeof(Hint)); 253 int i, max_index = (sizeof(hints) / sizeof(Hint));
254 254
255 efl_pack_align_set(layout, 0.8, 0.2); 255 efl_gfx_arrangement_content_align_set(layout, 0.8, 0.2);
256 efl_ui_direction_set(layout, EFL_UI_DIR_VERTICAL); 256 efl_ui_direction_set(layout, EFL_UI_DIR_VERTICAL);
257 257
258 Eo *btn = efl_add(EFL_UI_BUTTON_CLASS, layout, 258 Eo *btn = efl_add(EFL_UI_BUTTON_CLASS, layout,
@@ -271,7 +271,7 @@ EFL_START_TEST (efl_ui_box_layout_update_pack)
271 int i, max_index2, max_index3; 271 int i, max_index2, max_index3;
272 Eo *btn, *btn2, *btn3; 272 Eo *btn, *btn2, *btn3;
273 273
274 efl_pack_align_set(layout, 0.8, 0.2); 274 efl_gfx_arrangement_content_align_set(layout, 0.8, 0.2);
275 efl_ui_direction_set(layout, EFL_UI_DIR_VERTICAL); 275 efl_ui_direction_set(layout, EFL_UI_DIR_VERTICAL);
276 276
277 max_index2 = ((sizeof(hints2) / sizeof(Hint)) / 2); 277 max_index2 = ((sizeof(hints2) / sizeof(Hint)) / 2);
@@ -502,34 +502,34 @@ EFL_START_TEST (efl_ui_box_properties)
502 Eina_Bool b; 502 Eina_Bool b;
503 503
504 //align test 504 //align test
505 efl_pack_align_get(layout, &h, &v); 505 efl_gfx_arrangement_content_align_get(layout, &h, &v);
506 ck_assert(EINA_DBL_EQ(h, 0.5)); 506 ck_assert(EINA_DBL_EQ(h, 0.5));
507 ck_assert(EINA_DBL_EQ(v, 0.5)); 507 ck_assert(EINA_DBL_EQ(v, 0.5));
508 508
509 efl_pack_align_set(layout, 0.3, 0.8234); 509 efl_gfx_arrangement_content_align_set(layout, 0.3, 0.8234);
510 efl_pack_align_get(layout, &h, &v); 510 efl_gfx_arrangement_content_align_get(layout, &h, &v);
511 ck_assert(EINA_DBL_EQ(h, 0.3)); 511 ck_assert(EINA_DBL_EQ(h, 0.3));
512 ck_assert(EINA_DBL_EQ(v, 0.8234)); 512 ck_assert(EINA_DBL_EQ(v, 0.8234));
513 513
514 efl_pack_align_set(layout, -0.23, 123); 514 efl_gfx_arrangement_content_align_set(layout, -0.23, 123);
515 efl_pack_align_get(layout, &h, &v); 515 efl_gfx_arrangement_content_align_get(layout, &h, &v);
516 ck_assert(EINA_DBL_EQ(h, -1)); 516 ck_assert(EINA_DBL_EQ(h, -1));
517 ck_assert(EINA_DBL_EQ(v, 1)); 517 ck_assert(EINA_DBL_EQ(v, 1));
518 518
519 //padding test 519 //padding test
520 efl_pack_padding_get(layout, &h, &v, &b); 520 efl_gfx_arrangement_content_padding_get(layout, &h, &v, &b);
521 ck_assert(EINA_DBL_EQ(h, 0.0)); 521 ck_assert(EINA_DBL_EQ(h, 0.0));
522 ck_assert(EINA_DBL_EQ(v, 0.0)); 522 ck_assert(EINA_DBL_EQ(v, 0.0));
523 ck_assert_int_eq(b, 0); 523 ck_assert_int_eq(b, 0);
524 524
525 efl_pack_padding_set(layout, 0.3, 0.8234, 1); 525 efl_gfx_arrangement_content_padding_set(layout, 0.3, 0.8234, 1);
526 efl_pack_padding_get(layout, &h, &v, &b); 526 efl_gfx_arrangement_content_padding_get(layout, &h, &v, &b);
527 ck_assert(EINA_DBL_EQ(h, 0.3)); 527 ck_assert(EINA_DBL_EQ(h, 0.3));
528 ck_assert(EINA_DBL_EQ(v, 0.8234)); 528 ck_assert(EINA_DBL_EQ(v, 0.8234));
529 ck_assert_int_eq(b, 1); 529 ck_assert_int_eq(b, 1);
530 530
531 efl_pack_padding_set(layout, -1.23, 123, 45); 531 efl_gfx_arrangement_content_padding_set(layout, -1.23, 123, 45);
532 efl_pack_padding_get(layout, &h, &v, &b); 532 efl_gfx_arrangement_content_padding_get(layout, &h, &v, &b);
533 ck_assert(EINA_DBL_EQ(h, 0)); 533 ck_assert(EINA_DBL_EQ(h, 0));
534 ck_assert(EINA_DBL_EQ(v, 123)); 534 ck_assert(EINA_DBL_EQ(v, 123));
535 ck_assert_int_eq(b, 1); 535 ck_assert_int_eq(b, 1);
diff --git a/src/tests/elementary/efl_ui_test_box_flow.c b/src/tests/elementary/efl_ui_test_box_flow.c
index 4b4c7a0152..d8ec8b25fa 100644
--- a/src/tests/elementary/efl_ui_test_box_flow.c
+++ b/src/tests/elementary/efl_ui_test_box_flow.c
@@ -224,7 +224,7 @@ layout_setup()
224 win = win_add(); 224 win = win_add();
225 225
226 layout = efl_add(EFL_UI_BOX_FLOW_CLASS, win, 226 layout = efl_add(EFL_UI_BOX_FLOW_CLASS, win,
227 efl_pack_align_set(efl_added, 0.8, 0.2), 227 efl_gfx_arrangement_content_align_set(efl_added, 0.8, 0.2),
228 efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL)); 228 efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL));
229} 229}
230 230
diff --git a/src/tests/elementary/efl_ui_test_box_stack.c b/src/tests/elementary/efl_ui_test_box_stack.c
index dccbe1fa2c..e025ed5228 100644
--- a/src/tests/elementary/efl_ui_test_box_stack.c
+++ b/src/tests/elementary/efl_ui_test_box_stack.c
@@ -133,7 +133,7 @@ layout_setup()
133 win = win_add(); 133 win = win_add();
134 134
135 layout = efl_add(EFL_UI_BOX_STACK_CLASS, win, 135 layout = efl_add(EFL_UI_BOX_STACK_CLASS, win,
136 efl_pack_align_set(efl_added, 0.8, 0.2), 136 efl_gfx_arrangement_content_align_set(efl_added, 0.8, 0.2),
137 efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL)); 137 efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL));
138} 138}
139 139
diff --git a/src/tests/elementary/efl_ui_test_table.c b/src/tests/elementary/efl_ui_test_table.c
index 0762528641..476be61159 100644
--- a/src/tests/elementary/efl_ui_test_table.c
+++ b/src/tests/elementary/efl_ui_test_table.c
@@ -279,7 +279,7 @@ EFL_START_TEST (efl_ui_table_layout_update)
279{ 279{
280 int i, max_index = (sizeof(hints) / sizeof(Hint)); 280 int i, max_index = (sizeof(hints) / sizeof(Hint));
281 281
282 efl_pack_align_set(layout, 0.8, 0.2); 282 efl_gfx_arrangement_content_align_set(layout, 0.8, 0.2);
283 efl_ui_direction_set(layout, EFL_UI_DIR_VERTICAL); 283 efl_ui_direction_set(layout, EFL_UI_DIR_VERTICAL);
284 284
285 Eo *btn = efl_add(EFL_UI_BUTTON_CLASS, layout, 285 Eo *btn = efl_add(EFL_UI_BUTTON_CLASS, layout,
@@ -298,7 +298,7 @@ EFL_START_TEST (efl_ui_table_layout_update_pack)
298 int i, max_index2, max_index3; 298 int i, max_index2, max_index3;
299 Eo *btn, *btn2, *btn3; 299 Eo *btn, *btn2, *btn3;
300 300
301 efl_pack_align_set(layout, 0.8, 0.2); 301 efl_gfx_arrangement_content_align_set(layout, 0.8, 0.2);
302 efl_ui_direction_set(layout, EFL_UI_DIR_VERTICAL); 302 efl_ui_direction_set(layout, EFL_UI_DIR_VERTICAL);
303 303
304 max_index2 = ((sizeof(hints2) / sizeof(Hint)) / 2); 304 max_index2 = ((sizeof(hints2) / sizeof(Hint)) / 2);
@@ -337,12 +337,12 @@ EFL_START_TEST (efl_ui_table_layout_update_matrix)
337 int i, j, max_index = (sizeof(hints_matrix) / sizeof(Hint)); 337 int i, j, max_index = (sizeof(hints_matrix) / sizeof(Hint));
338 Eo *btn[9]; 338 Eo *btn[9];
339 339
340 efl_pack_align_set(layout, 0.8, 0.2); 340 efl_gfx_arrangement_content_align_set(layout, 0.8, 0.2);
341 efl_ui_direction_set(layout, EFL_UI_DIR_VERTICAL); 341 efl_ui_direction_set(layout, EFL_UI_DIR_VERTICAL);
342 342
343 efl_gfx_hint_margin_set(layout, 10, 10, 20, 20); 343 efl_gfx_hint_margin_set(layout, 10, 10, 20, 20);
344 efl_ui_table_homogeneous_set(layout, 0, 1); 344 efl_ui_table_homogeneous_set(layout, 0, 1);
345 efl_pack_padding_set(layout, 10, 5, 0); 345 efl_gfx_arrangement_content_padding_set(layout, 10, 5, 0);
346 346
347 for (i = 0; i < 3; i++) 347 for (i = 0; i < 3; i++)
348 { 348 {
@@ -491,34 +491,34 @@ EFL_START_TEST (efl_ui_table_properties)
491 Efl_Ui_Dir dirh, dirv; 491 Efl_Ui_Dir dirh, dirv;
492 492
493 //align test 493 //align test
494 efl_pack_align_get(layout, &h, &v); 494 efl_gfx_arrangement_content_align_get(layout, &h, &v);
495 ck_assert(EINA_DBL_EQ(h, 0.5)); 495 ck_assert(EINA_DBL_EQ(h, 0.5));
496 ck_assert(EINA_DBL_EQ(v, 0.5)); 496 ck_assert(EINA_DBL_EQ(v, 0.5));
497 497
498 efl_pack_align_set(layout, 0.3, 0.8234); 498 efl_gfx_arrangement_content_align_set(layout, 0.3, 0.8234);
499 efl_pack_align_get(layout, &h, &v); 499 efl_gfx_arrangement_content_align_get(layout, &h, &v);
500 ck_assert(EINA_DBL_EQ(h, 0.3)); 500 ck_assert(EINA_DBL_EQ(h, 0.3));
501 ck_assert(EINA_DBL_EQ(v, 0.8234)); 501 ck_assert(EINA_DBL_EQ(v, 0.8234));
502 502
503 efl_pack_align_set(layout, -0.23, 123); 503 efl_gfx_arrangement_content_align_set(layout, -0.23, 123);
504 efl_pack_align_get(layout, &h, &v); 504 efl_gfx_arrangement_content_align_get(layout, &h, &v);
505 ck_assert(EINA_DBL_EQ(h, -1)); 505 ck_assert(EINA_DBL_EQ(h, -1));
506 ck_assert(EINA_DBL_EQ(v, 1)); 506 ck_assert(EINA_DBL_EQ(v, 1));
507 507
508 //padding test 508 //padding test
509 efl_pack_padding_get(layout, &h, &v, &b); 509 efl_gfx_arrangement_content_padding_get(layout, &h, &v, &b);
510 ck_assert(EINA_DBL_EQ(h, 0.0)); 510 ck_assert(EINA_DBL_EQ(h, 0.0));
511 ck_assert(EINA_DBL_EQ(v, 0.0)); 511 ck_assert(EINA_DBL_EQ(v, 0.0));
512 ck_assert_int_eq(b, 0); 512 ck_assert_int_eq(b, 0);
513 513
514 efl_pack_padding_set(layout, 0.3, 0.8234, 1); 514 efl_gfx_arrangement_content_padding_set(layout, 0.3, 0.8234, 1);
515 efl_pack_padding_get(layout, &h, &v, &b); 515 efl_gfx_arrangement_content_padding_get(layout, &h, &v, &b);
516 ck_assert(EINA_DBL_EQ(h, 0.3)); 516 ck_assert(EINA_DBL_EQ(h, 0.3));
517 ck_assert(EINA_DBL_EQ(v, 0.8234)); 517 ck_assert(EINA_DBL_EQ(v, 0.8234));
518 ck_assert_int_eq(b, 1); 518 ck_assert_int_eq(b, 1);
519 519
520 efl_pack_padding_set(layout, -1.23, 123, 45); 520 efl_gfx_arrangement_content_padding_set(layout, -1.23, 123, 45);
521 efl_pack_padding_get(layout, &h, &v, &b); 521 efl_gfx_arrangement_content_padding_get(layout, &h, &v, &b);
522 ck_assert(EINA_DBL_EQ(h, 0)); 522 ck_assert(EINA_DBL_EQ(h, 0));
523 ck_assert(EINA_DBL_EQ(v, 123)); 523 ck_assert(EINA_DBL_EQ(v, 123));
524 ck_assert_int_eq(b, 1); 524 ck_assert_int_eq(b, 1);
diff --git a/src/tests/elementary/spec/efl_test_gfx_arrangement.c b/src/tests/elementary/spec/efl_test_gfx_arrangement.c
new file mode 100644
index 0000000000..ba213a51b7
--- /dev/null
+++ b/src/tests/elementary/spec/efl_test_gfx_arrangement.c
@@ -0,0 +1,61 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Efl_Ui.h>
6#include "efl_ui_spec_suite.h"
7#include "suite_helpers.h"
8
9/* spec-meta-start
10 {"test-interface":"Efl.Gfx.Arrangement",
11 "test-widgets": ["Efl.Ui.Box", "Efl.Ui.Table"]}
12 spec-meta-end */
13
14EFL_START_TEST(pack_align)
15{
16#define TUPLE_CHECK(H,V,rh,rv) \
17 do { \
18 double v, h; \
19 efl_gfx_arrangement_content_align_set(widget, H, V); \
20 efl_gfx_arrangement_content_align_get(widget, &h, &v); \
21 ck_assert(v == rv); \
22 ck_assert(h == rh); \
23 } while(0);
24
25 TUPLE_CHECK( 1.0, 1.0, 1.0, 1.0);
26 TUPLE_CHECK( 0.0, 0.0, 0.0, 0.0);
27 TUPLE_CHECK(- 1.0, - 1.0, -1.0, -1.0);
28 TUPLE_CHECK(-42.0, -42.0, -1.0, -1.0);
29 TUPLE_CHECK( 42.0, 42.0, 1.0, 1.0);
30 TUPLE_CHECK(-42.0, 42.0, -1.0, 1.0);
31 TUPLE_CHECK( 42.0, -42.0, 1.0, -1.0);
32#undef TUPLE_CHECK
33}
34EFL_END_TEST
35
36EFL_START_TEST(pack_padding)
37{
38#define TUPLE_CHECK(H, V, rh, rv, S, rs) \
39 do { \
40 double v, h; \
41 Eina_Bool r; \
42 efl_gfx_arrangement_content_padding_set(widget, H, V, S); \
43 efl_gfx_arrangement_content_padding_get(widget, &h, &v, &r); \
44 ck_assert(v == rv); \
45 ck_assert(h == rh); \
46 ck_assert_int_eq(r, S); \
47 } while(0);
48
49 TUPLE_CHECK( 0.0, 0.0, 0.0, 0.0, EINA_TRUE, EINA_TRUE);
50 TUPLE_CHECK( -1.0, -123.0, 0.0, 0.0, EINA_FALSE, EINA_FALSE);
51 TUPLE_CHECK( -1.0, 123.0, 0.0, 123.0, EINA_FALSE, EINA_FALSE);
52#undef TUPLE_CHECK
53}
54EFL_END_TEST
55
56void
57efl_gfx_arrangement_behavior_test(TCase *tc)
58{
59 tcase_add_test(tc, pack_align);
60 tcase_add_test(tc, pack_padding);
61}
diff --git a/src/tests/elementary/spec/efl_test_pack.c b/src/tests/elementary/spec/efl_test_pack.c
index 61b3bafa57..d71a1d1e28 100644
--- a/src/tests/elementary/spec/efl_test_pack.c
+++ b/src/tests/elementary/spec/efl_test_pack.c
@@ -235,48 +235,6 @@ EFL_START_TEST(pack3)
235} 235}
236EFL_END_TEST 236EFL_END_TEST
237 237
238EFL_START_TEST(pack_align)
239{
240#define TUPLE_CHECK(H,V,rh,rv) \
241 do { \
242 double v, h; \
243 efl_pack_align_set(widget, H, V); \
244 efl_pack_align_get(widget, &h, &v); \
245 ck_assert(v == rv); \
246 ck_assert(h == rh); \
247 } while(0);
248
249 TUPLE_CHECK( 1.0, 1.0, 1.0, 1.0);
250 TUPLE_CHECK( 0.0, 0.0, 0.0, 0.0);
251 TUPLE_CHECK(- 1.0, - 1.0, -1.0, -1.0);
252 TUPLE_CHECK(-42.0, -42.0, -1.0, -1.0);
253 TUPLE_CHECK( 42.0, 42.0, 1.0, 1.0);
254 TUPLE_CHECK(-42.0, 42.0, -1.0, 1.0);
255 TUPLE_CHECK( 42.0, -42.0, 1.0, -1.0);
256#undef TUPLE_CHECK
257}
258EFL_END_TEST
259
260EFL_START_TEST(pack_padding)
261{
262#define TUPLE_CHECK(H, V, rh, rv, S, rs) \
263 do { \
264 double v, h; \
265 Eina_Bool r; \
266 efl_pack_padding_set(widget, H, V, S); \
267 efl_pack_padding_get(widget, &h, &v, &r); \
268 ck_assert(v == rv); \
269 ck_assert(h == rh); \
270 ck_assert_int_eq(r, S); \
271 } while(0);
272
273 TUPLE_CHECK( 0.0, 0.0, 0.0, 0.0, EINA_TRUE, EINA_TRUE);
274 TUPLE_CHECK( -1.0, -123.0, 0.0, 0.0, EINA_FALSE, EINA_FALSE);
275 TUPLE_CHECK( -1.0, 123.0, 0.0, 123.0, EINA_FALSE, EINA_FALSE);
276#undef TUPLE_CHECK
277}
278EFL_END_TEST
279
280EFL_START_TEST(evt_content_added) 238EFL_START_TEST(evt_content_added)
281{ 239{
282 Eina_Bool called = EINA_TRUE; 240 Eina_Bool called = EINA_TRUE;
@@ -345,8 +303,6 @@ efl_pack_behavior_test(TCase *tc)
345 tcase_add_test(tc, pack1); 303 tcase_add_test(tc, pack1);
346 tcase_add_test(tc, pack2); 304 tcase_add_test(tc, pack2);
347 tcase_add_test(tc, pack3); 305 tcase_add_test(tc, pack3);
348 tcase_add_test(tc, pack_align);
349 tcase_add_test(tc, pack_padding);
350 tcase_add_test(tc, evt_content_added); 306 tcase_add_test(tc, evt_content_added);
351 tcase_add_test(tc, evt_content_removed); 307 tcase_add_test(tc, evt_content_removed);
352 tcase_add_test(tc, child_killed); 308 tcase_add_test(tc, child_killed);
diff --git a/src/tests/elementary/spec/efl_ui_spec_suite.h b/src/tests/elementary/spec/efl_ui_spec_suite.h
index 6585fb58bd..03eed5809a 100644
--- a/src/tests/elementary/spec/efl_ui_spec_suite.h
+++ b/src/tests/elementary/spec/efl_ui_spec_suite.h
@@ -13,6 +13,7 @@ extern Evas_Object *widget;
13void efl_pack_behavior_test(TCase *tc); 13void efl_pack_behavior_test(TCase *tc);
14void efl_pack_linear_behavior_test(TCase *tc); 14void efl_pack_linear_behavior_test(TCase *tc);
15void efl_content_behavior_test(TCase *tc); 15void efl_content_behavior_test(TCase *tc);
16void efl_gfx_arrangement_behavior_test(TCase *tc);
16 17
17void efl_test_container_content_equal(Efl_Ui_Widget **wid, unsigned int len); 18void efl_test_container_content_equal(Efl_Ui_Widget **wid, unsigned int len);
18void efl_test_container_expect_evt_content_added(Efl_Ui_Widget *widget, const Efl_Event_Description *ev, Eina_Bool *flag, void *event_data); 19void efl_test_container_expect_evt_content_added(Efl_Ui_Widget *widget, const Efl_Event_Description *ev, Eina_Bool *flag, void *event_data);
diff --git a/src/tests/elementary/spec/meson.build b/src/tests/elementary/spec/meson.build
index 6dfa87c1bd..55c6e068d5 100644
--- a/src/tests/elementary/spec/meson.build
+++ b/src/tests/elementary/spec/meson.build
@@ -3,6 +3,7 @@ efl_ui_suite_behavior_test_files = files([
3 'efl_test_pack.c', 3 'efl_test_pack.c',
4 'efl_test_pack_linear.c', 4 'efl_test_pack_linear.c',
5 'efl_test_content.c', 5 'efl_test_content.c',
6 'efl_test_gfx_arrangement.c'
6]) 7])
7 8
8efl_ui_suite_behavior_src = files([ 9efl_ui_suite_behavior_src = files([