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