1 #ifndef EAIL_TEST_UTILS_H_
2 #define EAIL_TEST_UTILS_H_
5 #include <Elementary.h>
11 #define float_epsilon 0.00001
12 #define float_equal(a,b) (fabs((a) - (b)) < float_epsilon)
14 #define INIT_TEST(type_name) \
15 static int eailu_test_code_called; \
16 static void _on_done(void *data, Evas_Object *obj, void *event_info) \
20 static void _do_test(AtkObject *obj); \
21 static void _on_focus_in(void *data, Evas_Object *obj, void *event_info) \
23 AtkObject *aobj = atk_get_root(); \
25 eailu_traverse_children_for_type_call_cb( \
26 aobj, type_name, _do_test); \
27 g_assert(eailu_test_code_called); \
28 _on_done(NULL, NULL, NULL); \
31 typedef void(* Eailu_Test_Func_Cb)(AtkObject *obj);
34 * Checks is AktObject has given type name
36 gboolean eailu_is_object_with_type(AtkObject *obj, gchar *type_name);
39 * Checks if AtkObject has given object name
41 gboolean eailu_is_object_with_name(AtkObject *obj, gchar *name);
44 * Checks if AtkObject has given atk role (AtkRole enum)
46 gboolean eailu_is_object_with_role(AtkObject *obj, AtkRole role);
49 * Goes for every child in objects hierarchy looking for given type_name.
50 * If given type has been found, then test_cb callback is called on it.
52 * @param obj Object to iterate on
53 * @param type_Name string representing type or NULL if all objects should
55 * @param test_cb Callback to test function which will be performed on every
58 void eailu_traverse_children_for_type_call_cb(AtkObject *obj,
60 Eailu_Test_Func_Cb test_cb);
63 * Goes for every child in objects hierarchy looking for given atk role.
64 * If given type has been found, then test_cb callback is called on it.
66 * @param obj Object to iterate on
67 * @param role representing atk role (AtkRole enum)
68 * @param test_cb Callback to test function which will be performed on every
71 void eailu_traverse_children_for_role_call_cb(AtkObject *obj,
73 Eailu_Test_Func_Cb test_cb);
76 * Gets object with given name from child hierarchy or NULL if not found
78 AtkObject * eailu_find_child_with_name(AtkObject *obj, gchar *name);
81 * Initializes glib, gobject and creates EFL test window
84 Evas_Object * eailu_create_test_window_with_glib_init(Evas_Smart_Cb on_done,
85 Evas_Smart_Cb on_focus_in);
87 void eailu_print_atk_object_info(AtkObject *obj);
90 * Gets action number for given action name in AtkAction object
92 * @return returns action index number or -1 if action with given name has
95 int eailu_get_action_number(AtkAction *action_obj,const gchar *action_name);
97 /* Executes test routing for action with given name. If something will be wrong
98 * with given action, then assertion will fail */
99 void eailu_test_action_activate(AtkAction *action_obj,
100 const gchar *action_name);
102 void eailu_test_action_description_all(AtkAction *action_obj);
105 * Tests "focus" functionality
106 * @oaram obj: object to test
107 * @param focusable: TRUE if focusable shoulbe be handled by component or
110 void eailu_test_atk_focus(AtkObject *obj, gboolean focusable);
115 inline static void _printf(const char *format, ...)
120 va_start(args, format);
121 vfprintf(stdout, format, args);
131 #endif /* TEST_UTILS_H_ */