Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_icon_tc1.c
1 /*
2  * Tested interface: AtkObject
3  *
4  * Tested AtkObject: EailIcon
5  *
6  * Description: Test AtkObject interface
7  *
8  * Test input: accessible object representing EailIcon
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 ICON_NAME "home"
18 #define ICON_SIZE 32
19
20 INIT_TEST("EailIcon")
21
22 static void
23 _init_icon(Evas_Object *win)
24 {
25    Evas_Object *bg, *icon;
26
27    bg = elm_bg_add(win);
28    elm_win_resize_object_add(win, bg);
29    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
30    evas_object_show(bg);
31
32    icon = elm_icon_add(win);
33    elm_icon_order_lookup_set(icon, ELM_ICON_LOOKUP_THEME_FDO);
34    elm_icon_standard_set(icon, ICON_NAME);
35    evas_object_resize(icon, ICON_SIZE, ICON_SIZE);
36    evas_object_show(icon);
37 }
38
39 static void
40 _do_test(AtkObject *obj)
41 {
42    const char *type_name = g_type_name(G_TYPE_FROM_INSTANCE(obj));
43    const char *name = atk_object_get_name(obj);
44
45    g_assert(ATK_IS_OBJECT(obj));
46    atk_object_set_description(obj, "test");
47    g_assert_cmpstr(atk_object_get_description(obj), ==, "test");
48
49    atk_object_set_name(obj, "test name");
50    g_assert_cmpstr(atk_object_get_name(obj), ==, "test name");
51
52    g_assert_cmpstr(type_name, ==, "EailIcon");
53
54    g_assert_cmpstr(name, ==, ICON_NAME);
55
56    g_assert(atk_object_get_role(obj) == ATK_ROLE_ICON);
57
58    eailu_test_code_called = 1;
59 }
60
61 EAPI_MAIN int
62 elm_main(int argc, char **argv)
63 {
64    Evas_Object *win;
65
66    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
67    g_assert(win);
68    _init_icon(win);
69    evas_object_show(win);
70    elm_run();
71    elm_shutdown();
72
73    return 0;
74 }
75 ELM_MAIN()