Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_thumb_tc3.c
1 /*
2  * Tested interface: AtkImage
3  *
4  * Tested AtkObject: EailThumb
5  *
6  * Description: Test AtkImage interface
7  *
8  * Test input: accessible object representing EailThumb
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 INIT_TEST("EailThumb")
21
22 static void
23 _init_thumb(Evas_Object *win)
24 {
25    const char *filename = "./data/06.jpg";
26    Evas_Object *bg, *thumb;
27
28    elm_need_ethumb();
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    thumb = elm_thumb_add(win);
36    elm_thumb_editable_set(thumb, EINA_FALSE);
37    elm_thumb_file_set(thumb, filename, NULL);
38    elm_thumb_reload(thumb);
39    evas_object_size_hint_weight_set(thumb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
40    elm_win_resize_object_add(win, thumb);
41    evas_object_show(thumb);
42 }
43
44 static void
45 _do_test(AtkObject *obj)
46 {
47    const char * const desc_test = "top secret";
48    const char *desc;
49    int height = 0, width = 0;
50    int x = -1, y = -1;
51
52    g_assert(ATK_IS_IMAGE(obj));
53
54    atk_image_get_image_position(ATK_IMAGE(obj), &x, &y, ATK_XY_SCREEN);
55
56    g_assert(NULL == atk_image_get_image_description(ATK_IMAGE(obj)));
57    g_assert(TRUE == atk_image_set_image_description(ATK_IMAGE(obj), desc_test));
58    desc = atk_image_get_image_description(ATK_IMAGE(obj));
59    g_assert(NULL != desc);
60    g_assert_cmpstr(desc_test, ==, desc);
61
62    atk_image_get_image_size(ATK_IMAGE(obj), &height, &width);
63    g_assert(height == 128 && width == 128);
64
65    eailu_test_code_called = 1;
66 }
67
68 EAPI_MAIN int
69 elm_main(int argc, char **argv)
70 {
71    Evas_Object *win;
72
73    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
74    g_assert(win);
75    _init_thumb(win);
76    evas_object_show(win);
77    elm_run();
78    elm_shutdown();
79
80    return 0;
81 }
82 ELM_MAIN()