Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_photocam_tc2.c
1 /*
2  * Tested interface: AtkAction
3  *
4  * Tested AtkObject: EailPhotocam
5  *
6  * Description: Test AtkAction 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 #include "eail_test_utils.h"
16
17 #define ACTIONS_NUMBER 7
18
19 static int action_test_passed;
20
21 INIT_TEST("EailPhotocam")
22
23 static void
24 _on_photocam_clicked(void *data, Evas_Object *obj, void *ev)
25 {
26    action_test_passed = 1;
27 }
28
29 static void
30 _do_test(AtkObject *obj)
31 {
32    g_assert(ATK_IS_ACTION(obj));
33
34    g_assert(ACTIONS_NUMBER == atk_action_get_n_actions(ATK_ACTION(obj)));
35
36    eailu_test_action_activate(ATK_ACTION(obj), "click");
37
38    g_assert((eailu_get_action_number(ATK_ACTION(obj), "typo")) == -1);
39
40    eailu_test_action_description_all(ATK_ACTION(obj));
41
42    for (int count = 0; ACTIONS_NUMBER > count; count++)
43      g_assert(atk_action_do_action(ATK_ACTION(obj), count));
44
45    g_assert(action_test_passed);
46
47    eailu_test_code_called = 1;
48 }
49
50 static void
51 _init_photocam(Evas_Object *win)
52 {
53    Evas_Object *bg, *photocam;
54    const char * const filename = "./data/whiterabbit01.jpg";
55
56    bg = elm_bg_add(win);
57    elm_bg_color_set(bg, 255, 255, 255);
58    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
59    elm_win_resize_object_add(win, bg);
60    evas_object_show(bg);
61
62    photocam = elm_photocam_add(win);
63    g_assert(EVAS_LOAD_ERROR_NONE == elm_photocam_file_set(photocam, filename));
64    elm_scroller_bounce_set(photocam, EINA_FALSE, EINA_TRUE);
65    evas_object_resize(photocam, 300, 300);
66    evas_object_show(photocam);
67    evas_object_smart_callback_add(photocam, "clicked", _on_photocam_clicked, NULL);
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    g_assert(win);
77    _init_photocam(win);
78    evas_object_show(win);
79    elm_run();
80    elm_shutdown();
81
82    return 0;
83 }
84 ELM_MAIN()