Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_flip_tc1.c
1 /*
2  * Tested interface: AtkObject
3  *
4  * Tested AtkObject: EailFlip
5  *
6  * Description: Test AtkObject interface
7  *
8  * Test input: accessible object representing EailFlip
9  *
10  * Expected test result: test should return 0 (success)
11  */
12
13 #include <Elementary.h>
14 #include <atk/atk.h>
15
16 #define DEBUG 1
17
18 #include "eail_test_utils.h"
19
20 #define ACTIONS_NUMBER 1
21
22 INIT_TEST("EailFlip")
23
24 static void
25 _init_flip(Evas_Object *win)
26 {
27    Evas_Object *bg, *image, *icon, *flip;
28
29    bg = elm_bg_add(win);
30    elm_win_resize_object_add(win, bg);
31    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
32    evas_object_show(bg);
33
34    image = elm_image_add(win);
35    g_assert(elm_image_file_set(image, "./data/07.jpg", NULL));
36    evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
37    elm_win_resize_object_add(win, image);
38    evas_object_show(image);
39
40    icon = elm_icon_add(win);
41    elm_icon_order_lookup_set(icon, ELM_ICON_LOOKUP_THEME_FDO);
42    elm_icon_standard_set(icon, "home");
43    elm_win_resize_object_add(win, icon);
44    evas_object_show(icon);
45
46    flip = elm_flip_add(win);
47    elm_object_part_content_set(flip, "front", image);
48    elm_object_part_content_set(flip, "back", icon);
49    evas_object_show(flip);
50
51    elm_flip_interaction_set(flip, ELM_FLIP_INTERACTION_PAGE);
52    elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_UP, EINA_TRUE);
53    elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_DOWN, EINA_TRUE);
54    elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_LEFT, EINA_TRUE);
55    elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_RIGHT, EINA_TRUE);
56    elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_UP, 1);
57    elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_DOWN, 1);
58    elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_LEFT, 1);
59    elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_RIGHT, 1);
60 }
61
62 static void
63 _do_test(AtkObject *obj)
64 {
65    const char *type_name_child;
66    AtkObject *xobj;
67    static int count = 0;
68
69    g_assert(ATK_IS_OBJECT(obj));
70
71    atk_object_set_description(obj, "test");
72    g_assert_cmpstr(atk_object_get_description(obj), ==, "test");
73
74    atk_object_set_name(obj, "test name");
75    g_assert_cmpstr(atk_object_get_name(obj), ==, "test name");
76
77    g_assert(atk_object_get_role(obj) == ATK_ROLE_PAGE_TAB_LIST);
78
79    g_assert(1 == atk_object_get_n_accessible_children(obj));
80
81    xobj = atk_object_ref_accessible_child(obj, 0);
82    g_assert(NULL != xobj);
83    type_name_child = g_type_name(G_TYPE_FROM_INSTANCE(xobj));
84
85    if (count % 2)
86      g_assert_cmpstr(type_name_child, ==, "EailIcon");
87    else
88      g_assert_cmpstr(type_name_child, ==, "EailImage");
89
90    count++;
91
92    /* flip object does not support focus */
93    eailu_test_atk_focus(obj, FALSE);
94
95    eailu_test_code_called = 1;
96 }
97
98 EAPI_MAIN int
99 elm_main(int argc, char **argv)
100 {
101    Evas_Object *win;
102
103    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
104    g_assert(win);
105    _init_flip(win);
106    evas_object_show(win);
107    elm_run();
108    elm_shutdown();
109
110    return 0;
111 }
112 ELM_MAIN()