Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_conformant_tc1.c
1 /*
2  * Tested interface: AtkObject
3  *
4  * Tested AtkObject: EailConformant
5  *
6  * Description: Test AtkObject interface
7  *
8  * Test input: accessible object representing EailConformant
9  *
10  * Expected test result: test should return 0 (success)
11  */
12
13 #include <Elementary.h>
14 #include <atk/atk.h>
15
16 #include "eail_test_utils.h"
17
18 INIT_TEST("EailConformant")
19
20 static void
21 _do_test(AtkObject *obj)
22 {
23    int child_count = 0;
24    AtkRole role = atk_object_get_role(obj);
25    g_assert(role == ATK_ROLE_FILLER);
26
27    atk_object_set_description(obj, "test");
28    g_assert_cmpstr(atk_object_get_description(obj), ==, "test");
29
30    atk_object_set_name(obj, "test name");
31    g_assert_cmpstr(atk_object_get_name(obj), ==, "test name");
32
33    child_count = atk_object_get_n_accessible_children(obj);
34    g_assert(child_count == 1);
35
36    for (int i = 0; i < child_count; i++)
37      {
38         AtkObject *child = atk_object_ref_accessible_child(obj, i);
39         g_assert(ATK_IS_OBJECT(child));
40         role = atk_object_get_role(child);
41         g_assert(role == ATK_ROLE_FILLER);
42         g_object_unref(child);
43      }
44
45    eailu_test_atk_focus(obj, TRUE);
46
47    eailu_test_code_called = 1;
48 }
49
50 EAPI_MAIN int
51 elm_main(int argc, char **argv)
52 {
53    Evas_Object *win, *bg, *conform, *btn, *bx, *en;
54
55    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
56    elm_win_conformant_set(win, EINA_TRUE);
57
58    bg = elm_bg_add(win);
59    elm_win_resize_object_add(win, bg);
60    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
61    evas_object_show(bg);
62
63    conform = elm_conformant_add(win);
64    elm_win_resize_object_add(win, conform);
65    evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
66    evas_object_show(conform);
67
68    bx = elm_box_add(win);
69    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
70    evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
71
72    btn = elm_button_add(win);
73    elm_object_text_set(btn, "Test Conformant");
74    evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0);
75    evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0);
76    elm_box_pack_end(bx, btn);
77    evas_object_show(btn);
78
79    en = elm_entry_add(win);
80    elm_entry_scrollable_set(en, EINA_TRUE);
81    elm_object_text_set(en,
82                        "This is a multi-line entry at the bottom<br>"
83                        "This can contain more than 1 line of text and be "
84                        "scrolled around to allow for entering of lots of "
85                        "content. It is also to test to see that autoscroll "
86                        "moves to the right part of a larger multi-line "
87                        "text entry that is inside of a scroller than can be "
88                        "scrolled around, thus changing the expected position "
89                        "as well as cursor changes updating auto-scroll when "
90                        "it is enabled.");
91
92    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
93    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
94    evas_object_show(en);
95    elm_box_pack_end(bx, en);
96
97    btn = elm_button_add(win);
98    elm_object_text_set(btn, "Test Conformant");
99    evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0);
100    evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0);
101    elm_box_pack_end(bx, btn);
102    evas_object_show(btn);
103
104    elm_object_content_set(conform, bx);
105    evas_object_show(bx);
106
107    evas_object_resize(win, 240, 480);
108    evas_object_show(win);
109
110    elm_run();
111    elm_shutdown();
112
113    return 0;
114 }
115 ELM_MAIN()