Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_photo_tc3.c
1 /*
2  * Tested interface: AtkImage
3  *
4  * Tested AtkObject: EailPhoto
5  *
6  * Description: Test AtkImage interface
7  *
8  * Test input: accessible object representing EailPhoto
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 INIT_TEST("EailPhoto")
18
19 static void
20 _do_test(AtkObject *obj)
21 {
22    const char * const desc_test = "top secret";
23    const char *desc;
24    int height = 0, width  = 0;
25    int x = -1, y = -1;
26
27    g_assert(ATK_IS_IMAGE(obj));
28
29    atk_image_get_image_position(ATK_IMAGE(obj), &x, &y, ATK_XY_SCREEN);
30    _printf("atk_image_get_image_position on screen: x: %d y %d\n", x, y);
31
32    g_assert(NULL == atk_image_get_image_description(ATK_IMAGE(obj)));
33    g_assert(TRUE == atk_image_set_image_description(ATK_IMAGE(obj), desc_test));
34    desc = atk_image_get_image_description(ATK_IMAGE(obj));
35    _printf("atk_image_get_image_description: %s\n", desc ? desc : "NULL");
36    g_assert(NULL != desc);
37    g_assert_cmpstr(desc_test, ==, desc);
38
39    atk_image_get_image_size(ATK_IMAGE(obj), &height, &width);
40    _printf("atk_image_get_image_size: height %d width %d\n", height, width);
41
42    eailu_test_code_called = 1;
43 }
44
45 static void
46 _init_photo(Evas_Object *win)
47 {
48    Evas_Object *bx, *photo;
49    const char * const filename = "data/th-whiterabbit01.jpg";
50
51    bx = elm_box_add(win);
52    elm_box_horizontal_set(bx, EINA_TRUE);
53    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
54    evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
55    elm_box_homogeneous_set(bx, EINA_TRUE);
56    elm_win_resize_object_add(win, bx);
57
58    photo = elm_photo_add(win);
59    g_assert(elm_photo_file_set(photo, filename));
60    elm_photo_size_set(photo, 100);
61    elm_photo_aspect_fixed_set(photo, EINA_FALSE);
62    evas_object_size_hint_weight_set(photo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
63    elm_photo_fill_inside_set(photo, EINA_TRUE);
64    evas_object_size_hint_align_set(photo, EVAS_HINT_FILL, EVAS_HINT_FILL);
65    elm_box_pack_end(bx, photo);
66    evas_object_show(photo);
67
68    evas_object_show(bx);
69 }
70
71 EAPI_MAIN int
72 elm_main(int argc, char **argv)
73 {
74    Evas_Object *win;
75
76    win = eailu_create_test_window_with_glib_init(NULL, _on_focus_in);
77    g_assert(win);
78    _init_photo(win);
79
80    evas_object_show(win);
81    elm_run();
82    elm_shutdown();
83
84    return 0;
85 }
86 ELM_MAIN()