summaryrefslogtreecommitdiff
path: root/src/tests/elementary/efl_ui_test_collection.c
blob: c645fba210602070440b6309be65966a18b5cacf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif

#include <Efl_Ui.h>
#include "efl_ui_suite.h"
#include "efl_ui_test_collection_common.h"

static Eo* win;

static void
item_container_setup()
{
   win = win_add();
}

static void
item_container_teardown()
{
   win = NULL;
}

EFL_START_TEST(finalizer_check)
{
   Eo *grid = efl_new(EFL_UI_POSITION_MANAGER_GRID_CLASS);
   Eo *list = efl_new(EFL_UI_POSITION_MANAGER_GRID_CLASS);
   Eo *random_obj = efl_add(EFL_UI_BUTTON_CLASS, win);
   Eo *o;

   EXPECT_ERROR_START;
   ck_assert_ptr_eq(efl_add(EFL_UI_COLLECTION_CLASS, win), NULL);
   EXPECT_ERROR_END;

   EXPECT_ERROR_START;
   ck_assert_ptr_eq(efl_add(EFL_UI_COLLECTION_CLASS, win, efl_ui_collection_position_manager_set(efl_added, random_obj)), NULL);
   EXPECT_ERROR_END;

   o = efl_add(EFL_UI_COLLECTION_CLASS, win, efl_ui_collection_position_manager_set(efl_added, grid));
   ck_assert_ptr_ne(o, NULL);
   ck_assert_ptr_eq(efl_parent_get(grid), o);
   efl_del(o);
   o = efl_add(EFL_UI_COLLECTION_CLASS, win, efl_ui_collection_position_manager_set(efl_added, list));
   ck_assert_ptr_ne(o, NULL);
   ck_assert_ptr_eq(efl_parent_get(list), o);
   efl_del(o);
}
EFL_END_TEST

void efl_ui_test_item_container(TCase *tc)
{
   tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
   tcase_add_checked_fixture(tc, item_container_setup, item_container_teardown);
   tcase_add_test(tc, finalizer_check);
}