2 * Tested interface: AtkAction
4 * Tested AtkObject: EailFileselector
6 * Description: Test AtkAction interface
8 * Test input: accessible object representing EailFileselector
10 * Expected test result: test should return 0 (success)
13 #include <Elementary.h>
16 #include "eail_test_utils.h"
18 #define ACTIONS_NUMBER 3
19 #define EAIL_LABEL_FOR_FSB "File selector button"
21 static int action_test_passed;
23 INIT_TEST("EailButton")
26 _on_click(void *data, Evas_Object *obj, void *event_info)
28 _printf("fileselector button click\n");
33 _on_press(void *data, Evas_Object *obj, void *event_info)
35 _printf("fileselector button press\n");
40 _on_release(void *data, Evas_Object *obj, void *event_info)
42 _printf("fileselector button release\n");
47 _do_test(AtkObject *obj)
49 _printf("Testing FileSelectorButton instance....\n");
51 g_assert(ATK_IS_OBJECT(obj));
52 g_assert(ATK_IS_ACTION(obj));
54 g_assert(ACTIONS_NUMBER == atk_action_get_n_actions(ATK_ACTION(obj)));
55 eailu_test_action_activate(ATK_ACTION(obj), "click");
56 eailu_test_action_activate(ATK_ACTION(obj), "press");
57 eailu_test_action_activate(ATK_ACTION(obj), "release");
58 g_assert((eailu_get_action_number(ATK_ACTION(obj), "typo")) == -1);
60 eailu_test_atk_focus(obj, TRUE);
62 _printf("DONE. All FileSelectorButton test passed successfully \n");
64 g_assert(action_test_passed == 3);
66 eailu_test_code_called = 1;
70 _init_file_selector_button(Evas_Object *win)
72 Evas_Object *fs_button, *vbox, *icon;
74 vbox = elm_box_add(win);
75 elm_win_resize_object_add(win, vbox);
76 evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
77 evas_object_show(vbox);
79 icon = elm_icon_add(win);
80 elm_icon_standard_set(icon, "file");
81 evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
83 /* file selector button */
84 fs_button = elm_fileselector_button_add(win);
85 elm_fileselector_button_path_set(fs_button, "/tmp");
86 elm_object_text_set(fs_button, EAIL_LABEL_FOR_FSB);
87 elm_object_part_content_set(fs_button, "icon", icon);
88 evas_object_smart_callback_add(fs_button, "clicked", _on_click, NULL);
89 evas_object_smart_callback_add(fs_button, "pressed", _on_press, NULL);
90 evas_object_smart_callback_add(fs_button, "unpressed", _on_release, NULL);
92 elm_box_pack_end(vbox, fs_button);
93 evas_object_show(fs_button);
94 evas_object_resize(win, 300, 300);
98 elm_main(int argc, char **argv)
102 win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
103 _init_file_selector_button(win);
104 evas_object_show(win);