forked from enlightenment/efl
introduce test file for Efl.Ui.Group_Item
Summary: this tests that the tree structure which is defined by the group and child item hirachy is correctly transformed into a linear list. This also checks that the bug from the revision before is not happening. Depends on D9890 Reviewers: segfaultxavi, zmike, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9872
This commit is contained in:
parent
d5bf69ff53
commit
7f691b47fb
|
@ -40,6 +40,7 @@ static const Efl_Test_Case etc[] = {
|
||||||
{ "efl_ui_list_container", efl_ui_test_list_container },
|
{ "efl_ui_list_container", efl_ui_test_list_container },
|
||||||
{ "efl_ui_select_model", efl_ui_test_select_model },
|
{ "efl_ui_select_model", efl_ui_test_select_model },
|
||||||
{ "efl_ui_view_model", efl_ui_test_view_model },
|
{ "efl_ui_view_model", efl_ui_test_view_model },
|
||||||
|
{ "efl_ui_group_item", efl_ui_test_group_item },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ void efl_ui_test_popup(TCase *tc);
|
||||||
void efl_ui_test_scroller(TCase *tc);
|
void efl_ui_test_scroller(TCase *tc);
|
||||||
void efl_ui_test_select_model(TCase *tc);
|
void efl_ui_test_select_model(TCase *tc);
|
||||||
void efl_ui_test_view_model(TCase *tc);
|
void efl_ui_test_view_model(TCase *tc);
|
||||||
|
void efl_ui_test_group_item(TCase *tc);
|
||||||
|
|
||||||
void loop_timer_interval_set(Eo *obj, double in);
|
void loop_timer_interval_set(Eo *obj, double in);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
#define EFL_NOLEGACY_API_SUPPORT
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "elementary_config.h"
|
||||||
|
#endif
|
||||||
|
#define EFL_LAYOUT_CALC_PROTECTED
|
||||||
|
#include <Efl_Ui.h>
|
||||||
|
#include "efl_ui_suite.h"
|
||||||
|
|
||||||
|
static Eo *win;
|
||||||
|
static Eo *grid;
|
||||||
|
|
||||||
|
static void
|
||||||
|
create_ui(void)
|
||||||
|
{
|
||||||
|
win = win_add();
|
||||||
|
grid = efl_add(EFL_UI_GRID_CLASS, win);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ordering_equals(Efl_Ui_Widget **wid, unsigned int len)
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < len; ++i)
|
||||||
|
{
|
||||||
|
ck_assert_ptr_eq(efl_pack_content_get(grid, i), wid[i]);
|
||||||
|
}
|
||||||
|
ck_assert_int_eq(efl_content_count(grid), len);
|
||||||
|
}
|
||||||
|
|
||||||
|
EFL_START_TEST(non_linear_insertion_pack_at)
|
||||||
|
{
|
||||||
|
Eo *group[3];
|
||||||
|
Eo *order[12];
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; ++i)
|
||||||
|
{
|
||||||
|
order[i*4] = group[i] = efl_add(EFL_UI_GROUP_ITEM_CLASS, grid);
|
||||||
|
efl_pack_at(grid, group[i], i);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; ++i)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 3; ++j)
|
||||||
|
{
|
||||||
|
Eo *item = order[4*i+(1+j)] = efl_add(EFL_UI_GRID_DEFAULT_ITEM_CLASS, grid);
|
||||||
|
efl_pack_at(group[i], item, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ordering_equals(order, 12);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
EFL_START_TEST(non_linear_insertion_pack_end)
|
||||||
|
{
|
||||||
|
Eo *group[3];
|
||||||
|
Eo *order[12];
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; ++i)
|
||||||
|
{
|
||||||
|
order[i*4] = group[i] = efl_add(EFL_UI_GROUP_ITEM_CLASS, grid);
|
||||||
|
efl_pack_end(grid, group[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; ++i)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 3; ++j)
|
||||||
|
{
|
||||||
|
Eo *item = order[4*i+(1+j)] = efl_add(EFL_UI_GRID_DEFAULT_ITEM_CLASS, grid);
|
||||||
|
efl_pack_end(group[i], item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ordering_equals(order, 12);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
void efl_ui_test_group_item(TCase *tc)
|
||||||
|
{
|
||||||
|
tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
|
||||||
|
tcase_add_checked_fixture(tc, create_ui, NULL);
|
||||||
|
tcase_add_test(tc, non_linear_insertion_pack_at);
|
||||||
|
tcase_add_test(tc, non_linear_insertion_pack_end);
|
||||||
|
}
|
|
@ -156,6 +156,7 @@ efl_ui_suite_src = [
|
||||||
'efl_ui_test_scroller.c',
|
'efl_ui_test_scroller.c',
|
||||||
'efl_ui_test_select_model.c',
|
'efl_ui_test_select_model.c',
|
||||||
'efl_ui_test_view_model.c',
|
'efl_ui_test_view_model.c',
|
||||||
|
'efl_ui_test_group_item.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
efl_ui_suite = executable('efl_ui_suite',
|
efl_ui_suite = executable('efl_ui_suite',
|
||||||
|
|
Loading…
Reference in New Issue