Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_photocam_tc3.c
1 /*
2  * Tested interface: AtkImage
3  *
4  * Tested AtkObject: EailPhotocam
5  *
6  * Description: Test AtkImage interface
7  *
8  * Test input: accessible object representing EailPhotocam
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 INIT_TEST("EailPhotocam")
19
20 static void
21 _do_test(AtkObject *obj)
22 {
23    const char * const desc_test = "top secret";
24    const char *desc;
25    int height = 0, width  = 0;
26    int x = -1, y = -1;
27
28    g_assert(ATK_IS_IMAGE(obj));
29
30    atk_image_get_image_position(ATK_IMAGE(obj), &x, &y, ATK_XY_SCREEN);
31    _printf("atk_image_get_image_position on screen: x: %d y %d\n", x, y);
32
33    g_assert(NULL == atk_image_get_image_description(ATK_IMAGE(obj)));
34    g_assert(TRUE == atk_image_set_image_description(ATK_IMAGE(obj), desc_test));
35    desc = atk_image_get_image_description(ATK_IMAGE(obj));
36    _printf("atk_image_get_image_description: %s\n", desc ? desc : "NULL");
37    g_assert(NULL != desc);
38    g_assert_cmpstr(desc_test, ==, desc);
39
40    atk_image_get_image_size(ATK_IMAGE(obj), &height, &width);
41    _printf("atk_image_get_image_size: height %d width %d\n", height, width);
42
43    eailu_test_code_called = 1;
44 }
45
46 static void
47 _init_photocam(Evas_Object *win)
48 {
49    Evas_Object *bg, *photocam;
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    photocam = elm_photocam_add(win);
59    g_assert(EVAS_LOAD_ERROR_NONE == elm_photocam_file_set(photocam, filename));
60    elm_scroller_bounce_set(photocam, EINA_FALSE, EINA_TRUE);
61    evas_object_resize(photocam, 300, 300);
62    evas_object_show(photocam);
63 }
64
65 EAPI_MAIN int
66 elm_main(int argc, char **argv)
67 {
68    Evas_Object *win;
69
70    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
71    g_assert(win);
72    _init_photocam(win);
73    evas_object_show(win);
74    elm_run();
75    elm_shutdown();
76
77    return 0;
78 }
79 ELM_MAIN()