Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_button_tc3.c
1 /*
2  * Tested interface: AtkObject
3  *
4  * Tested AtkObject: EailButton
5  *
6  * Description: Test whether EailIcon is only child of EailButton
7  *
8  * Test input: accessible object representing EailButton
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 #define BUTTON_TEXT2   "button2"
19
20 #define ICON_SIZE 56
21
22 INIT_TEST("EailButton")
23
24 static void
25 _do_test(AtkObject *obj)
26 {
27    const char *type_name_child;
28
29    AtkObject *xobj;
30
31    _printf("Button test: %s\n", BUTTON_TEXT2);
32    // test children
33    g_assert(1 == atk_object_get_n_accessible_children(obj));
34
35    xobj = atk_object_ref_accessible_child(obj, 0);
36    g_assert(NULL != xobj);
37    type_name_child = g_type_name(G_TYPE_FROM_INSTANCE(xobj));
38    _printf("type_name_child: %s\n", type_name_child);
39    g_assert_cmpstr(type_name_child, ==, "EailIcon");
40
41    eailu_test_code_called = 1;
42 }
43
44 static void
45 _init_button(Evas_Object *win)
46 {
47    Evas_Object *bg, *icon, *button2;
48
49    bg = elm_bg_add(win);
50    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
51    elm_win_resize_object_add(win, bg);
52    evas_object_show(bg);
53
54    icon = elm_icon_add(win);
55    elm_icon_order_lookup_set(icon, ELM_ICON_LOOKUP_THEME_FDO);
56    elm_icon_standard_set(icon, "home");
57    evas_object_show(icon);
58
59    button2 = elm_button_add(win);
60    elm_object_text_set(button2, BUTTON_TEXT2);
61    elm_object_part_content_set(button2, "icon", icon);
62    evas_object_resize(button2, 140, 60);
63    evas_object_show(button2);
64 }
65
66 EAPI_MAIN int
67 elm_main(int argc, char **argv)
68 {
69    Evas_Object *win;
70
71    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
72    _init_button(win);
73    evas_object_show(win);
74    elm_run();
75    elm_shutdown();
76
77    return 0;
78 }
79 ELM_MAIN()