Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_flipselector_tc2.c
1 /*
2  * Tested interface: AtkSelection
3  *
4  * Tested AtkObject: EailFlipselector
5  *
6  * Description: Test AtkSelection interface
7  *
8  * Test input: accessible object representing EailFlipselector
9  *
10  * Expected test result: test should return 0 (success)
11  */
12
13
14 #include <Elementary.h>
15
16 #include "atk/atk.h"
17 #include "eail_test_utils.h"
18
19 #define ITEM_SEL_EINA 2
20 #define ITEM_SEL_EDJE 3
21 #define ITEM_SEL_ELM 0
22 #define MAX_SELECTIONS 1
23
24 INIT_TEST("EailFlipselector")
25
26 void
27 _init_flipselector(Evas_Object *win)
28 {
29    unsigned int i;
30    Evas_Object *bg, *bx, *fp;
31    static const char *lbl[] =
32      {
33         "Elementary",
34         "Evas",
35         "Eina",
36         "Edje",
37         "Eet",
38         "Ecore",
39         "Efreet",
40         "Edbus"
41      };
42
43    bg = elm_bg_add(win);
44    elm_win_resize_object_add(win, bg);
45    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
46    evas_object_show(bg);
47
48    bx = elm_box_add(win);
49    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
50    elm_win_resize_object_add(win, bx);
51    evas_object_show(bx);
52
53    fp = elm_flipselector_add(win);
54    evas_object_size_hint_weight_set(fp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
55
56    for (i = 0; i < sizeof(lbl) / sizeof(lbl[0]); i++)
57      elm_flipselector_item_append(fp, lbl[i], NULL, NULL);
58
59    elm_box_pack_end(bx, fp);
60    evas_object_show(fp);
61 }
62
63 void
64 _do_test(AtkObject *obj)
65 {
66    g_assert(ATK_IS_SELECTION(obj));
67
68    g_assert(atk_selection_add_selection(ATK_SELECTION(obj), ITEM_SEL_EINA));
69    g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA));
70
71    g_assert(atk_selection_clear_selection(ATK_SELECTION(obj)) == FALSE);
72
73    g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA));
74
75    g_assert(atk_selection_get_selection_count(ATK_SELECTION(obj)) == MAX_SELECTIONS);
76
77    g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA));
78
79    g_assert(atk_selection_remove_selection(ATK_SELECTION(obj), ITEM_SEL_EINA));
80    g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_ELM));
81
82    g_assert(atk_selection_select_all_selection(ATK_SELECTION(obj)) == FALSE);
83
84    eailu_test_code_called = 1;
85 }
86
87 EAPI_MAIN int
88 elm_main(int argc, char **argv)
89 {
90    Evas_Object *win = NULL;
91
92    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
93    _init_flipselector(win);
94    evas_object_show(win);
95    elm_run();
96    elm_shutdown();
97
98    return 0;
99 }
100 ELM_MAIN()
101