count = eina_list_count(bd->children);
if (!count)
{
- efl_gfx_hint_size_min_set(ui_box, EINA_SIZE2D(0, 0));
+ efl_gfx_hint_size_restricted_min_set(ui_box, EINA_SIZE2D(0, 0));
return;
}
want[1] += (box_calc[1].margin[0] + box_calc[1].margin[1]) +
(box_calc[1].pad * (count - 1));
- if (want[0] < box_calc[0].min) want[0] = box_calc[0].min;
- if (want[1] < box_calc[1].min) want[1] = box_calc[1].min;
-
- efl_gfx_hint_size_min_set(ui_box, EINA_SIZE2D(want[0], want[1]));
+ efl_gfx_hint_size_restricted_min_set(ui_box, EINA_SIZE2D(want[0], want[1]));
}
{
Eina_Rect geom;
Eina_Bool pad_scalable;
- Eina_Size2D min;
geom = efl_gfx_entity_geometry_get(obj);
efl_gfx_hint_margin_get(obj, &calc[0].margin[0], &calc[0].margin[1],
&calc[1].margin[0], &calc[1].margin[1]);
- min = efl_gfx_hint_size_combined_min_get(obj);
- calc[0].min = min.w;
- calc[1].min = min.h;
calc[0].scale = calc[1].scale = efl_gfx_entity_scale_get(obj);
efl_pack_padding_get(obj, &calc[0].pad, &calc[1].pad, &pad_scalable);
{
int pos;
int size;
- int min;
int margin[2];
double align;
double scale;
if (!pd->count)
{
- efl_gfx_hint_size_min_set(ui_table, EINA_SIZE2D(0, 0));
+ efl_gfx_hint_size_restricted_min_set(ui_table, EINA_SIZE2D(0, 0));
return;
}
+ (table_calc.layout_calc[1].pad *
table_calc.cell_calc[1][rows - 1].index);
- if (table_calc.want[0] < table_calc.layout_calc[0].min)
- table_calc.want[0] = table_calc.layout_calc[0].min;
- if (table_calc.want[1] < table_calc.layout_calc[1].min)
- table_calc.want[1] = table_calc.layout_calc[1].min;
-
- efl_gfx_hint_size_min_set(ui_table, EINA_SIZE2D(table_calc.want[0],
- table_calc.want[1]));
+ efl_gfx_hint_size_restricted_min_set(ui_table,
+ EINA_SIZE2D(table_calc.want[0],
+ table_calc.want[1]));
}
Eina_Size2D layout_size, layout_min;
layout_size = efl_gfx_entity_size_get(layout);
- layout_min = efl_gfx_hint_size_min_get(layout);
+ layout_min = efl_gfx_hint_size_combined_min_get(layout);
layout_size.w = layout_size.w > layout_min.w ? layout_size.w : layout_min.w;
layout_size.h = layout_size.h > layout_min.h ? layout_size.h : layout_min.h;
}
EFL_END_TEST
+EFL_START_TEST (efl_ui_box_size)
+{
+#define USERMIN_CHECK(a, b) \
+ efl_canvas_group_calculate(layout); \
+ user_min = efl_gfx_hint_size_min_get(layout); \
+ ck_assert_msg(COORD_EQ(user_min.w, (a)) && COORD_EQ(user_min.h, (b)), \
+ "Case box_size failed... user_min: (%d, %d) expected user_min: (%d, %d)", \
+ user_min.w, user_min.h, (a), (b));
+
+#define MIN_CHECK(a, b) \
+ efl_canvas_group_calculate(layout); \
+ min = efl_gfx_hint_size_combined_min_get(layout); \
+ ck_assert_msg(COORD_EQ(min.w, (a)) && COORD_EQ(min.h, (b)), \
+ "Case box_size failed... min: (%d, %d) expected min: (%d, %d)", \
+ min.w, min.h, (a), (b));
+
+ Eo *btn, *btn2, *btn3;
+ Eina_Size2D min, user_min;
+
+ btn = efl_add(EFL_UI_BUTTON_CLASS, layout,
+ efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 100)),
+ efl_pack_end(layout, efl_added));
+
+ USERMIN_CHECK(0, 0);
+ MIN_CHECK(100, 100);
+
+ btn2 = efl_add(EFL_UI_BUTTON_CLASS, layout,
+ efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 100)),
+ efl_pack_end(layout, efl_added));
+ btn3 = efl_add(EFL_UI_BUTTON_CLASS, layout,
+ efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 100)),
+ efl_pack_end(layout, efl_added));
+ USERMIN_CHECK(0, 0);
+ MIN_CHECK(100, 300);
+
+ efl_pack_unpack(layout, btn2);
+ USERMIN_CHECK(0, 0);
+ MIN_CHECK(100, 200);
+
+ efl_pack_unpack(layout, btn3);
+ USERMIN_CHECK(0, 0);
+ MIN_CHECK(100, 100);
+
+ efl_pack_unpack(layout, btn);
+ USERMIN_CHECK(0, 0);
+ MIN_CHECK(0, 0);
+
+ efl_pack_end(layout, btn);
+ efl_gfx_hint_size_min_set(layout, EINA_SIZE2D(200, 200));
+ USERMIN_CHECK(200, 200);
+ MIN_CHECK(200, 200);
+
+ efl_pack_end(layout, btn2);
+ efl_pack_end(layout, btn3);
+ USERMIN_CHECK(200, 200);
+ MIN_CHECK(200, 300);
+
+#undef USERMIN_ASSERT
+#undef MIN_ASSERT
+}
+EFL_END_TEST
+
void efl_ui_test_box(TCase *tc)
{
tcase_add_checked_fixture(tc, layout_setup, layout_teardown);
tcase_add_test(tc, efl_ui_box_class_check);
tcase_add_test(tc, efl_ui_box_layout_update);
tcase_add_test(tc, efl_ui_box_layout_update_pack);
+ tcase_add_test(tc, efl_ui_box_size);
}
Eina_Size2D layout_size, layout_min;
layout_size = efl_gfx_entity_size_get(layout);
- layout_min = efl_gfx_hint_size_min_get(layout);
+ layout_min = efl_gfx_hint_size_combined_min_get(layout);
layout_size.w = layout_size.w > layout_min.w ? layout_size.w : layout_min.w;
layout_size.h = layout_size.h > layout_min.h ? layout_size.h : layout_min.h;
}
EFL_END_TEST
+EFL_START_TEST (efl_ui_table_size)
+{
+#define USERMIN_CHECK(a, b) \
+ efl_canvas_group_calculate(layout); \
+ user_min = efl_gfx_hint_size_min_get(layout); \
+ ck_assert_msg(COORD_EQ(user_min.w, (a)) && COORD_EQ(user_min.h, (b)), \
+ "Case table_size failed... user_min: (%d, %d) expected user_min: (%d, %d)", \
+ user_min.w, user_min.h, (a), (b));
+
+#define MIN_CHECK(a, b) \
+ efl_canvas_group_calculate(layout); \
+ min = efl_gfx_hint_size_combined_min_get(layout); \
+ ck_assert_msg(COORD_EQ(min.w, (a)) && COORD_EQ(min.h, (b)), \
+ "Case table_size failed... min: (%d, %d) expected min: (%d, %d)", \
+ min.w, min.h, (a), (b));
+
+ Eo *btn, *btn2, *btn3;
+ Eina_Size2D min, user_min;
+
+ btn = efl_add(EFL_UI_BUTTON_CLASS, layout,
+ efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 100)),
+ efl_pack_table(layout, efl_added, 0, 0, 1, 1));
+
+ USERMIN_CHECK(0, 0);
+ MIN_CHECK(100, 100);
+
+ btn2 = efl_add(EFL_UI_BUTTON_CLASS, layout,
+ efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 100)),
+ efl_pack_table(layout, efl_added, 0, 1, 1, 1));
+ btn3 = efl_add(EFL_UI_BUTTON_CLASS, layout,
+ efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 100)),
+ efl_pack_table(layout, efl_added, 0, 2, 1, 1));
+ USERMIN_CHECK(0, 0);
+ MIN_CHECK(100, 300);
+
+ efl_pack_unpack(layout, btn);
+ USERMIN_CHECK(0, 0);
+ MIN_CHECK(100, 200);
+
+ efl_pack_unpack(layout, btn2);
+ USERMIN_CHECK(0, 0);
+ MIN_CHECK(100, 100);
+
+ efl_pack_unpack(layout, btn3);
+ USERMIN_CHECK(0, 0);
+ MIN_CHECK(0, 0);
+
+ efl_pack_table(layout, btn, 0, 0, 1, 1);
+ efl_gfx_hint_size_min_set(layout, EINA_SIZE2D(200, 200));
+ USERMIN_CHECK(200, 200);
+ MIN_CHECK(200, 200);
+
+ efl_pack_table(layout, btn2, 0, 1, 1, 1);
+ efl_pack_table(layout, btn3, 0, 2, 1, 1);
+ USERMIN_CHECK(200, 200);
+ MIN_CHECK(200, 300);
+
+#undef USERMIN_ASSERT
+#undef MIN_ASSERT
+}
+EFL_END_TEST
+
void efl_ui_test_table(TCase *tc)
{
tcase_add_checked_fixture(tc, layout_setup, layout_teardown);
tcase_add_test(tc, efl_ui_table_class_check);
+ tcase_add_test(tc, efl_ui_table_size);
tcase_add_test(tc, efl_ui_table_layout_update);
tcase_add_test(tc, efl_ui_table_layout_update_pack);
tcase_add_test(tc, efl_ui_table_layout_update_matrix);