Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_file_selector_entry_tc1.c
1 /*
2  * Tested interface: AtkAction
3  *
4  * Tested AtkObject: EailFileselectorEntry
5  *
6  * Description: Test AtkAction interface
7  *
8  * Test input: accessible object representing EailFileselectorEntry
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 #define EAIL_LABEL_FOR_FSE "Select a file"
19
20 INIT_TEST("EailFileselectorEntry")
21
22 static void
23 _do_test(AtkObject *obj)
24 {
25    int actions_num = -1;
26
27    _printf("Testing FileselectorEntry instance....\n");
28
29    g_assert(ATK_IS_OBJECT(obj));
30    g_assert(ATK_IS_ACTION(obj));
31
32    actions_num = atk_action_get_n_actions(ATK_ACTION(obj) );
33    g_assert(4 == actions_num);
34
35    eailu_test_atk_focus(obj, TRUE);
36
37    /* checking if all needed actions are implemented */
38    /* pressed */
39    eailu_test_action_activate(ATK_ACTION(obj), "press");
40
41    /* repeated */
42    eailu_test_action_activate(ATK_ACTION(obj), "longpress");
43
44    /* unpressed */
45    eailu_test_action_activate(ATK_ACTION(obj), "release");
46
47    /* clicked */
48    eailu_test_action_activate(ATK_ACTION(obj), "click");
49
50    /* test for non-existing action */
51    g_assert((eailu_get_action_number(ATK_ACTION(obj), "typo")) == -1);
52
53    /* test set/get action description */
54    eailu_test_action_description_all(ATK_ACTION(obj));
55
56    _printf("DONE. All FileselectorEntry test passed successfully \n");
57
58    eailu_test_code_called = 1;
59 }
60
61 static void
62 _init_file_selector_button(Evas_Object *win)
63 {
64    Evas_Object *fs_entry, *vbox, *icon;
65
66    vbox = elm_box_add(win);
67    elm_win_resize_object_add(win, vbox);
68    evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
69    evas_object_show(vbox);
70
71    icon = elm_icon_add(win);
72    elm_icon_standard_set(icon, "file");
73    evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
74
75    /* file selector entry */
76    fs_entry = elm_fileselector_entry_add(win);
77    evas_object_size_hint_align_set(fs_entry, EVAS_HINT_FILL, 0);
78    elm_fileselector_entry_path_set(fs_entry, "/tmp");
79    elm_object_text_set(fs_entry, EAIL_LABEL_FOR_FSE);
80    elm_object_part_content_set(fs_entry, "button icon", icon);
81
82    elm_box_pack_end(vbox, fs_entry);
83    evas_object_show(fs_entry);
84    evas_object_resize(win, 300, 300);
85 }
86
87 EAPI_MAIN int
88 elm_main(int argc, char **argv)
89 {
90    Evas_Object *win;
91
92    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
93    _init_file_selector_button(win);
94
95    evas_object_show(win);
96
97    elm_run();
98    elm_shutdown();
99
100    return 0;
101 }
102 ELM_MAIN()