Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_inwin_tc1.c
1 /*
2  * Tested interface: AtkObject
3  *
4  * Tested AtkObject: EailInwin
5  *
6  * Description: Test AtkObject interface
7  *
8  * Test input: accessible object representing EailInwin
9  *
10  * Expected test result: test should return 0 (success)
11  */
12
13 #include <Elementary.h>
14 #include <atk/atk.h>
15 #include "eail_test_utils.h"
16
17 #define CHILDREN_COUNT 1
18
19 INIT_TEST("EailInwin")
20
21 static void
22 _do_test(AtkObject *obj)
23 {
24    AtkObject *child;
25    const char *child_name;
26
27    g_assert(ATK_IS_OBJECT(obj));
28
29    g_assert(atk_object_get_role(obj) == ATK_ROLE_GLASS_PANE);
30    atk_object_set_description(obj, "test");
31    g_assert_cmpstr(atk_object_get_description(obj), ==, "test");
32
33    atk_object_set_name(obj, "test name");
34    g_assert_cmpstr(atk_object_get_name(obj), ==, "test name");
35
36    g_assert(atk_object_get_n_accessible_children(obj) == CHILDREN_COUNT);
37
38    child = atk_object_ref_accessible_child(obj, 0);
39    g_assert(child);
40    child_name = g_type_name(G_TYPE_FROM_INSTANCE(child));
41    g_assert_cmpstr(child_name, ==, "EailButton");
42    g_object_unref(child);
43
44    eailu_test_code_called = 1;
45 }
46
47 static void
48 _init_inwin(Evas_Object *win)
49 {
50    Evas_Object *o, *bg, *parent, *inwin;
51
52    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
53    elm_win_autodel_set(win, EINA_TRUE);
54
55    bg = elm_bg_add(win);
56    elm_win_resize_object_add(win, bg);
57    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
58    evas_object_show(bg);
59
60    parent = win;
61    inwin = elm_win_inwin_add(parent);
62    elm_object_style_set(inwin, "default");
63    evas_object_show(inwin);
64    elm_win_inwin_activate(inwin);
65
66    o = elm_button_add(parent);
67    elm_object_text_set(o, "Test");
68    evas_object_show(o);
69
70    elm_win_inwin_content_set(inwin, o);
71 }
72
73 EAPI_MAIN int
74 elm_main(int argc, char *argv[])
75 {
76    Evas_Object *win;
77
78    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
79    _init_inwin(win);
80    evas_object_show(win);
81    elm_run();
82    elm_shutdown();
83
84    return 0;
85 }
86 ELM_MAIN()