summaryrefslogtreecommitdiff
path: root/src/tests/elementary/efl_ui_test_collection_common.c
blob: 5bd2c5cd5577b1d31f7e70b596d4feff00541c75 (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
55
56
57
58
59
60
61
62
63
#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"

Eo *item_container;

void
fill_items(const Efl_Class *klass)
{
  for (int i = 0; i < 3; ++i)
    {
       char buf[PATH_MAX];
       Eo *it = efl_add(klass, item_container);

       snprintf(buf, sizeof(buf), "%d - Test %d", i, i%13);
       efl_text_set(it, buf);
       efl_pack_end(item_container, it);
    }
}

EFL_START_TEST(finalizer_group_middle_insert)
{
   Efl_Ui_Group_Item *group_item = efl_add(EFL_UI_GROUP_ITEM_CLASS, item_container);
   efl_pack_end(item_container, group_item);
   Efl_Ui_Group_Item *i1 = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, item_container);
   efl_pack_end(group_item, i1);
   Efl_Ui_Group_Item *i2 = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, item_container);
   efl_pack_end(group_item, i2);
   Efl_Ui_Group_Item *e = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, item_container);

   EXPECT_ERROR_START;
   efl_pack_after(item_container, e, group_item);
   EXPECT_ERROR_END;
   EXPECT_ERROR_START;
   efl_pack_after(item_container, e, i1);
   EXPECT_ERROR_END;

   EXPECT_ERROR_START;
   efl_pack_before(item_container, e, i1);
   EXPECT_ERROR_END;
   EXPECT_ERROR_START;
   efl_pack_before(item_container, e, i2);
   EXPECT_ERROR_END;

   EXPECT_ERROR_START;
   efl_pack_at(item_container, e, 1);
   EXPECT_ERROR_END;
   EXPECT_ERROR_START;
   efl_pack_at(item_container, e, 2);
   EXPECT_ERROR_END;

   efl_del(item_container);
}
EFL_END_TEST

void efl_ui_test_item_container_common_add(TCase *tc)
{
   tcase_add_test(tc, finalizer_group_middle_insert);
}