Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_video_tc2.c
1 /*
2  * Tested interface: AtkAction
3  *
4  * Tested AtkObject: EailVideo
5  *
6  * Description: Test AtkAction interface
7  *
8  * Test input: accessible object representing EailVideo
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 VIDEO_FILE "./data/softboy.avi"
18
19 INIT_TEST("EailVideo")
20
21 static void
22 _do_test(AtkObject *object)
23 {
24    AtkAction *action;
25    gboolean success;
26    const gchar *name, *action_name;
27    int action_num;
28
29    g_assert(ATK_IS_ACTION(object));
30    action = ATK_ACTION(object);
31    action_num =  atk_action_get_n_actions(action);
32    g_assert(action_num == 7);
33    action_name = atk_action_get_name(action, 2);
34    g_assert(!strcmp(action_name, "pause"));
35    success =  atk_action_set_description(action, 2, "pause action desc");
36    g_assert(success);
37    name = atk_action_get_description(action, 2);
38    g_assert(!strcmp(name, "pause action desc"));
39    success = atk_action_do_action(action, 2);
40
41    /* test set/get action description */
42    eailu_test_action_description_all(ATK_ACTION(object));
43
44    eailu_test_code_called = 1;
45 }
46
47 static void
48 _playback_started(void *data, Evas_Object *obj, void *ev)
49 {
50    _on_focus_in(NULL, data, NULL);
51 }
52
53 static void
54 _init_video(Evas_Object *win)
55 {
56    Evas_Object *bg, *video, *emotion;
57
58    bg = elm_bg_add(win);
59    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
60    elm_win_resize_object_add(win, bg);
61    evas_object_show(bg);
62
63    video = elm_video_add(win);
64    evas_object_size_hint_weight_set(video, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
65    elm_win_resize_object_add(win, video);
66    evas_object_show(video);
67
68
69    elm_video_file_set(video, VIDEO_FILE);
70    elm_video_play(video);
71    emotion = elm_video_emotion_get(video);
72    evas_object_smart_callback_add(emotion,
73                                   "playback_started",
74                                   _playback_started,
75                                   win);
76
77    evas_object_resize(win, 800, 800);
78    evas_object_show(win);
79 }
80
81 EAPI_MAIN int
82 elm_main(int argc, char **argv)
83 {
84    Evas_Object *win;
85
86    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
87    _init_video(win);
88
89    elm_run();
90    elm_shutdown();
91
92    return 0;
93 }
94 ELM_MAIN()