Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_image_tc1.c
1 /*
2  * Tested interface: AtkObject
3  *
4  * Tested AtkObject: EailImage
5  *
6  * Description: Test whether accessible object is successfully registered
7  *    in GObject type system and is visible in AtkObject tree.
8  *
9  * Test input: accessible object representing EailImage
10  *
11  * Expected test result: test should return 0 (success)
12  */
13
14 #include <Elementary.h>
15 #include <atk/atk.h>
16
17 #include "eail_test_utils.h"
18
19 INIT_TEST("EailImage")
20
21 static void
22 _do_test(AtkObject *obj)
23 {
24
25    const char *desc_test = "top secret";
26
27    g_assert(ATK_IS_OBJECT(obj));
28
29    g_assert(atk_object_get_role(obj) == ATK_ROLE_IMAGE);
30
31    atk_object_set_description(obj, desc_test);
32    g_assert_cmpstr(atk_object_get_description(obj), ==, desc_test);
33
34    atk_object_set_name(obj, "test name");
35    g_assert_cmpstr(atk_object_get_name(obj), ==, "test name");
36
37    AtkStateSet *state_set = atk_object_ref_state_set(obj);
38    AtkStateType state_types[] = {ATK_STATE_ANIMATED, ATK_STATE_RESIZABLE};
39    if (atk_state_set_contains_states(state_set, state_types, 2))
40      _printf("atk_ref_state_set: animated and resizable set\n");
41    g_object_unref(state_set);
42
43    eailu_test_code_called = 1;
44 }
45
46 static void
47 _init_image(Evas_Object *win)
48 {
49    Evas_Object *bg, *image;
50    const char * const filename = "./data/whiterabbit01.jpg";
51
52    bg = elm_bg_add(win);
53    elm_bg_color_set(bg, 255, 255, 255);
54    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
55    elm_win_resize_object_add(win, bg);
56    evas_object_show(bg);
57
58    image = elm_image_add(win);
59    g_assert(elm_image_file_set(image, filename, NULL));
60    elm_image_no_scale_set(image, EINA_TRUE);
61    elm_image_resizable_set(image, EINA_FALSE, EINA_TRUE);
62    elm_image_smooth_set(image, EINA_FALSE);
63    elm_image_orient_set(image, ELM_IMAGE_FLIP_HORIZONTAL);
64    elm_image_aspect_fixed_set(image, EINA_TRUE);
65    elm_image_fill_outside_set(image, EINA_TRUE);
66    elm_image_editable_set(image, EINA_TRUE);
67    evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
68    elm_win_resize_object_add(win, image);
69    evas_object_show(image);
70 }
71
72 EAPI_MAIN int
73 elm_main(int argc, char **argv)
74 {
75    Evas_Object *win;
76
77    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
78    g_assert(win);
79    _init_image(win);
80    evas_object_show(win);
81    elm_run();
82    elm_shutdown();
83
84    return 0;
85 }
86 ELM_MAIN()