Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_background_tc2.c
1 /*
2  * Tested interface: AtkImage
3  *
4  * Tested AtkObject: EailBackground
5  *
6  * Description: Test AtkImage interface
7  *
8  * Test input: accessible object representing EailBackground
9  *
10  * Expected test result: test should return 0 (success)
11  */
12
13 #include <Elementary.h>
14 #include <Ecore_X.h>
15 #include <atk/atk.h>
16
17 #include "eail_test_utils.h"
18
19 #define DEBUG
20
21 #define TEST_STR "bg-test"
22 #define IMG_PATH "./data/08.jpg"
23 #define X 50
24 #define Y 60
25 #define WIDTH 320
26 #define HEIGHT 280
27
28 INIT_TEST("EailBackground")
29
30 static void
31 _do_test(AtkObject *obj)
32 {
33    const char *desc;
34    int w, h;
35
36    g_assert(ATK_IS_IMAGE(obj));
37
38    g_assert(atk_image_set_image_description(ATK_IMAGE(obj), TEST_STR));
39    desc = atk_image_get_image_description(ATK_IMAGE(obj));
40    g_assert(!g_strcmp0(desc, TEST_STR));
41
42    atk_image_get_image_size(ATK_IMAGE(obj), &w, &h);
43    g_assert(w == WIDTH);
44    g_assert(h == HEIGHT);
45
46    atk_image_get_image_position(ATK_IMAGE(obj), &w, &h, ATK_XY_WINDOW);
47    g_assert(w == 0);
48    g_assert(h == 0);
49
50    eailu_test_code_called = 1;
51 }
52
53 static void
54 _init_background(Evas_Object *win)
55 {
56    Evas_Object *bg;
57    char buf[PATH_MAX];
58
59    bg = elm_bg_add(win);
60    elm_bg_load_size_set(bg, 20, 20);
61    elm_bg_option_set(bg, ELM_BG_OPTION_STRETCH);
62    g_snprintf(buf, sizeof(buf), IMG_PATH);
63    elm_bg_file_set(bg, buf, NULL);
64    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
65    elm_win_resize_object_add(win, bg);
66    evas_object_show(bg);
67    evas_object_resize(win, WIDTH, HEIGHT);
68 }
69
70 EAPI_MAIN int
71 elm_main(int argc, char **argv)
72 {
73    Evas_Object *win;
74
75    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
76    _init_background(win);
77    evas_object_show(win);
78    elm_run();
79    elm_shutdown();
80
81    return 0;
82 }
83 ELM_MAIN()