Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_flipselector_tc1.c
1 /*
2  * Tested interface: AtkObject
3  *
4  * Tested AtkObject: EailFlipselector
5  *
6  * Description: Test AtkObject 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 ITEMS_COUNT 8
19
20 INIT_TEST("EailFlipselector")
21
22 void
23 _init_flipselector(Evas_Object *win)
24 {
25    unsigned int i;
26    Evas_Object *bg, *bx, *fp;
27    static const char *lbl[] =
28      {
29         "Elementary",
30         "Evas",
31         "Eina",
32         "Edje",
33         "Eet",
34         "Ecore",
35         "Efreet",
36         "Edbus"
37      };
38
39    bg = elm_bg_add(win);
40    elm_win_resize_object_add(win, bg);
41    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
42    evas_object_show(bg);
43
44    bx = elm_box_add(win);
45    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
46    elm_win_resize_object_add(win, bx);
47    evas_object_show(bx);
48
49    fp = elm_flipselector_add(win);
50    evas_object_size_hint_weight_set(fp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
51
52    for (i = 0; i < sizeof(lbl) / sizeof(lbl[0]); i++)
53      elm_flipselector_item_append(fp, lbl[i], NULL, NULL);
54
55    elm_box_pack_end(bx, fp);
56    evas_object_show(fp);
57 }
58
59 void
60 _do_test(AtkObject *obj)
61 {
62    g_assert(ATK_IS_OBJECT(obj));
63
64    atk_object_set_description(obj, "test");
65    g_assert_cmpstr(atk_object_get_description(obj), ==, "test");
66
67    atk_object_set_name(obj, "test name");
68    g_assert_cmpstr(atk_object_get_name(obj), ==, "test name");
69
70    g_assert(atk_object_get_n_accessible_children(obj) == ITEMS_COUNT);
71
72    g_assert(atk_object_get_role(obj) == ATK_ROLE_LIST);
73
74    eailu_test_code_called = 1;
75 }
76
77 EAPI_MAIN int
78 elm_main(int argc, char **argv)
79 {
80    Evas_Object *win = NULL;
81
82    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
83    _init_flipselector(win);
84    evas_object_show(win);
85    elm_run();
86    elm_shutdown();
87
88    return 0;
89 }
90 ELM_MAIN()
91