summaryrefslogtreecommitdiff
path: root/src/tests/elementary/efl_ui_test_box.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/elementary/efl_ui_test_box.c')
-rw-r--r--src/tests/elementary/efl_ui_test_box.c67
1 files changed, 66 insertions, 1 deletions
diff --git a/src/tests/elementary/efl_ui_test_box.c b/src/tests/elementary/efl_ui_test_box.c
index af4eab0..b1792c9 100644
--- a/src/tests/elementary/efl_ui_test_box.c
+++ b/src/tests/elementary/efl_ui_test_box.c
@@ -2,6 +2,7 @@
2# include "elementary_config.h" 2# include "elementary_config.h"
3#endif 3#endif
4 4
5#include <Efl_Ui.h>
5#include <Elementary.h> 6#include <Elementary.h>
6#include "elm_suite.h" 7#include "elm_suite.h"
7 8
@@ -187,6 +188,7 @@ static void
187btn_hint_set(Eo *btn, Hint *hint) 188btn_hint_set(Eo *btn, Hint *hint)
188{ 189{
189 efl_gfx_entity_size_set(layout, hint->layout_size); 190 efl_gfx_entity_size_set(layout, hint->layout_size);
191 efl_gfx_hint_size_min_set(layout, hint->layout_size);
190 efl_gfx_hint_size_max_set(btn, hint->max); 192 efl_gfx_hint_size_max_set(btn, hint->max);
191 efl_gfx_hint_size_min_set(btn, hint->min); 193 efl_gfx_hint_size_min_set(btn, hint->min);
192 efl_gfx_hint_weight_set(btn, hint->weightx, hint->weighty); 194 efl_gfx_hint_weight_set(btn, hint->weightx, hint->weighty);
@@ -202,7 +204,7 @@ btn_geom_assert(Hint *hint, Eina_Rect btn_geom)
202 Eina_Size2D layout_size, layout_min; 204 Eina_Size2D layout_size, layout_min;
203 205
204 layout_size = efl_gfx_entity_size_get(layout); 206 layout_size = efl_gfx_entity_size_get(layout);
205 layout_min = efl_gfx_hint_size_min_get(layout); 207 layout_min = efl_gfx_hint_size_combined_min_get(layout);
206 layout_size.w = layout_size.w > layout_min.w ? layout_size.w : layout_min.w; 208 layout_size.w = layout_size.w > layout_min.w ? layout_size.w : layout_min.w;
207 layout_size.h = layout_size.h > layout_min.h ? layout_size.h : layout_min.h; 209 layout_size.h = layout_size.h > layout_min.h ? layout_size.h : layout_min.h;
208 210
@@ -343,10 +345,73 @@ EFL_START_TEST (efl_ui_box_layout_update_pack)
343} 345}
344EFL_END_TEST 346EFL_END_TEST
345 347
348EFL_START_TEST (efl_ui_box_size)
349{
350#define USERMIN_CHECK(a, b) \
351 efl_canvas_group_calculate(layout); \
352 user_min = efl_gfx_hint_size_min_get(layout); \
353 ck_assert_msg(COORD_EQ(user_min.w, (a)) && COORD_EQ(user_min.h, (b)), \
354 "Case box_size failed... user_min: (%d, %d) expected user_min: (%d, %d)", \
355 user_min.w, user_min.h, (a), (b));
356
357#define MIN_CHECK(a, b) \
358 efl_canvas_group_calculate(layout); \
359 min = efl_gfx_hint_size_combined_min_get(layout); \
360 ck_assert_msg(COORD_EQ(min.w, (a)) && COORD_EQ(min.h, (b)), \
361 "Case box_size failed... min: (%d, %d) expected min: (%d, %d)", \
362 min.w, min.h, (a), (b));
363
364 Eo *btn, *btn2, *btn3;
365 Eina_Size2D min, user_min;
366
367 btn = efl_add(EFL_UI_BUTTON_CLASS, layout,
368 efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 100)),
369 efl_pack_end(layout, efl_added));
370
371 USERMIN_CHECK(0, 0);
372 MIN_CHECK(100, 100);
373
374 btn2 = efl_add(EFL_UI_BUTTON_CLASS, layout,
375 efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 100)),
376 efl_pack_end(layout, efl_added));
377 btn3 = efl_add(EFL_UI_BUTTON_CLASS, layout,
378 efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 100)),
379 efl_pack_end(layout, efl_added));
380 USERMIN_CHECK(0, 0);
381 MIN_CHECK(100, 300);
382
383 efl_pack_unpack(layout, btn2);
384 USERMIN_CHECK(0, 0);
385 MIN_CHECK(100, 200);
386
387 efl_pack_unpack(layout, btn3);
388 USERMIN_CHECK(0, 0);
389 MIN_CHECK(100, 100);
390
391 efl_pack_unpack(layout, btn);
392 USERMIN_CHECK(0, 0);
393 MIN_CHECK(0, 0);
394
395 efl_pack_end(layout, btn);
396 efl_gfx_hint_size_min_set(layout, EINA_SIZE2D(200, 200));
397 USERMIN_CHECK(200, 200);
398 MIN_CHECK(200, 200);
399
400 efl_pack_end(layout, btn2);
401 efl_pack_end(layout, btn3);
402 USERMIN_CHECK(200, 200);
403 MIN_CHECK(200, 300);
404
405#undef USERMIN_ASSERT
406#undef MIN_ASSERT
407}
408EFL_END_TEST
409
346void efl_ui_test_box(TCase *tc) 410void efl_ui_test_box(TCase *tc)
347{ 411{
348 tcase_add_checked_fixture(tc, layout_setup, layout_teardown); 412 tcase_add_checked_fixture(tc, layout_setup, layout_teardown);
349 tcase_add_test(tc, efl_ui_box_class_check); 413 tcase_add_test(tc, efl_ui_box_class_check);
350 tcase_add_test(tc, efl_ui_box_layout_update); 414 tcase_add_test(tc, efl_ui_box_layout_update);
351 tcase_add_test(tc, efl_ui_box_layout_update_pack); 415 tcase_add_test(tc, efl_ui_box_layout_update_pack);
416 tcase_add_test(tc, efl_ui_box_size);
352} 417}