Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_photo_tc1.c
1 /*
2  * Tested interface: AtkObject
3  *
4  * Tested AtkObject: EailPhoto
5  *
6  * Description: Test AtkObject 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 #define DEBUG 1
18
19 INIT_TEST("EailPhoto")
20
21 static void
22 _do_test(AtkObject *obj)
23 {
24    g_assert(ATK_IS_OBJECT(obj));
25
26    g_assert(atk_object_get_role(obj) == ATK_ROLE_IMAGE);
27
28    atk_object_set_name(obj, "test name");
29    g_assert_cmpstr(atk_object_get_name(obj), ==, "test name");
30
31    AtkStateSet *state_set = atk_object_ref_state_set(obj);
32    g_assert(!atk_state_set_is_empty(state_set));
33    g_object_unref(state_set);
34
35    eailu_test_code_called = 1;
36 }
37
38 static void
39 _init_photo(Evas_Object *win)
40 {
41    Evas_Object *bx, *photo;
42    const char * const filename = "data/th-whiterabbit01.jpg";
43
44    bx = elm_box_add(win);
45    elm_box_horizontal_set(bx, EINA_TRUE);
46    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
47    evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
48    elm_box_homogeneous_set(bx, EINA_TRUE);
49    elm_win_resize_object_add(win, bx);
50
51    photo = elm_photo_add(win);
52    g_assert(elm_photo_file_set(photo, filename));
53    elm_photo_size_set(photo, 100);
54    elm_photo_aspect_fixed_set(photo, EINA_FALSE);
55    evas_object_size_hint_weight_set(photo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
56    elm_photo_fill_inside_set(photo, EINA_TRUE);
57    evas_object_size_hint_align_set(photo, EVAS_HINT_FILL, EVAS_HINT_FILL);
58    elm_box_pack_end(bx, photo);
59    evas_object_show(photo);
60
61    evas_object_show(bx);
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(NULL, _on_focus_in);
70    g_assert(win);
71    _init_photo(win);
72    evas_object_show(win);
73    elm_run();
74    elm_shutdown();
75
76    return 0;
77 }
78 ELM_MAIN()