Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_icon_tc3.c
1 /*
2  * Tested interface: AtkImage
3  *
4  * Tested AtkObject: EailIcon
5  *
6  * Description: Test AtkImage 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
16 #include "eail_test_utils.h"
17
18 #define ACTIONS_NUMBER 1
19
20 #define ICON_NAME "home"
21 #define ICON_SIZE 32
22
23 INIT_TEST("EailIcon")
24
25 static void
26 _init_icon(Evas_Object *win)
27 {
28    Evas_Object *bg, *icon;
29
30    bg = elm_bg_add(win);
31    elm_win_resize_object_add(win, bg);
32    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
33    evas_object_show(bg);
34
35    icon = elm_icon_add(win);
36    elm_icon_order_lookup_set(icon, ELM_ICON_LOOKUP_THEME_FDO);
37    elm_icon_standard_set(icon, ICON_NAME);
38    evas_object_resize(icon, ICON_SIZE, ICON_SIZE);
39    evas_object_show(icon);
40 }
41
42 static void
43 _do_test(AtkObject *obj)
44 {
45    const char *desc;
46    const char *desc_test = "top secret";
47    int height = 0, width = 0;
48    int x = -1, y = -1;
49
50    atk_image_get_image_position(ATK_IMAGE(obj), &x, &y, ATK_XY_SCREEN);
51    _printf("atk_image_get_image_position on screen: x: %d y %d\n", x, y);
52
53    g_assert(NULL == atk_image_get_image_description(ATK_IMAGE(obj)));
54    g_assert(TRUE == atk_image_set_image_description(ATK_IMAGE(obj), desc_test));
55    desc = atk_image_get_image_description(ATK_IMAGE(obj));
56    g_assert_cmpstr(desc_test, ==, desc);
57
58    atk_image_get_image_size(ATK_IMAGE(obj), &height, &width);
59    g_assert(ICON_SIZE == height && ICON_SIZE == width);
60
61    eailu_test_code_called = 1;
62 }
63
64 EAPI_MAIN int
65 elm_main(int argc, char **argv)
66 {
67    Evas_Object *win;
68
69    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
70    g_assert(win);
71    _init_icon(win);
72    evas_object_show(win);
73    elm_run();
74    elm_shutdown();
75
76    return 0;
77 }
78 ELM_MAIN()