diff options
Diffstat (limited to 'tests')
21 files changed, 843 insertions, 826 deletions
diff --git a/tests/at-spi2-atk/README b/tests/at-spi2-atk/README index 011e655c..3244f2af 100644 --- a/tests/at-spi2-atk/README +++ b/tests/at-spi2-atk/README @@ -185,7 +185,7 @@ AVAILABLE TESTS: -text_get_text_attributes -text_get_attribute_run -text_get_get_text_attribute_value - -text_get_defualt_attributes + -text_get_default_attributes -text_set_caret_offset -text_get_string_at_offset -text_get_character_at_offset diff --git a/tests/at-spi2-atk/atk_suite.c b/tests/at-spi2-atk/atk_suite.c index f70e8cb8..7132c148 100644 --- a/tests/at-spi2-atk/atk_suite.c +++ b/tests/at-spi2-atk/atk_suite.c @@ -53,11 +53,25 @@ atk_suite_build (void) int main (int argc, char **argv) { + int init_result; + g_test_init (&argc, &argv, NULL); - clean_exit_on_fail (); + init_result = atspi_init (); + if (init_result != 0) + { + g_error ("Could not initialize atspi, code %d", init_result); + } + + fixture_listener_init (); atk_suite_build (); - return g_test_run (); + int result = g_test_run (); + g_assert_cmpint (result, ==, 0); + + int leaked = atspi_exit (); + g_assert_cmpint (leaked, ==, 0); + + return 0; } diff --git a/tests/at-spi2-atk/atk_suite.h b/tests/at-spi2-atk/atk_suite.h index 0ae2e6f1..abcfce43 100644 --- a/tests/at-spi2-atk/atk_suite.h +++ b/tests/at-spi2-atk/atk_suite.h @@ -25,22 +25,6 @@ #include <atspi/atspi.h> -#define ATK_TEST_PATH_ACCESSIBLE (const char *) "/Accessible" -#define ATK_TEST_PATH_ACTION (const char *) "/Action" -#define ATK_TEST_PATH_COMP (const char *) "/Component" -#define ATK_TEST_PATH_COLLECTION (const char *) "/Collection" -#define ATK_TEST_PATH_DOC (const char *) "/Document" -#define ATK_TEST_PATH_EDIT_TEXT (const char *) "/Editable_Text" -#define ATK_TEST_PATH_HYPERLINK (const char *) "/Hyperlink" -#define ATK_TEST_PATH_HYPERTEXT (const char *) "/Hypertext" -#define ATK_TEST_PATH_IMAGE (const char *) "/Image" -#define ATK_TEST_PATH_SELECTION (const char *) "/Selection" -#define ATK_TEST_PATH_STATE_SET (const char *) "/State_Set" -#define ATK_TEST_PATH_TABLE (const char *) "/Table" -#define ATK_TEST_PATH_TABLE_CELL (const char *) "/Table_Cell" -#define ATK_TEST_PATH_TEXT (const char *) "/Text" -#define ATK_TEST_PATH_VALUE (const char *) "/Value" - void atk_test_accessible (void); void atk_test_action (void); void atk_test_component (void); diff --git a/tests/at-spi2-atk/atk_test_accessible.c b/tests/at-spi2-atk/atk_test_accessible.c index 74579c9b..b8a9665a 100644 --- a/tests/at-spi2-atk/atk_test_accessible.c +++ b/tests/at-spi2-atk/atk_test_accessible.c @@ -26,63 +26,57 @@ #define DATA_FILE TESTS_DATA_DIR "/test-accessible.xml" static void -teardown_accessible_test (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_name (TestAppFixture *fixture, gconstpointer user_data) { - terminate_app (); -} - -static void -atk_test_accessible_get_name (gpointer fixture, gconstpointer user_data) -{ - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object"); } static void -atk_test_accessible_get_description (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_description (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; g_assert_cmpstr (atspi_accessible_get_description (obj, NULL), ==, "Root of the accessible tree"); } static void -atk_test_accessible_get_child_count (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_child_count (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; gint child_c = atspi_accessible_get_child_count (obj, NULL); g_assert_cmpint (3, ==, child_c); } static void -atk_test_accessible_get_parent (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_parent (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiAccessible *parent = atspi_accessible_get_parent (child, NULL); g_assert (parent == obj); } static void -atk_test_accessible_get_child_at_index (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_child_at_index (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); g_assert_cmpstr (atspi_accessible_get_name (child, NULL), ==, "obj2"); } static void -atk_test_accessible_get_index_in_parent (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_index_in_parent (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 2, NULL); int index = atspi_accessible_get_index_in_parent (child, NULL); g_assert_cmpint (index, ==, 2); } static void -atk_test_accessible_get_relation_set_1 (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_relation_set_1 (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child1 = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiAccessible *child = atspi_accessible_get_child_at_index (child1, 0, NULL); GArray *rel_set = atspi_accessible_get_relation_set (child, NULL); @@ -90,9 +84,9 @@ atk_test_accessible_get_relation_set_1 (gpointer fixture, gconstpointer user_dat } static void -atk_test_accessible_get_relation_set_2 (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_relation_set_2 (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *obj2 = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiAccessible *obj2_1 = atspi_accessible_get_child_at_index (obj2, 0, NULL); GArray *rel_set = atspi_accessible_get_relation_set (obj2_1, NULL); @@ -108,33 +102,33 @@ atk_test_accessible_get_relation_set_2 (gpointer fixture, gconstpointer user_dat } static void -atk_test_accessible_get_role (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_role (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiRole root_role = atspi_accessible_get_role (obj, NULL); g_assert_cmpint (root_role, ==, ATSPI_ROLE_ACCELERATOR_LABEL); } static void -atk_test_accessible_get_role_name (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_role_name (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; gchar *root_role_name = atspi_accessible_get_role_name (obj, NULL); g_assert_cmpstr (root_role_name, ==, "accelerator label"); } static void -atk_test_accessible_get_localized_role_name (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_localized_role_name (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; gchar *root_role_name = atspi_accessible_get_localized_role_name (obj, NULL); g_assert_cmpstr (root_role_name, ==, "accelerator label"); } static void -atk_test_accessible_get_state_set (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_state_set (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiStateSet *states = atspi_accessible_get_state_set (child); GArray *states_arr = atspi_state_set_get_states (states); @@ -154,9 +148,9 @@ atk_test_accessible_get_state_set (gpointer fixture, gconstpointer user_data) } static void -atk_test_accessible_get_attributes (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_attributes (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; GHashTable *attr_hash_tab = atspi_accessible_get_attributes (obj, NULL); GHashTableIter iter; gpointer key, value; @@ -184,9 +178,9 @@ atk_test_accessible_get_attributes (gpointer fixture, gconstpointer user_data) } static void -atk_test_accessible_get_attributes_as_array (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_attributes_as_array (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; GArray *attr_arr = atspi_accessible_get_attributes_as_array (obj, NULL); int i; g_assert_cmpint (attr_arr->len, ==, 2); @@ -199,139 +193,139 @@ atk_test_accessible_get_attributes_as_array (gpointer fixture, gconstpointer use } static void -atk_test_accessible_get_toolkit_name (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_toolkit_name (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; gchar *toolkit_name = atspi_accessible_get_toolkit_name (obj, NULL); g_assert_cmpstr (toolkit_name, ==, "atspitesting-toolkit"); } static void -atk_test_accessible_get_toolkit_version (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_toolkit_version (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; gchar *toolkit_ver = atspi_accessible_get_toolkit_version (obj, NULL); /* should be empty string, because no value is setted */ g_assert_cmpstr (toolkit_ver, ==, ""); } static void -atk_test_accessible_get_atspi_version (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_atspi_version (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; gchar *atspi_version = atspi_accessible_get_atspi_version (obj, NULL); g_assert_cmpstr (atspi_version, ==, "2.1"); } static void -atk_test_accessible_get_id (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_id (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; gint app_id = atspi_accessible_get_id (obj, NULL); g_assert_cmpint (app_id, !=, -1); } static void -atk_test_accessible_get_application (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_application (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *app = atspi_accessible_get_application (obj, NULL); g_assert (app != NULL); } static void -atk_test_accessible_get_action_iface (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_action_iface (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAction *iface = atspi_accessible_get_action_iface (obj); g_assert (iface == NULL); } static void -atk_test_accessible_get_collection_iface (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_collection_iface (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiCollection *iface = atspi_accessible_get_collection_iface (obj); g_assert (iface != NULL); } static void -atk_test_accessible_get_component_iface (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_component_iface (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiComponent *iface = atspi_accessible_get_component_iface (obj); g_assert (iface == NULL); } static void -atk_test_accessible_get_document_iface (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_document_iface (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiDocument *iface = atspi_accessible_get_document_iface (obj); g_assert (iface == NULL); } static void -atk_test_accessible_get_editable_text_iface (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_editable_text_iface (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (obj); g_assert (iface == NULL); } static void -atk_test_accessible_get_hypertext_iface (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_hypertext_iface (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiHypertext *iface = atspi_accessible_get_hypertext_iface (obj); g_assert (iface == NULL); } static void -atk_test_accessible_get_image_iface (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_image_iface (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiImage *iface = atspi_accessible_get_image_iface (obj); g_assert (iface == NULL); } static void -atk_test_accessible_get_selection_iface (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_selection_iface (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiSelection *iface = atspi_accessible_get_selection_iface (obj); g_assert (iface == NULL); } static void -atk_test_accessible_get_table_iface (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_table_iface (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiTable *iface = atspi_accessible_get_table_iface (obj); g_assert (iface == NULL); } static void -atk_test_accessible_get_text_iface (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_text_iface (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiText *iface = atspi_accessible_get_text_iface (obj); g_assert (iface == NULL); } static void -atk_test_accessible_get_value_iface (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_value_iface (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiValue *iface = atspi_accessible_get_value_iface (obj); g_assert (iface == NULL); } static void -atk_test_accessible_get_interfaces (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_interfaces (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; gchar *valid_obj_ifaces[] = { "Accessible", "Collection" }; GArray *ifaces = atspi_accessible_get_interfaces (obj); @@ -342,17 +336,17 @@ atk_test_accessible_get_interfaces (gpointer fixture, gconstpointer user_data) } static void -atk_test_accessible_get_object_locale (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_object_locale (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; const gchar *obj_locale = atspi_accessible_get_object_locale (obj, NULL); g_assert_cmpstr (obj_locale, ==, setlocale (LC_MESSAGES, NULL)); } static void -atk_test_accessible_set_cache_mask (gpointer fixture, gconstpointer user_data) +atk_test_accessible_set_cache_mask (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiCache cache_mask = ATSPI_CACHE_ROLE; atspi_accessible_set_cache_mask (obj, cache_mask); g_assert_cmpint (obj->parent.app->cache, ==, cache_mask); @@ -369,92 +363,92 @@ atk_test_check_cache_cleared (AtspiAccessible *obj) } static void -atk_test_accessible_clear_cache (gpointer fixture, gconstpointer user_data) +atk_test_accessible_clear_cache (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; atspi_accessible_clear_cache (obj); atk_test_check_cache_cleared (obj); } static void -atk_test_accessible_get_process_id (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_process_id (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; guint proc_id = atspi_accessible_get_process_id (obj, NULL); - g_assert_cmpint (proc_id, ==, child_pid); + g_assert_cmpint (proc_id, ==, fixture->child_pid); } void atk_test_accessible (void) { - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_name", - 0, NULL, NULL, atk_test_accessible_get_name, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_description", - 0, NULL, NULL, atk_test_accessible_get_description, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_child_count", - 0, NULL, NULL, atk_test_accessible_get_child_count, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_parent", - 0, NULL, NULL, atk_test_accessible_get_parent, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_child_at_index", - 0, NULL, NULL, atk_test_accessible_get_child_at_index, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_index_in_parent", - 0, NULL, NULL, atk_test_accessible_get_index_in_parent, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_relation_set_1", - 0, NULL, NULL, atk_test_accessible_get_relation_set_1, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_relation_set_2", - 0, NULL, NULL, atk_test_accessible_get_relation_set_2, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_role", - 0, NULL, NULL, atk_test_accessible_get_role, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_role_name", - 0, NULL, NULL, atk_test_accessible_get_role_name, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_localized_role_name", - 0, NULL, NULL, atk_test_accessible_get_localized_role_name, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_state_set", - 0, NULL, NULL, atk_test_accessible_get_state_set, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_attributes", - 0, NULL, NULL, atk_test_accessible_get_attributes, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_attributes_as_array", - 0, NULL, NULL, atk_test_accessible_get_attributes_as_array, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_toolkit_name", - 0, NULL, NULL, atk_test_accessible_get_toolkit_name, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_toolkit_version", - 0, NULL, NULL, atk_test_accessible_get_toolkit_version, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_atspi_version", - 0, NULL, NULL, atk_test_accessible_get_atspi_version, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_id", - 0, NULL, NULL, atk_test_accessible_get_id, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_application", - 0, NULL, NULL, atk_test_accessible_get_application, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_action_iface", - 0, NULL, NULL, atk_test_accessible_get_action_iface, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_collection_iface", - 0, NULL, NULL, atk_test_accessible_get_collection_iface, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_component_iface", - 0, NULL, NULL, atk_test_accessible_get_component_iface, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_document_iface", - 0, NULL, NULL, atk_test_accessible_get_document_iface, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_editable_text_iface", - 0, NULL, NULL, atk_test_accessible_get_editable_text_iface, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_hypertext_iface", - 0, NULL, NULL, atk_test_accessible_get_hypertext_iface, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_image_iface", - 0, NULL, NULL, atk_test_accessible_get_image_iface, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_selection_iface", - 0, NULL, NULL, atk_test_accessible_get_selection_iface, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_table_iface", - 0, NULL, NULL, atk_test_accessible_get_table_iface, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_text_iface", - 0, NULL, NULL, atk_test_accessible_get_text_iface, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_value_iface", - 0, NULL, NULL, atk_test_accessible_get_value_iface, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_interfaces", - 0, NULL, NULL, atk_test_accessible_get_interfaces, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_object_locale", - 0, NULL, NULL, atk_test_accessible_get_object_locale, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_set_cache_mask", - 0, NULL, NULL, atk_test_accessible_set_cache_mask, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_clear_cache", - 0, NULL, NULL, atk_test_accessible_clear_cache, teardown_accessible_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_process_id", - 0, NULL, NULL, atk_test_accessible_get_process_id, teardown_accessible_test); + g_test_add ("/accessible/atk_test_accessible_get_name", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_name, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_description", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_description, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_child_count", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_child_count, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_parent", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_parent, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_child_at_index", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_child_at_index, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_index_in_parent", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_index_in_parent, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_relation_set_1", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_relation_set_1, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_relation_set_2", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_relation_set_2, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_role", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_role, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_role_name", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_role_name, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_localized_role_name", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_localized_role_name, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_state_set", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_state_set, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_attributes", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_attributes, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_attributes_as_array", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_attributes_as_array, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_toolkit_name", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_toolkit_name, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_toolkit_version", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_toolkit_version, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_atspi_version", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_atspi_version, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_id", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_id, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_application", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_application, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_action_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_action_iface, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_collection_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_collection_iface, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_component_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_component_iface, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_document_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_document_iface, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_editable_text_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_editable_text_iface, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_hypertext_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_hypertext_iface, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_image_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_image_iface, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_selection_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_selection_iface, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_table_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_table_iface, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_text_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_text_iface, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_value_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_value_iface, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_interfaces", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_interfaces, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_object_locale", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_object_locale, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_set_cache_mask", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_set_cache_mask, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_clear_cache", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_clear_cache, fixture_teardown); + g_test_add ("/accessible/atk_test_accessible_get_process_id", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_process_id, fixture_teardown); } diff --git a/tests/at-spi2-atk/atk_test_action.c b/tests/at-spi2-atk/atk_test_action.c index 18990c64..b079a8e0 100644 --- a/tests/at-spi2-atk/atk_test_action.c +++ b/tests/at-spi2-atk/atk_test_action.c @@ -26,15 +26,9 @@ #define DATA_FILE TESTS_DATA_DIR "/test-action.xml" static void -teardown_action_test (gpointer fixture, gconstpointer user_data) +atk_test_action_sample_get_interface (TestAppFixture *fixture, gconstpointer user_data) { - terminate_app (); -} - -static void -atk_test_action_sample_get_interface (gpointer fixture, gconstpointer user_data) -{ - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object"); AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiAction *iface = atspi_accessible_get_action_iface (child); @@ -42,54 +36,54 @@ atk_test_action_sample_get_interface (gpointer fixture, gconstpointer user_data) } static void -atk_test_action_get_action_description (gpointer fixture, gconstpointer user_data) +atk_test_action_get_action_description (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiAction *action = atspi_accessible_get_action_iface (child); g_assert_cmpstr (atspi_action_get_action_description (action, 0, NULL), ==, "action1 description"); } static void -atk_test_action_get_action_name (gpointer fixture, gconstpointer user_data) +atk_test_action_get_action_name (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiAction *action = atspi_accessible_get_action_iface (child); g_assert_cmpstr (atspi_action_get_action_name (action, 0, NULL), ==, "action1"); } static void -atk_test_action_get_n_actions (gpointer fixture, gconstpointer user_data) +atk_test_action_get_n_actions (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiAction *action = atspi_accessible_get_action_iface (child); g_assert_cmpint (atspi_action_get_n_actions (action, NULL), ==, 2); } static void -atk_test_action_get_key_binding (gpointer fixture, gconstpointer user_data) +atk_test_action_get_key_binding (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiAction *action = atspi_accessible_get_action_iface (child); g_assert_cmpstr (atspi_action_get_key_binding (action, 0, NULL), ==, "action1 key binding"); } static void -atk_test_action_get_localized_name (gpointer fixture, gconstpointer user_data) +atk_test_action_get_localized_name (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiAction *action = atspi_accessible_get_action_iface (child); g_assert_cmpstr (atspi_action_get_localized_name (action, 0, NULL), ==, "action1"); } static void -atk_test_action_do_action (gpointer fixture, gconstpointer user_data) +atk_test_action_do_action (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiAction *action = atspi_accessible_get_action_iface (child); g_assert (action != NULL); @@ -103,18 +97,18 @@ atk_test_action_do_action (gpointer fixture, gconstpointer user_data) void atk_test_action (void) { - g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_sample_get_interface", - 0, NULL, NULL, atk_test_action_sample_get_interface, teardown_action_test); - g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_action_description", - 0, NULL, NULL, atk_test_action_get_action_description, teardown_action_test); - g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_action_name", - 0, NULL, NULL, atk_test_action_get_action_name, teardown_action_test); - g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_n_actions", - 0, NULL, NULL, atk_test_action_get_n_actions, teardown_action_test); - g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_key_binding", - 0, NULL, NULL, atk_test_action_get_key_binding, teardown_action_test); - g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_localized_name", - 0, NULL, NULL, atk_test_action_get_localized_name, teardown_action_test); - g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_do_action", - 0, NULL, NULL, atk_test_action_do_action, teardown_action_test); + g_test_add ("/action/atk_test_action_sample_get_interface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_action_sample_get_interface, fixture_teardown); + g_test_add ("/action/atk_test_action_get_action_description", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_action_get_action_description, fixture_teardown); + g_test_add ("/action/atk_test_action_get_action_name", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_action_get_action_name, fixture_teardown); + g_test_add ("/action/atk_test_action_get_n_actions", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_action_get_n_actions, fixture_teardown); + g_test_add ("/action/atk_test_action_get_key_binding", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_action_get_key_binding, fixture_teardown); + g_test_add ("/action/atk_test_action_get_localized_name", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_action_get_localized_name, fixture_teardown); + g_test_add ("/action/atk_test_action_do_action", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_action_do_action, fixture_teardown); } diff --git a/tests/at-spi2-atk/atk_test_collection.c b/tests/at-spi2-atk/atk_test_collection.c index 184a0663..5fd4d911 100644 --- a/tests/at-spi2-atk/atk_test_collection.c +++ b/tests/at-spi2-atk/atk_test_collection.c @@ -26,23 +26,17 @@ #define DATA_FILE TESTS_DATA_DIR "/test-collection.xml" static void -teardown_collection_test (gpointer fixture, gconstpointer user_data) +atk_test_collection_get_collection_iface (TestAppFixture *fixture, gconstpointer user_data) { - terminate_app (); -} - -static void -atk_test_collection_get_collection_iface (gpointer fixture, gconstpointer user_data) -{ - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiCollection *iface = atspi_accessible_get_collection_iface (obj); g_assert (iface); } static void -atk_test_collection_get_matches (gpointer fixture, gconstpointer user_data) +atk_test_collection_get_matches (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiCollection *iface = atspi_accessible_get_collection_iface (obj); g_assert (iface); @@ -76,9 +70,9 @@ atk_test_collection_get_matches (gpointer fixture, gconstpointer user_data) } static void -atk_test_collection_get_matches_to (gpointer fixture, gconstpointer user_data) +atk_test_collection_get_matches_to (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiCollection *iface = atspi_accessible_get_collection_iface (obj); g_assert (iface); @@ -113,9 +107,9 @@ atk_test_collection_get_matches_to (gpointer fixture, gconstpointer user_data) } static void -atk_test_collection_get_matches_from (gpointer fixture, gconstpointer user_data) +atk_test_collection_get_matches_from (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiCollection *iface = atspi_accessible_get_collection_iface (obj); g_assert (iface); @@ -155,12 +149,12 @@ atk_test_collection_get_matches_from (gpointer fixture, gconstpointer user_data) void atk_test_collection (void) { - g_test_add_vtable (ATK_TEST_PATH_COLLECTION "/atk_test_collection_get_collection_iface", - 0, NULL, NULL, atk_test_collection_get_collection_iface, teardown_collection_test); - g_test_add_vtable (ATK_TEST_PATH_COLLECTION "/atk_test_collection_get_matches", - 0, NULL, NULL, atk_test_collection_get_matches, teardown_collection_test); - g_test_add_vtable (ATK_TEST_PATH_COLLECTION "/atk_test_collection_get_matches_to", - 0, NULL, NULL, atk_test_collection_get_matches_to, teardown_collection_test); - g_test_add_vtable (ATK_TEST_PATH_COLLECTION "/atk_test_collection_get_matches_from", - 0, NULL, NULL, atk_test_collection_get_matches_from, teardown_collection_test); + g_test_add ("/collection/atk_test_collection_get_collection_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_collection_get_collection_iface, fixture_teardown); + g_test_add ("/collection/atk_test_collection_get_matches", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_collection_get_matches, fixture_teardown); + g_test_add ("/collection/atk_test_collection_get_matches_to", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_collection_get_matches_to, fixture_teardown); + g_test_add ("/collection/atk_test_collection_get_matches_from", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_collection_get_matches_from, fixture_teardown); } diff --git a/tests/at-spi2-atk/atk_test_component.c b/tests/at-spi2-atk/atk_test_component.c index 82c6bebe..2bdb6f20 100644 --- a/tests/at-spi2-atk/atk_test_component.c +++ b/tests/at-spi2-atk/atk_test_component.c @@ -26,15 +26,9 @@ #define DATA_FILE TESTS_DATA_DIR "/test-component.xml" static void -teardown_component_test (gpointer fixture, gconstpointer user_data) +atk_test_component_sample (TestAppFixture *fixture, gconstpointer user_data) { - terminate_app (); -} - -static void -atk_test_component_sample (gpointer fixture, gconstpointer user_data) -{ - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object"); AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiComponent *iface = atspi_accessible_get_component_iface (child); @@ -42,9 +36,9 @@ atk_test_component_sample (gpointer fixture, gconstpointer user_data) } static void -atk_test_component_contains (gpointer fixture, gconstpointer user_data) +atk_test_component_contains (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiComponent *iface = atspi_accessible_get_component_iface (child); g_assert (iface != NULL); @@ -54,9 +48,9 @@ atk_test_component_contains (gpointer fixture, gconstpointer user_data) } static void -atk_test_component_get_accessible_at_point (gpointer fixture, gconstpointer user_data) +atk_test_component_get_accessible_at_point (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiComponent *iface = atspi_accessible_get_component_iface (child); g_assert (iface != NULL); @@ -70,9 +64,9 @@ atk_test_component_get_accessible_at_point (gpointer fixture, gconstpointer user } static void -atk_test_component_get_extents (gpointer fixture, gconstpointer user_data) +atk_test_component_get_extents (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiComponent *iface = atspi_accessible_get_component_iface (child); g_assert (iface != NULL); @@ -86,9 +80,9 @@ atk_test_component_get_extents (gpointer fixture, gconstpointer user_data) } static void -atk_test_component_get_layer (gpointer fixture, gconstpointer user_data) +atk_test_component_get_layer (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiComponent *iface = atspi_accessible_get_component_iface (child); g_assert (iface != NULL); @@ -98,9 +92,9 @@ atk_test_component_get_layer (gpointer fixture, gconstpointer user_data) } static void -atk_test_component_get_mdi_z_order (gpointer fixture, gconstpointer user_data) +atk_test_component_get_mdi_z_order (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiComponent *iface = atspi_accessible_get_component_iface (child); g_assert (iface != NULL); @@ -110,9 +104,9 @@ atk_test_component_get_mdi_z_order (gpointer fixture, gconstpointer user_data) } static void -atk_test_component_grab_focus (gpointer fixture, gconstpointer user_data) +atk_test_component_grab_focus (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiComponent *iface = atspi_accessible_get_component_iface (child); g_assert (iface != NULL); @@ -122,9 +116,9 @@ atk_test_component_grab_focus (gpointer fixture, gconstpointer user_data) } static void -atk_test_component_get_alpha (gpointer fixture, gconstpointer user_data) +atk_test_component_get_alpha (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiComponent *iface = atspi_accessible_get_component_iface (child); g_assert (iface != NULL); @@ -134,9 +128,9 @@ atk_test_component_get_alpha (gpointer fixture, gconstpointer user_data) } static void -atk_test_component_set_extents (gpointer fixture, gconstpointer user_data) +atk_test_component_set_extents (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiComponent *iface = atspi_accessible_get_component_iface (child); g_assert (iface != NULL); @@ -162,22 +156,22 @@ atk_test_component_set_extents (gpointer fixture, gconstpointer user_data) void atk_test_component (void) { - g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_sample", - 0, NULL, NULL, atk_test_component_sample, teardown_component_test); - g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_contains", - 0, NULL, NULL, atk_test_component_contains, teardown_component_test); - g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_get_accessible_at_point", - 0, NULL, NULL, atk_test_component_get_accessible_at_point, teardown_component_test); - g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_get_extents", - 0, NULL, NULL, atk_test_component_get_extents, teardown_component_test); - g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_get_layer", - 0, NULL, NULL, atk_test_component_get_layer, teardown_component_test); - g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_get_mdi_z_order", - 0, NULL, NULL, atk_test_component_get_mdi_z_order, teardown_component_test); - g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_grab_focus", - 0, NULL, NULL, atk_test_component_grab_focus, teardown_component_test); - g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_get_alpha", - 0, NULL, NULL, atk_test_component_get_alpha, teardown_component_test); - g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_set_extents", - 0, NULL, NULL, atk_test_component_set_extents, teardown_component_test); + g_test_add ("/component/atk_test_component_sample", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_component_sample, fixture_teardown); + g_test_add ("/component/atk_test_component_contains", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_component_contains, fixture_teardown); + g_test_add ("/component/atk_test_component_get_accessible_at_point", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_component_get_accessible_at_point, fixture_teardown); + g_test_add ("/component/atk_test_component_get_extents", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_component_get_extents, fixture_teardown); + g_test_add ("/component/atk_test_component_get_layer", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_component_get_layer, fixture_teardown); + g_test_add ("/component/atk_test_component_get_mdi_z_order", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_component_get_mdi_z_order, fixture_teardown); + g_test_add ("/component/atk_test_component_grab_focus", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_component_grab_focus, fixture_teardown); + g_test_add ("/component/atk_test_component_get_alpha", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_component_get_alpha, fixture_teardown); + g_test_add ("/component/atk_test_component_set_extents", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_component_set_extents, fixture_teardown); } diff --git a/tests/at-spi2-atk/atk_test_document.c b/tests/at-spi2-atk/atk_test_document.c index b0224803..fd83cb8d 100644 --- a/tests/at-spi2-atk/atk_test_document.c +++ b/tests/at-spi2-atk/atk_test_document.c @@ -1,6 +1,6 @@ /* - * AT-SPI - Assistive Technology Service Provider Interface - * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility) + * AT-SPI - Assistive Service Provider Interface + * (Gnome AccessibiliTestAppFixture, DATA_FILE, fixture_setup://wiki.gnome.org/Accessibility) * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * @@ -26,24 +26,18 @@ #define DATA_FILE TESTS_DATA_DIR "/test-document.xml" static void -teardown_document_test (gpointer fixture, gconstpointer user_data) +atk_test_document_get_document_iface (TestAppFixture *fixture, gconstpointer user_data) { - terminate_app (); -} - -static void -atk_test_document_get_document_iface (gpointer fixture, gconstpointer user_data) -{ - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiDocument *iface = atspi_accessible_get_document_iface (child); g_assert (iface != NULL); } static void -atk_test_document_get_locale (gpointer fixture, gconstpointer user_data) +atk_test_document_get_locale (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiDocument *iface = atspi_accessible_get_document_iface (child); g_assert (iface != NULL); @@ -52,9 +46,9 @@ atk_test_document_get_locale (gpointer fixture, gconstpointer user_data) } static void -atk_test_document_get_attribute_value (gpointer fixture, gconstpointer user_data) +atk_test_document_get_attribute_value (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiDocument *iface = atspi_accessible_get_document_iface (child); g_assert (iface != NULL); @@ -64,9 +58,9 @@ atk_test_document_get_attribute_value (gpointer fixture, gconstpointer user_data } static void -atk_test_document_get_attributes (gpointer fixture, gconstpointer user_data) +atk_test_document_get_attributes (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiDocument *iface = atspi_accessible_get_document_iface (child); g_assert (iface != NULL); @@ -99,12 +93,12 @@ atk_test_document_get_attributes (gpointer fixture, gconstpointer user_data) void atk_test_document (void) { - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_document_get_document_iface", - 0, NULL, NULL, atk_test_document_get_document_iface, teardown_document_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_document_get_locale", - 0, NULL, NULL, atk_test_document_get_locale, teardown_document_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_document_get_attribute_value", - 0, NULL, NULL, atk_test_document_get_attribute_value, teardown_document_test); - g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_document_get_attributes", - 0, NULL, NULL, atk_test_document_get_attributes, teardown_document_test); + g_test_add ("/document/atk_test_document_get_document_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_document_get_document_iface, fixture_teardown); + g_test_add ("/document/atk_test_document_get_locale", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_document_get_locale, fixture_teardown); + g_test_add ("/document/atk_test_document_get_attribute_value", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_document_get_attribute_value, fixture_teardown); + g_test_add ("/document/atk_test_document_get_attributes", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_document_get_attributes, fixture_teardown); } diff --git a/tests/at-spi2-atk/atk_test_editable_text.c b/tests/at-spi2-atk/atk_test_editable_text.c index 9758bf1c..dc78594f 100644 --- a/tests/at-spi2-atk/atk_test_editable_text.c +++ b/tests/at-spi2-atk/atk_test_editable_text.c @@ -26,15 +26,9 @@ #define DATA_FILE TESTS_DATA_DIR "/test-editable-text.xml" static void -teardown_editable_text_test (gpointer fixture, gconstpointer user_data) +atk_test_editable_text_get_editable_text_iface (TestAppFixture *fixture, gconstpointer user_data) { - terminate_app (); -} - -static void -atk_test_editable_text_get_editable_text_iface (gpointer fixture, gconstpointer user_data) -{ - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child); g_assert (iface != NULL); @@ -43,9 +37,9 @@ atk_test_editable_text_get_editable_text_iface (gpointer fixture, gconstpointer #if 0 /* Function is in docs but not implemented */ static void -atk_test_editable_text_set_attributes (gpointer fixture, gconstpointer user_data) +atk_test_editable_text_set_attributes (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child); g_assert (iface != NULL); @@ -55,9 +49,9 @@ atk_test_editable_text_set_attributes (gpointer fixture, gconstpointer user_dat #endif static void -atk_test_editable_text_insert_text (gpointer fixture, gconstpointer user_data) +atk_test_editable_text_insert_text (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child); g_assert (iface != NULL); @@ -65,9 +59,9 @@ atk_test_editable_text_insert_text (gpointer fixture, gconstpointer user_data) } static void -atk_test_editable_text_copy_text (gpointer fixture, gconstpointer user_data) +atk_test_editable_text_copy_text (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child); g_assert (iface != NULL); @@ -75,9 +69,9 @@ atk_test_editable_text_copy_text (gpointer fixture, gconstpointer user_data) } static void -atk_test_editable_text_cut_text (gpointer fixture, gconstpointer user_data) +atk_test_editable_text_cut_text (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child); g_assert (iface != NULL); @@ -85,9 +79,9 @@ atk_test_editable_text_cut_text (gpointer fixture, gconstpointer user_data) } static void -atk_test_editable_text_delete_text (gpointer fixture, gconstpointer user_data) +atk_test_editable_text_delete_text (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child); g_assert (iface != NULL); @@ -96,9 +90,9 @@ atk_test_editable_text_delete_text (gpointer fixture, gconstpointer user_data) } static void -atk_test_editable_text_paste_text (gpointer fixture, gconstpointer user_data) +atk_test_editable_text_paste_text (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child); g_assert (iface != NULL); @@ -109,20 +103,20 @@ atk_test_editable_text_paste_text (gpointer fixture, gconstpointer user_data) void atk_test_editable_text (void) { - g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_get_editable_text_iface", - 0, NULL, NULL, atk_test_editable_text_get_editable_text_iface, teardown_editable_text_test); + g_test_add ("/editable_text/atk_test_editable_text_get_editable_text_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_editable_text_get_editable_text_iface, fixture_teardown); #if 0 - g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_set_attributes", - 0, NULL, NULL, atk_test_editable_text_set_attributes, teardown_editable_text_test); + g_test_add ("/editable_text/atk_test_editable_text_set_attributes", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_editable_text_set_attributes, fixture_teardown); #endif - g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_insert_text", - 0, NULL, NULL, atk_test_editable_text_insert_text, teardown_editable_text_test); - g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_copy_text", - 0, NULL, NULL, atk_test_editable_text_copy_text, teardown_editable_text_test); - g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_cut_text", - 0, NULL, NULL, atk_test_editable_text_cut_text, teardown_editable_text_test); - g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_delete_text", - 0, NULL, NULL, atk_test_editable_text_delete_text, teardown_editable_text_test); - g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_paste_text", - 0, NULL, NULL, atk_test_editable_text_paste_text, teardown_editable_text_test); + g_test_add ("/editable_text/atk_test_editable_text_insert_text", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_editable_text_insert_text, fixture_teardown); + g_test_add ("/editable_text/atk_test_editable_text_copy_text", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_editable_text_copy_text, fixture_teardown); + g_test_add ("/editable_text/atk_test_editable_text_cut_text", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_editable_text_cut_text, fixture_teardown); + g_test_add ("/editable_text/atk_test_editable_text_delete_text", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_editable_text_delete_text, fixture_teardown); + g_test_add ("/editable_text/atk_test_editable_text_paste_text", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_editable_text_paste_text, fixture_teardown); } diff --git a/tests/at-spi2-atk/atk_test_hyperlink.c b/tests/at-spi2-atk/atk_test_hyperlink.c index c3293fce..81bec14d 100644 --- a/tests/at-spi2-atk/atk_test_hyperlink.c +++ b/tests/at-spi2-atk/atk_test_hyperlink.c @@ -24,9 +24,9 @@ #define DATA_FILE TESTS_DATA_DIR "/test-hypertext.xml" static void -atk_test_hyperlink_get_n_anchors (gpointer fixture, gconstpointer user_data) +atk_test_hyperlink_get_n_anchors (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -39,9 +39,9 @@ atk_test_hyperlink_get_n_anchors (gpointer fixture, gconstpointer user_data) } static void -atk_test_hyperlink_get_uri (gpointer fixture, gconstpointer user_data) +atk_test_hyperlink_get_uri (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -55,9 +55,9 @@ atk_test_hyperlink_get_uri (gpointer fixture, gconstpointer user_data) } static void -atk_test_hyperlink_get_object (gpointer fixture, gconstpointer user_data) +atk_test_hyperlink_get_object (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -75,9 +75,9 @@ atk_test_hyperlink_get_object (gpointer fixture, gconstpointer user_data) } static void -atk_test_hyperlink_get_index_range (gpointer fixture, gconstpointer user_data) +atk_test_hyperlink_get_index_range (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -96,9 +96,9 @@ atk_test_hyperlink_get_index_range (gpointer fixture, gconstpointer user_data) } static void -atk_test_hyperlink_get_start_index (gpointer fixture, gconstpointer user_data) +atk_test_hyperlink_get_start_index (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -111,9 +111,9 @@ atk_test_hyperlink_get_start_index (gpointer fixture, gconstpointer user_data) } static void -atk_test_hyperlink_get_end_index (gpointer fixture, gconstpointer user_data) +atk_test_hyperlink_get_end_index (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -126,9 +126,9 @@ atk_test_hyperlink_get_end_index (gpointer fixture, gconstpointer user_data) } static void -atk_test_hyperlink_is_valid (gpointer fixture, gconstpointer user_data) +atk_test_hyperlink_is_valid (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -139,27 +139,21 @@ atk_test_hyperlink_is_valid (gpointer fixture, gconstpointer user_data) g_assert (atspi_hyperlink_is_valid (obj, NULL)); } -static void -teardown_hyperlink_test (gpointer fixture, gconstpointer user_data) -{ - terminate_app (); -} - void atk_test_hyperlink (void) { - g_test_add_vtable (ATK_TEST_PATH_HYPERTEXT "/atk_test_hyperlink_get_n_anchors", - 0, NULL, NULL, atk_test_hyperlink_get_n_anchors, teardown_hyperlink_test); - g_test_add_vtable (ATK_TEST_PATH_HYPERTEXT "/atk_test_hyperlink_get_uri", - 0, NULL, NULL, atk_test_hyperlink_get_uri, teardown_hyperlink_test); - g_test_add_vtable (ATK_TEST_PATH_HYPERTEXT "/atk_test_hyperlink_get_object", - 0, NULL, NULL, atk_test_hyperlink_get_object, teardown_hyperlink_test); - g_test_add_vtable (ATK_TEST_PATH_HYPERTEXT "/atk_test_hyperlink_get_index_range", - 0, NULL, NULL, atk_test_hyperlink_get_index_range, teardown_hyperlink_test); - g_test_add_vtable (ATK_TEST_PATH_HYPERTEXT "/atk_test_hyperlink_get_start_index", - 0, NULL, NULL, atk_test_hyperlink_get_start_index, teardown_hyperlink_test); - g_test_add_vtable (ATK_TEST_PATH_HYPERTEXT "/atk_test_hyperlink_get_end_index", - 0, NULL, NULL, atk_test_hyperlink_get_end_index, teardown_hyperlink_test); - g_test_add_vtable (ATK_TEST_PATH_HYPERTEXT "/atk_test_hyperlink_is_valid", - 0, NULL, NULL, atk_test_hyperlink_is_valid, teardown_hyperlink_test); + g_test_add ("/hyperlink/atk_test_hyperlink_get_n_anchors", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_hyperlink_get_n_anchors, fixture_teardown); + g_test_add ("/hyperlink/atk_test_hyperlink_get_uri", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_hyperlink_get_uri, fixture_teardown); + g_test_add ("/hyperlink/atk_test_hyperlink_get_object", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_hyperlink_get_object, fixture_teardown); + g_test_add ("/hyperlink/atk_test_hyperlink_get_index_range", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_hyperlink_get_index_range, fixture_teardown); + g_test_add ("/hyperlink/atk_test_hyperlink_get_start_index", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_hyperlink_get_start_index, fixture_teardown); + g_test_add ("/hyperlink/atk_test_hyperlink_get_end_index", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_hyperlink_get_end_index, fixture_teardown); + g_test_add ("/hyperlink/atk_test_hyperlink_is_valid", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_hyperlink_is_valid, fixture_teardown); } diff --git a/tests/at-spi2-atk/atk_test_hypertext.c b/tests/at-spi2-atk/atk_test_hypertext.c index 68b8fe55..b193c8d4 100644 --- a/tests/at-spi2-atk/atk_test_hypertext.c +++ b/tests/at-spi2-atk/atk_test_hypertext.c @@ -24,9 +24,9 @@ #define DATA_FILE TESTS_DATA_DIR "/test-hypertext.xml" static void -atk_test_hypertext_get_n_links (gpointer fixture, gconstpointer user_data) +atk_test_hypertext_get_n_links (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -37,9 +37,9 @@ atk_test_hypertext_get_n_links (gpointer fixture, gconstpointer user_data) } static void -atk_test_hypertext_get_link (gpointer fixture, gconstpointer user_data) +atk_test_hypertext_get_link (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -61,9 +61,9 @@ atk_test_hypertext_get_link (gpointer fixture, gconstpointer user_data) } static void -atk_test_hypertext_get_link_index (gpointer fixture, gconstpointer user_data) +atk_test_hypertext_get_link_index (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -77,19 +77,13 @@ atk_test_hypertext_get_link_index (gpointer fixture, gconstpointer user_data) g_assert_cmpint (cnt, ==, 1); } -static void -teardown_hypertext_test (gpointer fixture, gconstpointer user_data) -{ - terminate_app (); -} - void atk_test_hypertext (void) { - g_test_add_vtable (ATK_TEST_PATH_HYPERTEXT "/atk_test_hypertext_get_n_links", - 0, NULL, NULL, atk_test_hypertext_get_n_links, teardown_hypertext_test); - g_test_add_vtable (ATK_TEST_PATH_HYPERTEXT "/atk_test_hypertext_get_links", - 0, NULL, NULL, atk_test_hypertext_get_link, teardown_hypertext_test); - g_test_add_vtable (ATK_TEST_PATH_HYPERTEXT "/atk_test_hypertext_get_link_index", - 0, NULL, NULL, atk_test_hypertext_get_link_index, teardown_hypertext_test); + g_test_add ("/hypertext/atk_test_hypertext_get_n_links", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_hypertext_get_n_links, fixture_teardown); + g_test_add ("/hypertext/atk_test_hypertext_get_links", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_hypertext_get_link, fixture_teardown); + g_test_add ("/hypertext/atk_test_hypertext_get_link_index", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_hypertext_get_link_index, fixture_teardown); } diff --git a/tests/at-spi2-atk/atk_test_image.c b/tests/at-spi2-atk/atk_test_image.c index ff42c4cd..eb8b2484 100644 --- a/tests/at-spi2-atk/atk_test_image.c +++ b/tests/at-spi2-atk/atk_test_image.c @@ -26,15 +26,9 @@ #define DATA_FILE TESTS_DATA_DIR "/test-image.xml" static void -teardown_image_test (gpointer fixture, gconstpointer user_data) +atk_test_image_sample_get_interface (TestAppFixture *fixture, gconstpointer user_data) { - terminate_app (); -} - -static void -atk_test_image_sample_get_interface (gpointer fixture, gconstpointer user_data) -{ - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object"); AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiImage *iface = atspi_accessible_get_image_iface (child); @@ -42,9 +36,9 @@ atk_test_image_sample_get_interface (gpointer fixture, gconstpointer user_data) } static void -atk_test_image_get_image_description (gpointer fixture, gconstpointer user_data) +atk_test_image_get_image_description (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiImage *image = atspi_accessible_get_image_iface (child); gchar *desc = atspi_image_get_image_description (image, NULL); @@ -54,9 +48,9 @@ atk_test_image_get_image_description (gpointer fixture, gconstpointer user_data) } static void -atk_test_image_get_image_size (gpointer fixture, gconstpointer user_data) +atk_test_image_get_image_size (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiImage *image = atspi_accessible_get_image_iface (child); AtspiPoint *p = atspi_image_get_image_size (image, NULL); @@ -68,9 +62,9 @@ atk_test_image_get_image_size (gpointer fixture, gconstpointer user_data) } static void -atk_test_image_get_image_position (gpointer fixture, gconstpointer user_data) +atk_test_image_get_image_position (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiImage *image = atspi_accessible_get_image_iface (child); AtspiPoint *p = atspi_image_get_image_position (image, ATSPI_COORD_TYPE_SCREEN, NULL); @@ -81,9 +75,9 @@ atk_test_image_get_image_position (gpointer fixture, gconstpointer user_data) } static void -atk_test_image_get_image_extents (gpointer fixture, gconstpointer user_data) +atk_test_image_get_image_extents (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiImage *image = atspi_accessible_get_image_iface (child); AtspiRect *r = atspi_image_get_image_extents (image, ATSPI_COORD_TYPE_SCREEN, NULL); @@ -98,9 +92,9 @@ atk_test_image_get_image_extents (gpointer fixture, gconstpointer user_data) } static void -atk_test_image_get_image_locale (gpointer fixture, gconstpointer user_data) +atk_test_image_get_image_locale (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL); AtspiImage *image = atspi_accessible_get_image_iface (child); gchar *locale = atspi_image_get_image_locale (image, NULL); @@ -113,16 +107,16 @@ atk_test_image_get_image_locale (gpointer fixture, gconstpointer user_data) void atk_test_image (void) { - g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_sample_get_interface", - 0, NULL, NULL, atk_test_image_sample_get_interface, teardown_image_test); - g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_description", - 0, NULL, NULL, atk_test_image_get_image_description, teardown_image_test); - g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_size", - 0, NULL, NULL, atk_test_image_get_image_size, teardown_image_test); - g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_position", - 0, NULL, NULL, atk_test_image_get_image_position, teardown_image_test); - g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_extents", - 0, NULL, NULL, atk_test_image_get_image_extents, teardown_image_test); - g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_locale", - 0, NULL, NULL, atk_test_image_get_image_locale, teardown_image_test); + g_test_add ("/image/atk_test_image_sample_get_interface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_image_sample_get_interface, fixture_teardown); + g_test_add ("/image/atk_test_image_get_image_description", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_image_get_image_description, fixture_teardown); + g_test_add ("/image/atk_test_image_get_image_size", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_image_get_image_size, fixture_teardown); + g_test_add ("/image/atk_test_image_get_image_position", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_image_get_image_position, fixture_teardown); + g_test_add ("/image/atk_test_image_get_image_extents", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_image_get_image_extents, fixture_teardown); + g_test_add ("/image/atk_test_image_get_image_locale", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_image_get_image_locale, fixture_teardown); } diff --git a/tests/at-spi2-atk/atk_test_selection.c b/tests/at-spi2-atk/atk_test_selection.c index 3c2b2b3e..e9e4f16d 100644 --- a/tests/at-spi2-atk/atk_test_selection.c +++ b/tests/at-spi2-atk/atk_test_selection.c @@ -26,15 +26,9 @@ #define DATA_FILE TESTS_DATA_DIR "/test-selection.xml" static void -teardown_selection_test (gpointer fixture, gconstpointer user_data) +atk_test_selection_sample_get_interface (TestAppFixture *fixture, gconstpointer user_data) { - terminate_app (); -} - -static void -atk_test_selection_sample_get_interface (gpointer fixture, gconstpointer user_data) -{ - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object"); AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiSelection *iface = atspi_accessible_get_selection_iface (child); @@ -42,9 +36,9 @@ atk_test_selection_sample_get_interface (gpointer fixture, gconstpointer user_da } static void -atk_test_selection_get_n_selected_children (gpointer fixture, gconstpointer user_data) +atk_test_selection_get_n_selected_children (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object"); AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiSelection *iface = atspi_accessible_get_selection_iface (child); @@ -54,9 +48,9 @@ atk_test_selection_get_n_selected_children (gpointer fixture, gconstpointer user } static void -atk_test_selection_get_selected_child (gpointer fixture, gconstpointer user_data) +atk_test_selection_get_selected_child (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object"); AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiSelection *iface = atspi_accessible_get_selection_iface (child); @@ -75,9 +69,9 @@ atk_test_selection_get_selected_child (gpointer fixture, gconstpointer user_data } static void -atk_test_selection_select_child (gpointer fixture, gconstpointer user_data) +atk_test_selection_select_child (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object"); AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiSelection *iface = atspi_accessible_get_selection_iface (child); @@ -91,9 +85,9 @@ atk_test_selection_select_child (gpointer fixture, gconstpointer user_data) } static void -atk_test_selection_deselect_selected (gpointer fixture, gconstpointer user_data) +atk_test_selection_deselect_selected (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object"); AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiSelection *iface = atspi_accessible_get_selection_iface (child); @@ -110,9 +104,9 @@ atk_test_selection_deselect_selected (gpointer fixture, gconstpointer user_data) } static void -atk_test_selection_deselect_child (gpointer fixture, gconstpointer user_data) +atk_test_selection_deselect_child (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object"); AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiSelection *iface = atspi_accessible_get_selection_iface (child); @@ -129,9 +123,9 @@ atk_test_selection_deselect_child (gpointer fixture, gconstpointer user_data) } static void -atk_test_selection_is_child_selected (gpointer fixture, gconstpointer user_data) +atk_test_selection_is_child_selected (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object"); AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiSelection *iface = atspi_accessible_get_selection_iface (child); @@ -145,9 +139,9 @@ atk_test_selection_is_child_selected (gpointer fixture, gconstpointer user_data) } static void -atk_test_selection_select_all (gpointer fixture, gconstpointer user_data) +atk_test_selection_select_all (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object"); AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiSelection *iface = atspi_accessible_get_selection_iface (child); @@ -159,9 +153,9 @@ atk_test_selection_select_all (gpointer fixture, gconstpointer user_data) } static void -atk_test_selection_clear_selection (gpointer fixture, gconstpointer user_data) +atk_test_selection_clear_selection (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object"); AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiSelection *iface = atspi_accessible_get_selection_iface (child); @@ -175,22 +169,22 @@ atk_test_selection_clear_selection (gpointer fixture, gconstpointer user_data) void atk_test_selection (void) { - g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_sample_get_interface", - 0, NULL, NULL, atk_test_selection_sample_get_interface, teardown_selection_test); - g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_get_n_selected_children", - 0, NULL, NULL, atk_test_selection_get_n_selected_children, teardown_selection_test); - g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_get_selected_child", - 0, NULL, NULL, atk_test_selection_get_selected_child, teardown_selection_test); - g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_select_child", - 0, NULL, NULL, atk_test_selection_select_child, teardown_selection_test); - g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_deselect_selected", - 0, NULL, NULL, atk_test_selection_deselect_selected, teardown_selection_test); - g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_deselect_child", - 0, NULL, NULL, atk_test_selection_deselect_child, teardown_selection_test); - g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_is_child_selected", - 0, NULL, NULL, atk_test_selection_is_child_selected, teardown_selection_test); - g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_select_all", - 0, NULL, NULL, atk_test_selection_select_all, teardown_selection_test); - g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_clear_selection", - 0, NULL, NULL, atk_test_selection_clear_selection, teardown_selection_test); + g_test_add ("/selection/atk_test_selection_sample_get_interface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_selection_sample_get_interface, fixture_teardown); + g_test_add ("/selection/atk_test_selection_get_n_selected_children", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_selection_get_n_selected_children, fixture_teardown); + g_test_add ("/selection/atk_test_selection_get_selected_child", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_selection_get_selected_child, fixture_teardown); + g_test_add ("/selection/atk_test_selection_select_child", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_selection_select_child, fixture_teardown); + g_test_add ("/selection/atk_test_selection_deselect_selected", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_selection_deselect_selected, fixture_teardown); + g_test_add ("/selection/atk_test_selection_deselect_child", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_selection_deselect_child, fixture_teardown); + g_test_add ("/selection/atk_test_selection_is_child_selected", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_selection_is_child_selected, fixture_teardown); + g_test_add ("/selection/atk_test_selection_select_all", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_selection_select_all, fixture_teardown); + g_test_add ("/selection/atk_test_selection_clear_selection", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_selection_clear_selection, fixture_teardown); } diff --git a/tests/at-spi2-atk/atk_test_state_set.c b/tests/at-spi2-atk/atk_test_state_set.c index 06f86dbb..373d9ed2 100644 --- a/tests/at-spi2-atk/atk_test_state_set.c +++ b/tests/at-spi2-atk/atk_test_state_set.c @@ -26,15 +26,9 @@ #define DATA_FILE TESTS_DATA_DIR "/test-accessible.xml" static void -teardown_state_set_test (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_state_set (TestAppFixture *fixture, gconstpointer user_data) { - terminate_app (); -} - -static void -atk_test_accessible_get_state_set (gpointer fixture, gconstpointer user_data) -{ - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiStateSet *states = atspi_accessible_get_state_set (child); GArray *states_arr = atspi_state_set_get_states (states); @@ -54,7 +48,7 @@ atk_test_accessible_get_state_set (gpointer fixture, gconstpointer user_data) } static void -atk_test_state_set_new (gpointer fixture, gconstpointer user_data) +atk_test_state_set_new (TestAppFixture *fixture, gconstpointer user_data) { GArray *states_arr = g_array_new (FALSE, FALSE, sizeof (AtspiStateType)); @@ -72,9 +66,9 @@ atk_test_state_set_new (gpointer fixture, gconstpointer user_data) } static void -atk_test_state_set_set_by_name (gpointer fixture, gconstpointer user_data) +atk_test_state_set_set_by_name (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiStateSet *states = atspi_accessible_get_state_set (child); GArray *states_arr = atspi_state_set_get_states (states); @@ -92,9 +86,9 @@ atk_test_state_set_set_by_name (gpointer fixture, gconstpointer user_data) } static void -atk_test_state_set_add (gpointer fixture, gconstpointer user_data) +atk_test_state_set_add (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiStateSet *states = atspi_accessible_get_state_set (child); @@ -106,9 +100,9 @@ atk_test_state_set_add (gpointer fixture, gconstpointer user_data) } static void -atk_test_state_set_compare (gpointer fixture, gconstpointer user_data) +atk_test_state_set_compare (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiStateSet *states = atspi_accessible_get_state_set (child); GArray *states_arr = g_array_new (FALSE, FALSE, sizeof (AtspiStateType)); @@ -132,9 +126,9 @@ atk_test_state_set_compare (gpointer fixture, gconstpointer user_data) } static void -atk_test_state_set_contains (gpointer fixture, gconstpointer user_data) +atk_test_state_set_contains (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiStateSet *states = atspi_accessible_get_state_set (child); @@ -143,9 +137,9 @@ atk_test_state_set_contains (gpointer fixture, gconstpointer user_data) } static void -atk_test_state_set_equals (gpointer fixture, gconstpointer user_data) +atk_test_state_set_equals (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiStateSet *states = atspi_accessible_get_state_set (child); GArray *states_arr = g_array_new (FALSE, FALSE, sizeof (AtspiStateType)); @@ -164,9 +158,9 @@ atk_test_state_set_equals (gpointer fixture, gconstpointer user_data) } static void -atk_test_state_set_get_states (gpointer fixture, gconstpointer user_data) +atk_test_state_set_get_states (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiStateSet *states = atspi_accessible_get_state_set (child); GArray *states_arr = atspi_state_set_get_states (states); @@ -184,9 +178,9 @@ atk_test_state_set_get_states (gpointer fixture, gconstpointer user_data) } static void -atk_test_state_set_is_empty (gpointer fixture, gconstpointer user_data) +atk_test_state_set_is_empty (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiStateSet *states = atspi_accessible_get_state_set (child); AtspiStateSet *root_states = atspi_accessible_get_state_set (obj); @@ -196,9 +190,9 @@ atk_test_state_set_is_empty (gpointer fixture, gconstpointer user_data) } static void -atk_test_state_set_remove (gpointer fixture, gconstpointer user_data) +atk_test_state_set_remove (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *obj = get_root_obj (DATA_FILE); + AtspiAccessible *obj = fixture->root_obj; AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL); AtspiStateSet *states = atspi_accessible_get_state_set (child); GArray *states_arr = atspi_state_set_get_states (states); @@ -216,24 +210,24 @@ atk_test_state_set_remove (gpointer fixture, gconstpointer user_data) void atk_test_state_set (void) { - g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_accessible_get_state_set", - 0, NULL, NULL, atk_test_accessible_get_state_set, teardown_state_set_test); - g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_new", - 0, NULL, NULL, atk_test_state_set_new, teardown_state_set_test); - g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_set_by_name", - 0, NULL, NULL, atk_test_state_set_set_by_name, teardown_state_set_test); - g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_add", - 0, NULL, NULL, atk_test_state_set_add, teardown_state_set_test); - g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_compare", - 0, NULL, NULL, atk_test_state_set_compare, teardown_state_set_test); - g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_contains", - 0, NULL, NULL, atk_test_state_set_contains, teardown_state_set_test); - g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_equals", - 0, NULL, NULL, atk_test_state_set_equals, teardown_state_set_test); - g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_get_states", - 0, NULL, NULL, atk_test_state_set_get_states, teardown_state_set_test); - g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_is_empty", - 0, NULL, NULL, atk_test_state_set_is_empty, teardown_state_set_test); - g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_remove", - 0, NULL, NULL, atk_test_state_set_remove, teardown_state_set_test); + g_test_add ("/state_set/atk_test_accessible_get_state_set", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_state_set, fixture_teardown); + g_test_add ("/state_set/atk_test_state_set_new", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_state_set_new, fixture_teardown); + g_test_add ("/state_set/atk_test_state_set_set_by_name", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_state_set_set_by_name, fixture_teardown); + g_test_add ("/state_set/atk_test_state_set_add", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_state_set_add, fixture_teardown); + g_test_add ("/state_set/atk_test_state_set_compare", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_state_set_compare, fixture_teardown); + g_test_add ("/state_set/atk_test_state_set_contains", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_state_set_contains, fixture_teardown); + g_test_add ("/state_set/atk_test_state_set_equals", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_state_set_equals, fixture_teardown); + g_test_add ("/state_set/atk_test_state_set_get_states", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_state_set_get_states, fixture_teardown); + g_test_add ("/state_set/atk_test_state_set_is_empty", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_state_set_is_empty, fixture_teardown); + g_test_add ("/state_set/atk_test_state_set_remove", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_state_set_remove, fixture_teardown); } diff --git a/tests/at-spi2-atk/atk_test_table.c b/tests/at-spi2-atk/atk_test_table.c index 8a673bcc..0e4643e0 100644 --- a/tests/at-spi2-atk/atk_test_table.c +++ b/tests/at-spi2-atk/atk_test_table.c @@ -24,9 +24,9 @@ #define DATA_FILE TESTS_DATA_DIR "/test-table.xml" static void -atk_test_table_get_caption (gpointer fixture, gconstpointer user_data) +atk_test_table_get_caption (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -37,9 +37,9 @@ atk_test_table_get_caption (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_summary (gpointer fixture, gconstpointer user_data) +atk_test_table_get_summary (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -50,9 +50,9 @@ atk_test_table_get_summary (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_n_columns (gpointer fixture, gconstpointer user_data) +atk_test_table_get_n_columns (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -62,9 +62,9 @@ atk_test_table_get_n_columns (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_n_rows (gpointer fixture, gconstpointer user_data) +atk_test_table_get_n_rows (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -74,9 +74,9 @@ atk_test_table_get_n_rows (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_accessible_at (gpointer fixture, gconstpointer user_data) +atk_test_table_get_accessible_at (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -91,9 +91,9 @@ atk_test_table_get_accessible_at (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_index_at (gpointer fixture, gconstpointer user_data) +atk_test_table_get_index_at (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -110,9 +110,9 @@ atk_test_table_get_index_at (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_row_at_index (gpointer fixture, gconstpointer user_data) +atk_test_table_get_row_at_index (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -132,9 +132,9 @@ atk_test_table_get_row_at_index (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_column_at_index (gpointer fixture, gconstpointer user_data) +atk_test_table_get_column_at_index (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -151,9 +151,9 @@ atk_test_table_get_column_at_index (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_row_description (gpointer fixture, gconstpointer user_data) +atk_test_table_get_row_description (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -169,9 +169,9 @@ atk_test_table_get_row_description (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_column_description (gpointer fixture, gconstpointer user_data) +atk_test_table_get_column_description (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -187,9 +187,9 @@ atk_test_table_get_column_description (gpointer fixture, gconstpointer user_data } static void -atk_test_table_get_row_extent_at (gpointer fixture, gconstpointer user_data) +atk_test_table_get_row_extent_at (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -199,9 +199,9 @@ atk_test_table_get_row_extent_at (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_column_extent_at (gpointer fixture, gconstpointer user_data) +atk_test_table_get_column_extent_at (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -211,9 +211,9 @@ atk_test_table_get_column_extent_at (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_row_header (gpointer fixture, gconstpointer user_data) +atk_test_table_get_row_header (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -227,9 +227,9 @@ atk_test_table_get_row_header (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_column_header (gpointer fixture, gconstpointer user_data) +atk_test_table_get_column_header (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -246,9 +246,9 @@ atk_test_table_get_column_header (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_n_selected_rows (gpointer fixture, gconstpointer user_data) +atk_test_table_get_n_selected_rows (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -258,9 +258,9 @@ atk_test_table_get_n_selected_rows (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_selected_rows (gpointer fixture, gconstpointer user_data) +atk_test_table_get_selected_rows (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -274,9 +274,9 @@ atk_test_table_get_selected_rows (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_selected_columns (gpointer fixture, gconstpointer user_data) +atk_test_table_get_selected_columns (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -290,9 +290,9 @@ atk_test_table_get_selected_columns (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_get_n_selected_columns (gpointer fixture, gconstpointer user_data) +atk_test_table_get_n_selected_columns (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -304,21 +304,22 @@ atk_test_table_get_n_selected_columns (gpointer fixture, gconstpointer user_data } static void -atk_test_table_is_row_selected (gpointer fixture, gconstpointer user_data) +atk_test_table_is_row_selected (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); AtspiTable *obj = atspi_accessible_get_table_iface (child); + g_assert (obj); g_assert_true (atspi_table_is_row_selected (obj, 0, NULL)); g_assert_false (atspi_table_is_row_selected (obj, 1, NULL)); } static void -atk_test_table_is_column_selected (gpointer fixture, gconstpointer user_data) +atk_test_table_is_column_selected (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -328,9 +329,9 @@ atk_test_table_is_column_selected (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_add_row_selection (gpointer fixture, gconstpointer user_data) +atk_test_table_add_row_selection (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -341,9 +342,9 @@ atk_test_table_add_row_selection (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_add_column_selection (gpointer fixture, gconstpointer user_data) +atk_test_table_add_column_selection (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -354,9 +355,9 @@ atk_test_table_add_column_selection (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_remove_row_selection (gpointer fixture, gconstpointer user_data) +atk_test_table_remove_row_selection (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -367,9 +368,9 @@ atk_test_table_remove_row_selection (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_remove_column_selection (gpointer fixture, gconstpointer user_data) +atk_test_table_remove_column_selection (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -380,9 +381,9 @@ atk_test_table_remove_column_selection (gpointer fixture, gconstpointer user_dat } static void -atk_test_table_get_row_column_extents_at_index (gpointer fixture, gconstpointer user_data) +atk_test_table_get_row_column_extents_at_index (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -402,9 +403,9 @@ atk_test_table_get_row_column_extents_at_index (gpointer fixture, gconstpointer } static void -atk_test_table_is_selected (gpointer fixture, gconstpointer user_data) +atk_test_table_is_selected (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -413,65 +414,59 @@ atk_test_table_is_selected (gpointer fixture, gconstpointer user_data) g_assert_false (atspi_table_is_selected (obj, 1, 0, NULL)); } -static void -teardown_table_test (gpointer fixture, gconstpointer user_data) -{ - terminate_app (); -} - void atk_test_table (void) { - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_caption", - 0, NULL, NULL, atk_test_table_get_caption, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_summary", - 0, NULL, NULL, atk_test_table_get_summary, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_n_columns", - 0, NULL, NULL, atk_test_table_get_n_columns, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_n_rows", - 0, NULL, NULL, atk_test_table_get_n_rows, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_accessible_at", - 0, NULL, NULL, atk_test_table_get_accessible_at, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_index_at", - 0, NULL, NULL, atk_test_table_get_index_at, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_row_at_index", - 0, NULL, NULL, atk_test_table_get_row_at_index, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_column_at_index", - 0, NULL, NULL, atk_test_table_get_column_at_index, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_row_description", - 0, NULL, NULL, atk_test_table_get_row_description, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_column_description", - 0, NULL, NULL, atk_test_table_get_column_description, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_row_extent_at", - 0, NULL, NULL, atk_test_table_get_row_extent_at, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_column_extent_at", - 0, NULL, NULL, atk_test_table_get_column_extent_at, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_row_header", - 0, NULL, NULL, atk_test_table_get_row_header, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_column_header", - 0, NULL, NULL, atk_test_table_get_column_header, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_n_selected_rows", - 0, NULL, NULL, atk_test_table_get_n_selected_rows, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_selected_rows", - 0, NULL, NULL, atk_test_table_get_selected_rows, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_selected_columns", - 0, NULL, NULL, atk_test_table_get_selected_columns, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_n_selected_columns", - 0, NULL, NULL, atk_test_table_get_n_selected_columns, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_is_row_selected", - 0, NULL, NULL, atk_test_table_is_row_selected, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_is_column_selected", - 0, NULL, NULL, atk_test_table_is_column_selected, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_add_row_selection", - 0, NULL, NULL, atk_test_table_add_row_selection, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_add_column_selection", - 0, NULL, NULL, atk_test_table_add_column_selection, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_remove_row_selection", - 0, NULL, NULL, atk_test_table_remove_row_selection, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_remove_column_selection", - 0, NULL, NULL, atk_test_table_remove_column_selection, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_row_column_extents_at_index", - 0, NULL, NULL, atk_test_table_get_row_column_extents_at_index, teardown_table_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_is_selected", - 0, NULL, NULL, atk_test_table_is_selected, teardown_table_test); + g_test_add ("/table/atk_test_table_get_caption", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_caption, fixture_teardown); + g_test_add ("/table/atk_test_table_get_summary", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_summary, fixture_teardown); + g_test_add ("/table/atk_test_table_get_n_columns", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_n_columns, fixture_teardown); + g_test_add ("/table/atk_test_table_get_n_rows", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_n_rows, fixture_teardown); + g_test_add ("/table/atk_test_table_get_accessible_at", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_accessible_at, fixture_teardown); + g_test_add ("/table/atk_test_table_get_index_at", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_index_at, fixture_teardown); + g_test_add ("/table/atk_test_table_get_row_at_index", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_row_at_index, fixture_teardown); + g_test_add ("/table/atk_test_table_get_column_at_index", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_column_at_index, fixture_teardown); + g_test_add ("/table/atk_test_table_get_row_description", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_row_description, fixture_teardown); + g_test_add ("/table/atk_test_table_get_column_description", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_column_description, fixture_teardown); + g_test_add ("/table/atk_test_table_get_row_extent_at", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_row_extent_at, fixture_teardown); + g_test_add ("/table/atk_test_table_get_column_extent_at", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_column_extent_at, fixture_teardown); + g_test_add ("/table/atk_test_table_get_row_header", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_row_header, fixture_teardown); + g_test_add ("/table/atk_test_table_get_column_header", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_column_header, fixture_teardown); + g_test_add ("/table/atk_test_table_get_n_selected_rows", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_n_selected_rows, fixture_teardown); + g_test_add ("/table/atk_test_table_get_selected_rows", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_selected_rows, fixture_teardown); + g_test_add ("/table/atk_test_table_get_selected_columns", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_selected_columns, fixture_teardown); + g_test_add ("/table/atk_test_table_get_n_selected_columns", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_n_selected_columns, fixture_teardown); + g_test_add ("/table/atk_test_table_is_row_selected", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_is_row_selected, fixture_teardown); + g_test_add ("/table/atk_test_table_is_column_selected", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_is_column_selected, fixture_teardown); + g_test_add ("/table/atk_test_table_add_row_selection", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_add_row_selection, fixture_teardown); + g_test_add ("/table/atk_test_table_add_column_selection", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_add_column_selection, fixture_teardown); + g_test_add ("/table/atk_test_table_remove_row_selection", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_remove_row_selection, fixture_teardown); + g_test_add ("/table/atk_test_table_remove_column_selection", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_remove_column_selection, fixture_teardown); + g_test_add ("/table/atk_test_table_get_row_column_extents_at_index", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_get_row_column_extents_at_index, fixture_teardown); + g_test_add ("/table/atk_test_table_is_selected", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_is_selected, fixture_teardown); } diff --git a/tests/at-spi2-atk/atk_test_table_cell.c b/tests/at-spi2-atk/atk_test_table_cell.c index efb35eab..463f1a16 100644 --- a/tests/at-spi2-atk/atk_test_table_cell.c +++ b/tests/at-spi2-atk/atk_test_table_cell.c @@ -24,9 +24,9 @@ #define DATA_FILE TESTS_DATA_DIR "/test-table.xml" static void -atk_test_accessible_get_table_cell (gpointer fixture, gconstpointer user_data) +atk_test_accessible_get_table_cell (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -37,9 +37,9 @@ atk_test_accessible_get_table_cell (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_cell_get_column_span (gpointer fixture, gconstpointer user_data) +atk_test_table_cell_get_column_span (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -59,9 +59,9 @@ atk_test_table_cell_get_column_span (gpointer fixture, gconstpointer user_data) /* static void -atk_test_table_cell_get_column_header_cells (gpointer fixture, gconstpointer user_data) +atk_test_table_cell_get_column_header_cells (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -76,9 +76,9 @@ atk_test_table_cell_get_column_header_cells (gpointer fixture, gconstpointer use */ static void -atk_test_table_cell_get_row_span (gpointer fixture, gconstpointer user_data) +atk_test_table_cell_get_row_span (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -98,9 +98,9 @@ atk_test_table_cell_get_row_span (gpointer fixture, gconstpointer user_data) /* static void -atk_test_table_cell_get_row_header_cells (gpointer fixture, gconstpointer user_data) +atk_test_table_cell_get_row_header_cells (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -115,9 +115,9 @@ atk_test_table_cell_get_row_header_cells (gpointer fixture, gconstpointer user_d */ static void -atk_test_table_cell_get_row_column_span (gpointer fixture, gconstpointer user_data) +atk_test_table_cell_get_row_column_span (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -140,9 +140,9 @@ atk_test_table_cell_get_row_column_span (gpointer fixture, gconstpointer user_da } static void -atk_test_table_cell_get_position (gpointer fixture, gconstpointer user_data) +atk_test_table_cell_get_position (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -162,9 +162,9 @@ atk_test_table_cell_get_position (gpointer fixture, gconstpointer user_data) } static void -atk_test_table_cell_get_table (gpointer fixture, gconstpointer user_data) +atk_test_table_cell_get_table (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -178,33 +178,27 @@ atk_test_table_cell_get_table (gpointer fixture, gconstpointer user_data) g_assert (child == tab); } -static void -teardown_table_cell_test (gpointer fixture, gconstpointer user_data) -{ - terminate_app (); -} - void atk_test_table_cell (void) { - g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_accessible_get_table_cell", - 0, NULL, NULL, atk_test_accessible_get_table_cell, teardown_table_cell_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_column_span", - 0, NULL, NULL, atk_test_table_cell_get_column_span, teardown_table_cell_test); + g_test_add ("/table_cell/atk_test_accessible_get_table_cell", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_accessible_get_table_cell, fixture_teardown); + g_test_add ("/table_cell/atk_test_table_cell_get_column_span", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_cell_get_column_span, fixture_teardown); /* - g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_column_header_cells", - 0, NULL, NULL, atk_test_table_cell_get_column_header_cells, teardown_table_cell_test); + g_test_add ("/table_cell/atk_test_table_cell_get_column_header_cells", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_cell_get_column_header_cells, fixture_teardown); */ - g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_row_span", - 0, NULL, NULL, atk_test_table_cell_get_row_span, teardown_table_cell_test); + g_test_add ("/table_cell/atk_test_table_cell_get_row_span", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_cell_get_row_span, fixture_teardown); /* - g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_row_header_cells", - 0, NULL, NULL, atk_test_table_cell_get_row_header_cells, teardown_table_cell_test); + g_test_add ("/table_cell/atk_test_table_cell_get_row_header_cells", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_cell_get_row_header_cells, fixture_teardown); */ - g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_row_column_span", - 0, NULL, NULL, atk_test_table_cell_get_row_column_span, teardown_table_cell_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_position", - 0, NULL, NULL, atk_test_table_cell_get_position, teardown_table_cell_test); - g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_table", - 0, NULL, NULL, atk_test_table_cell_get_table, teardown_table_cell_test); + g_test_add ("/table_cell/atk_test_table_cell_get_row_column_span", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_cell_get_row_column_span, fixture_teardown); + g_test_add ("/table_cell/atk_test_table_cell_get_position", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_cell_get_position, fixture_teardown); + g_test_add ("/table_cell/atk_test_table_cell_get_table", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_table_cell_get_table, fixture_teardown); } diff --git a/tests/at-spi2-atk/atk_test_text.c b/tests/at-spi2-atk/atk_test_text.c index 085380c1..a5fb7f83 100644 --- a/tests/at-spi2-atk/atk_test_text.c +++ b/tests/at-spi2-atk/atk_test_text.c @@ -36,9 +36,9 @@ GHRunc_find (gpointer key, gpointer value, gpointer user_data) } static void -atk_test_text_get_character_count (gpointer fixture, gconstpointer user_data) +atk_test_text_get_character_count (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -49,9 +49,9 @@ atk_test_text_get_character_count (gpointer fixture, gconstpointer user_data) } static void -atk_test_text_get_text (gpointer fixture, gconstpointer user_data) +atk_test_text_get_text (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -63,9 +63,9 @@ atk_test_text_get_text (gpointer fixture, gconstpointer user_data) } static void -atk_test_text_get_caret_offset (gpointer fixture, gconstpointer user_data) +atk_test_text_get_caret_offset (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -76,9 +76,9 @@ atk_test_text_get_caret_offset (gpointer fixture, gconstpointer user_data) } static void -atk_test_text_set_caret_offset (gpointer fixture, gconstpointer user_data) +atk_test_text_set_caret_offset (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -90,9 +90,9 @@ atk_test_text_set_caret_offset (gpointer fixture, gconstpointer user_data) g_assert_cmpint (pos, ==, 5); } static void -atk_test_text_get_character_at_offset (gpointer fixture, gconstpointer user_data) +atk_test_text_get_character_at_offset (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -103,9 +103,9 @@ atk_test_text_get_character_at_offset (gpointer fixture, gconstpointer user_data } static void -atk_test_text_get_character_extents (gpointer fixture, gconstpointer user_data) +atk_test_text_get_character_extents (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -121,9 +121,9 @@ atk_test_text_get_character_extents (gpointer fixture, gconstpointer user_data) } static void -atk_test_text_get_range_extents (gpointer fixture, gconstpointer user_data) +atk_test_text_get_range_extents (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -140,9 +140,9 @@ atk_test_text_get_range_extents (gpointer fixture, gconstpointer user_data) } static void -atk_test_text_add_selection (gpointer fixture, gconstpointer user_data) +atk_test_text_add_selection (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -152,9 +152,9 @@ atk_test_text_add_selection (gpointer fixture, gconstpointer user_data) } static void -atk_test_text_get_n_selections (gpointer fixture, gconstpointer user_data) +atk_test_text_get_n_selections (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -170,9 +170,9 @@ atk_test_text_get_n_selections (gpointer fixture, gconstpointer user_data) } static void -atk_test_text_get_selection (gpointer fixture, gconstpointer user_data) +atk_test_text_get_selection (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -195,9 +195,9 @@ atk_test_text_get_selection (gpointer fixture, gconstpointer user_data) } static void -atk_test_text_set_selection (gpointer fixture, gconstpointer user_data) +atk_test_text_set_selection (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -222,9 +222,9 @@ atk_test_text_set_selection (gpointer fixture, gconstpointer user_data) } static void -atk_test_text_remove_selection (gpointer fixture, gconstpointer user_data) +atk_test_text_remove_selection (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -248,9 +248,9 @@ atk_test_text_remove_selection (gpointer fixture, gconstpointer user_data) } static void -atk_test_text_get_offset_at_point (gpointer fixture, gconstpointer user_data) +atk_test_text_get_offset_at_point (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -261,9 +261,9 @@ atk_test_text_get_offset_at_point (gpointer fixture, gconstpointer user_data) } static void -atk_test_text_get_text_attribute_value (gpointer fixture, gconstpointer user_data) +atk_test_text_get_text_attribute_value (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -284,9 +284,9 @@ atk_test_text_get_text_attribute_value (gpointer fixture, gconstpointer user_dat } static void -atk_test_text_get_attribute_run (gpointer fixture, gconstpointer user_data) +atk_test_text_get_attribute_run (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -306,9 +306,9 @@ atk_test_text_get_attribute_run (gpointer fixture, gconstpointer user_data) } static void -atk_test_text_get_defualt_attributes (gpointer fixture, gconstpointer user_data) +atk_test_text_get_default_attributes (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -324,9 +324,9 @@ atk_test_text_get_defualt_attributes (gpointer fixture, gconstpointer user_data) } static void -atk_test_text_get_text_attributes (gpointer fixture, gconstpointer user_data) +atk_test_text_get_text_attributes (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -346,9 +346,9 @@ atk_test_text_get_text_attributes (gpointer fixture, gconstpointer user_data) } static void -atk_test_text_get_string_at_offset_s1 (gpointer fixture, gconstpointer user_data) +atk_test_text_get_string_at_offset_s1 (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -371,9 +371,9 @@ atk_test_text_get_string_at_offset_s1 (gpointer fixture, gconstpointer user_data g_free (range); } static void -atk_test_text_get_string_at_offset_s2 (gpointer fixture, gconstpointer user_data) +atk_test_text_get_string_at_offset_s2 (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 1, NULL); g_assert (child); @@ -405,9 +405,9 @@ atk_test_text_get_string_at_offset_s2 (gpointer fixture, gconstpointer user_data } static void -atk_test_text_get_bounded_ranges (gpointer fixture, gconstpointer user_data) +atk_test_text_get_bounded_ranges (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -431,53 +431,47 @@ atk_test_text_get_bounded_ranges (gpointer fixture, gconstpointer user_data) g_array_free (array, TRUE); } -static void -teardown_text_test (gpointer fixture, gconstpointer user_data) -{ - terminate_app (); -} - void atk_test_text (void) { - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_character_count", - 0, NULL, NULL, atk_test_text_get_character_count, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_text", - 0, NULL, NULL, atk_test_text_get_text, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_caret_offset", - 0, NULL, NULL, atk_test_text_get_caret_offset, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_text_attributes", - 0, NULL, NULL, atk_test_text_get_text_attributes, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_attribute_run", - 0, NULL, NULL, atk_test_text_get_attribute_run, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_text_attribute_value", - 0, NULL, NULL, atk_test_text_get_text_attribute_value, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_defualt_attributes", - 0, NULL, NULL, atk_test_text_get_defualt_attributes, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_set_caret_offset", - 0, NULL, NULL, atk_test_text_set_caret_offset, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_string_at_offset_s1", - 0, NULL, NULL, atk_test_text_get_string_at_offset_s1, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_string_at_offset_s2", - 0, NULL, NULL, atk_test_text_get_string_at_offset_s2, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_character_at_offset", - 0, NULL, NULL, atk_test_text_get_character_at_offset, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_character_extents", - 0, NULL, NULL, atk_test_text_get_character_extents, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_offset_at_point", - 0, NULL, NULL, atk_test_text_get_offset_at_point, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_range_extents", - 0, NULL, NULL, atk_test_text_get_range_extents, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_bounded_ranges", - 0, NULL, NULL, atk_test_text_get_bounded_ranges, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_n_selections", - 0, NULL, NULL, atk_test_text_get_n_selections, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_selection", - 0, NULL, NULL, atk_test_text_get_selection, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_add_selection", - 0, NULL, NULL, atk_test_text_add_selection, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_remove_selection", - 0, NULL, NULL, atk_test_text_remove_selection, teardown_text_test); - g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_set_selection", - 0, NULL, NULL, atk_test_text_set_selection, teardown_text_test); + g_test_add ("/text/atk_test_text_get_character_count", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_character_count, fixture_teardown); + g_test_add ("/text/atk_test_text_get_text", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_text, fixture_teardown); + g_test_add ("/text/atk_test_text_get_caret_offset", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_caret_offset, fixture_teardown); + g_test_add ("/text/atk_test_text_get_text_attributes", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_text_attributes, fixture_teardown); + g_test_add ("/text/atk_test_text_get_attribute_run", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_attribute_run, fixture_teardown); + g_test_add ("/text/atk_test_text_get_text_attribute_value", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_text_attribute_value, fixture_teardown); + g_test_add ("/text/atk_test_text_get_default_attributes", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_default_attributes, fixture_teardown); + g_test_add ("/text/atk_test_text_set_caret_offset", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_set_caret_offset, fixture_teardown); + g_test_add ("/text/atk_test_text_get_string_at_offset_s1", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_string_at_offset_s1, fixture_teardown); + g_test_add ("/text/atk_test_text_get_string_at_offset_s2", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_string_at_offset_s2, fixture_teardown); + g_test_add ("/text/atk_test_text_get_character_at_offset", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_character_at_offset, fixture_teardown); + g_test_add ("/text/atk_test_text_get_character_extents", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_character_extents, fixture_teardown); + g_test_add ("/text/atk_test_text_get_offset_at_point", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_offset_at_point, fixture_teardown); + g_test_add ("/text/atk_test_text_get_range_extents", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_range_extents, fixture_teardown); + g_test_add ("/text/atk_test_text_get_bounded_ranges", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_bounded_ranges, fixture_teardown); + g_test_add ("/text/atk_test_text_get_n_selections", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_n_selections, fixture_teardown); + g_test_add ("/text/atk_test_text_get_selection", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_get_selection, fixture_teardown); + g_test_add ("/text/atk_test_text_add_selection", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_add_selection, fixture_teardown); + g_test_add ("/text/atk_test_text_remove_selection", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_remove_selection, fixture_teardown); + g_test_add ("/text/atk_test_text_set_selection", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_text_set_selection, fixture_teardown); } diff --git a/tests/at-spi2-atk/atk_test_util.c b/tests/at-spi2-atk/atk_test_util.c index 1f80d459..2af00135 100644 --- a/tests/at-spi2-atk/atk_test_util.c +++ b/tests/at-spi2-atk/atk_test_util.c @@ -23,128 +23,210 @@ #include "atk_test_util.h" #include <signal.h> -pid_t child_pid; +static AtspiEventListener *fixture_listener = NULL; +static TestAppFixture *current_fixture = NULL; -static void -assert_clean_exit (int sig) -{ - kill (child_pid, SIGTERM); -} - -void -clean_exit_on_fail () -{ - signal (SIGABRT, assert_clean_exit); -} - -void -run_app (const char *file_name) +static pid_t +run_app (const char *file_name, const char *name_to_claim) { - child_pid = fork (); + pid_t child_pid = fork (); if (child_pid == 0) { execlp (TESTS_BUILD_DIR "/app-test", TESTS_BUILD_DIR "/app-test", "--test-data-file", file_name, + "--atspi-dbus-name", + name_to_claim, NULL); _exit (EXIT_SUCCESS); } - if (child_pid) - fprintf (stderr, "child_pid %d\n", child_pid); + + return child_pid; } static AtspiAccessible * try_get_root_obj (AtspiAccessible *obj) { + GError *error = NULL; gchar *name; int i; - gint child_count = atspi_accessible_get_child_count (obj, NULL); - if (child_count < 1) + gint child_count = atspi_accessible_get_child_count (obj, &error); + if (child_count < 0) + { + if (error) + { + g_print (" get_child_count: %s\n", error->message); + g_error_free (error); + } + else + { + g_print (" get_child_count=%d with no error\n", child_count); + } + return NULL; + } + else if (child_count < 1) { + g_print (" child_count == %d, bailing out\n", child_count); return NULL; } for (i = 0; i < child_count; i++) { - AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, i, NULL); + AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, i, &error); if (!child) - continue; - if ((name = atspi_accessible_get_name (child, NULL)) != NULL) + { + if (error) + { + g_print (" getting child_at_index: %s\n", error->message); + g_error_free (error); + } + else + { + g_print (" getting child_at_index returned NULL child with no error\n"); + } + continue; + } + if ((name = atspi_accessible_get_name (child, &error)) != NULL) { if (!strcmp (name, "root_object")) { g_free (name); return child; } + g_print (" name=%s\n", name); g_free (name); } + else + { + if (error) + { + g_print ("try_get_root_obj getting child name: %s\n", error->message); + g_error_free (error); + } + else + { + g_print (" get_name returned NULL name with no error\n"); + } + } g_object_unref (child); } return NULL; } -AtspiAccessible * -get_root_obj (const char *file_name) +/* Callback from AtspiEventListener. We monitor children-changed on the root, so we can know + * when the helper test-application has launched and registered. + */ +static void +listener_event_cb (AtspiEvent *event, void *user_data) { - int tries = 0; - AtspiAccessible *child; - struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 }; - AtspiAccessible *obj = NULL; - - fprintf (stderr, "run_app: %s\n", file_name); - run_app (file_name); - - obj = atspi_get_desktop (0); + TestAppFixture *fixture = current_fixture; - /* Wait for application to start, up to 100 times 10ms. */ - while (++tries <= 100) + if (atspi_accessible_get_role (event->source, NULL) == ATSPI_ROLE_DESKTOP_FRAME && strstr (event->type, "add")) { - child = try_get_root_obj (obj); - if (child) - return child; + AtspiAccessible *obj = atspi_get_desktop (0); - nanosleep (&timeout, NULL); + fixture->root_obj = try_get_root_obj (obj); + + if (fixture->root_obj) + { + fixture->state = FIXTURE_STATE_CHILD_ACQUIRED; + atspi_event_quit (); + } } +} + +/* Sets up the atspi event listener for the test-application helpers. + * + * We get notified when the test-application registers its root object by listening + * to the children-changed signal. + */ +void +fixture_listener_init (void) +{ + GError *error = NULL; - if (atspi_accessible_get_child_count (obj, NULL) < 1) + fixture_listener = atspi_event_listener_new (listener_event_cb, NULL, NULL); + if (!atspi_event_listener_register (fixture_listener, "object:children-changed", &error)) { - g_test_message ("Fail, test application not found\n"); + g_error ("Could not register event listener for children-changed: %s\n", error->message); } - else +} + +void +fixture_listener_destroy (void) +{ + GError *error = NULL; + + if (!atspi_event_listener_deregister (fixture_listener, "object:children-changed", &error)) { - g_test_message ("test object not found\n"); + g_error ("Could not deregister event listener: %s", error->message); } - g_test_fail (); - kill (child_pid, SIGTERM); - return NULL; + + g_object_unref (fixture_listener); + fixture_listener = NULL; } +static gboolean +wait_for_test_app_timeout_cb (gpointer user_data) +{ + TestAppFixture *fixture = user_data; + + fixture->test_app_timed_out = TRUE; + atspi_event_quit (); + + return FALSE; +} + +/* Each of the helper programs with the test fixtures claims a different DBus name, + * to make them non-ambiguous when they get restarted all the time. This is the serial + * number that gets appended to each name. + */ +static guint fixture_serial = 0; + void -terminate_app (void) +fixture_setup (TestAppFixture *fixture, gconstpointer user_data) { - int tries = 0; + const char *file_name = user_data; + + fixture->state = FIXTURE_STATE_WAITING_FOR_CHILD; + fixture->name_to_claim = g_strdup_printf ("org.a11y.Atspi2Atk.TestApplication_%u", fixture_serial); + fixture_serial += 1; - AtspiAccessible *child; - struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 }; - AtspiAccessible *obj = NULL; + fixture->child_pid = run_app (file_name, fixture->name_to_claim); - kill (child_pid, SIGTERM); + fixture->test_app_timed_out = FALSE; + fixture->wait_for_test_app_timeout = g_timeout_add (500, wait_for_test_app_timeout_cb, fixture); /* 500 msec */ - obj = atspi_get_desktop (0); + current_fixture = fixture; + atspi_event_main (); - /* Wait for application to stop, up to 100 times 10ms. */ - while (++tries <= 100) + g_source_remove (fixture->wait_for_test_app_timeout); + fixture->wait_for_test_app_timeout = 0; + + if (fixture->test_app_timed_out) { - child = try_get_root_obj (obj); - if (child == NULL) - return; + g_print ("test app timed out before registering its root object"); + g_test_fail (); + } +} + +void +fixture_teardown (TestAppFixture *fixture, gconstpointer user_data) +{ + current_fixture = NULL; - nanosleep (&timeout, NULL); + kill (fixture->child_pid, SIGTERM); + fixture->child_pid = -1; + + if (fixture->root_obj) + { + g_object_unref (fixture->root_obj); + fixture->root_obj = NULL; } - g_test_message ("Fail, test application still running\n"); - g_test_fail (); + g_free (fixture->name_to_claim); + fixture->name_to_claim = NULL; } diff --git a/tests/at-spi2-atk/atk_test_util.h b/tests/at-spi2-atk/atk_test_util.h index 6fc3ecf5..c664f777 100644 --- a/tests/at-spi2-atk/atk_test_util.h +++ b/tests/at-spi2-atk/atk_test_util.h @@ -33,11 +33,30 @@ #include <sys/wait.h> #include <unistd.h> +typedef enum +{ + FIXTURE_STATE_WAITING_FOR_CHILD, + FIXTURE_STATE_CHILD_ACQUIRED, +} FixtureState; + +typedef struct +{ + FixtureState state; + + char *name_to_claim; + + guint wait_for_test_app_timeout; + gboolean test_app_timed_out; + pid_t child_pid; + + AtspiAccessible *root_obj; +} TestAppFixture; + extern pid_t child_pid; -void run_app (const char *file_name); -AtspiAccessible *get_root_obj (const char *file_name); -void terminate_app (void); -void clean_exit_on_fail (); +void fixture_listener_init (void); +void fixture_listener_destroy (void); +void fixture_setup (TestAppFixture *fixture, gconstpointer user_data); +void fixture_teardown (TestAppFixture *fixture, gconstpointer user_data); #endif /* _ATK_TEST_UTIL_H */ diff --git a/tests/at-spi2-atk/atk_test_value.c b/tests/at-spi2-atk/atk_test_value.c index d592d903..db2cef24 100644 --- a/tests/at-spi2-atk/atk_test_value.c +++ b/tests/at-spi2-atk/atk_test_value.c @@ -24,9 +24,9 @@ #define DATA_FILE TESTS_DATA_DIR "/test-value.xml" static void -atk_test_value_get_value_iface (gpointer fixture, gconstpointer user_data) +atk_test_value_get_value_iface (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -35,9 +35,9 @@ atk_test_value_get_value_iface (gpointer fixture, gconstpointer user_data) } static void -atk_test_value_get_minimum_value (gpointer fixture, gconstpointer user_data) +atk_test_value_get_minimum_value (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -47,9 +47,9 @@ atk_test_value_get_minimum_value (gpointer fixture, gconstpointer user_data) } static void -atk_test_value_get_current_value (gpointer fixture, gconstpointer user_data) +atk_test_value_get_current_value (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -59,9 +59,9 @@ atk_test_value_get_current_value (gpointer fixture, gconstpointer user_data) } static void -atk_test_value_get_maximum_value (gpointer fixture, gconstpointer user_data) +atk_test_value_get_maximum_value (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -71,9 +71,9 @@ atk_test_value_get_maximum_value (gpointer fixture, gconstpointer user_data) } static void -atk_test_value_set_current_value (gpointer fixture, gconstpointer user_data) +atk_test_value_set_current_value (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -84,9 +84,9 @@ atk_test_value_set_current_value (gpointer fixture, gconstpointer user_data) } static void -atk_test_value_get_minimum_increment (gpointer fixture, gconstpointer user_data) +atk_test_value_get_minimum_increment (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -96,9 +96,9 @@ atk_test_value_get_minimum_increment (gpointer fixture, gconstpointer user_data) } static void -atk_test_value_get_text (gpointer fixture, gconstpointer user_data) +atk_test_value_get_text (TestAppFixture *fixture, gconstpointer user_data) { - AtspiAccessible *_obj = get_root_obj (DATA_FILE); + AtspiAccessible *_obj = fixture->root_obj; g_assert (_obj); AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL); g_assert (child); @@ -108,27 +108,21 @@ atk_test_value_get_text (gpointer fixture, gconstpointer user_data) g_free (text); } -static void -teardown_value_test (gpointer fixture, gconstpointer user_data) -{ - terminate_app (); -} - void atk_test_value (void) { - g_test_add_vtable (ATK_TEST_PATH_VALUE "/atk_test_value_get_value_iface", - 0, NULL, NULL, atk_test_value_get_value_iface, teardown_value_test); - g_test_add_vtable (ATK_TEST_PATH_VALUE "/atk_test_value_get_minimum_value", - 0, NULL, NULL, atk_test_value_get_minimum_value, teardown_value_test); - g_test_add_vtable (ATK_TEST_PATH_VALUE "/atk_test_value_get_current_value", - 0, NULL, NULL, atk_test_value_get_current_value, teardown_value_test); - g_test_add_vtable (ATK_TEST_PATH_VALUE "/atk_test_value_get_maximum_value", - 0, NULL, NULL, atk_test_value_get_maximum_value, teardown_value_test); - g_test_add_vtable (ATK_TEST_PATH_VALUE "/atk_test_value_set_current_value", - 0, NULL, NULL, atk_test_value_set_current_value, teardown_value_test); - g_test_add_vtable (ATK_TEST_PATH_VALUE "/atk_test_value_get_minimum_increment", - 0, NULL, NULL, atk_test_value_get_minimum_increment, teardown_value_test); - g_test_add_vtable (ATK_TEST_PATH_VALUE "/atk_test_value_get_text", - 0, NULL, NULL, atk_test_value_get_text, teardown_value_test); + g_test_add ("/value/atk_test_value_get_value_iface", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_value_get_value_iface, fixture_teardown); + g_test_add ("/value/atk_test_value_get_minimum_value", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_value_get_minimum_value, fixture_teardown); + g_test_add ("/value/atk_test_value_get_current_value", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_value_get_current_value, fixture_teardown); + g_test_add ("/value/atk_test_value_get_maximum_value", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_value_get_maximum_value, fixture_teardown); + g_test_add ("/value/atk_test_value_set_current_value", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_value_set_current_value, fixture_teardown); + g_test_add ("/value/atk_test_value_get_minimum_increment", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_value_get_minimum_increment, fixture_teardown); + g_test_add ("/value/atk_test_value_get_text", + TestAppFixture, DATA_FILE, fixture_setup, atk_test_value_get_text, fixture_teardown); } diff --git a/tests/at-spi2-atk/test-application.c b/tests/at-spi2-atk/test-application.c index e28926b0..b8a8da01 100644 --- a/tests/at-spi2-atk/test-application.c +++ b/tests/at-spi2-atk/test-application.c @@ -100,6 +100,7 @@ static gboolean sigterm_received_cb (gpointer user_data) { GMainLoop *mainloop = user_data; + g_print ("test application received SIGTERM\n"); g_main_loop_quit (mainloop); return G_SOURCE_REMOVE; } @@ -118,11 +119,17 @@ main (int argc, char *argv[]) setup_atk_util (); test_init (tdata_path); - atk_bridge_adaptor_init (NULL, NULL); + + atk_bridge_adaptor_init (&argc, &argv); mainloop = g_main_loop_new (NULL, FALSE); g_unix_signal_add (SIGTERM, sigterm_received_cb, mainloop); g_main_loop_run (mainloop); + g_print ("test application exited main loop; terminating after cleanup\n"); + + atk_bridge_adaptor_cleanup (); + + g_print ("test application %d exiting!\n", getpid ()); return 0; } |