summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatryk Kaczmarek <patryk.k@samsung.com>2015-02-16 15:15:42 +0100
committerMike Gorse <mgorse@suse.com>2015-02-16 14:05:15 -0600
commit4c2aee06d56e5bff448411965139fe7913fd670d (patch)
treecebcb6799a1b5d1604503f7e7909f442644fecfa
parent981d82459b520815b474e885826ee1448171bf35 (diff)
downloadat-spi2-atk-4c2aee06d56e5bff448411965139fe7913fd670d.tar.gz
Action tests added and some test framework refactor
* Accessible Action Test addded * XML loader unificated for different Atk Object types * Atk Suite now can run single interface tests * get_root_obj function changed * Created tests utils for test unification * Makefile.am files formating changed and unused parts deleted * MyAtkObject attributes receiving fixed
-rw-r--r--tests/Makefile.am48
-rw-r--r--tests/README8
-rw-r--r--tests/atk-object-xml-loader.c103
-rw-r--r--tests/atk_suite.c32
-rw-r--r--tests/atk_suite.h2
-rw-r--r--tests/atk_test_accessible.c211
-rw-r--r--tests/atk_test_action.c120
-rw-r--r--tests/atk_test_util.c80
-rw-r--r--tests/atk_test_util.h45
-rw-r--r--tests/data/test-accessible.xml16
-rw-r--r--tests/data/test-action.xml11
-rw-r--r--tests/dummyatk/Makefile.am19
-rw-r--r--tests/dummyatk/my-atk-action.c270
-rw-r--r--tests/dummyatk/my-atk-action.h63
-rw-r--r--tests/dummyatk/my-atk-object.c45
-rw-r--r--tests/dummyatk/my-atk-object.h12
-rw-r--r--tests/dummyatk/my-atk.h1
-rw-r--r--tests/test-application.c7
18 files changed, 848 insertions, 245 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c8d9a3a..c03d3fe 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -2,28 +2,30 @@ SUBDIRS = dummyatk
noinst_PROGRAMS = atk-test app-test
TESTS = atk-test
-lib_LTLIBRARIES =libxmlloader.la
+lib_LTLIBRARIES =libxmlloader.la libtestutils.la
atk_test_CFLAGS = $(DBUS_CFLAGS) \
- -I$(top_builddir)\
- $(GLIB_CFLAGS) \
- $(ATSPI_CFLAGS) \
- -I$(top_srcdir)/tests/dummyatk/ \
- -I$(top_srcdir)/tests/dummyatk/.libs \
- -I$(top_srcdir)/tests/dummyatk/.deps \
- -I$(top_srcdir)
+ $(GLIB_CFLAGS) \
+ $(ATSPI_CFLAGS) \
+ -I$(top_builddir)\
+ -I$(top_srcdir)/tests/dummyatk/ \
+ -I$(top_srcdir)/tests/dummyatk/.libs \
+ -I$(top_srcdir)/tests/dummyatk/.deps \
+ -I$(top_srcdir)
atk_test_LDFLAGS = libxmlloader.la \
- $(GLIB_LIBS) \
- $(ATSPI_LIBS) \
- $(top_srcdir)/tests/dummyatk/libdummyatk.la
+ libtestutils.la \
+ $(GLIB_LIBS) \
+ $(ATSPI_LIBS) \
+ $(top_srcdir)/tests/dummyatk/libdummyatk.la
atk_test_CPPFLAGS = -DTESTS_BUILD_DIR=\"$(top_builddir)/tests\" \
-DTESTS_SRC_DIR=\"$(top_srcdir)/tests\" \
-DTESTS_DATA_DIR=\"$(top_srcdir)/tests/data\"
atk_test_SOURCES = atk_suite.c \
- atk_test_accessible.c
+ atk_test_accessible.c \
+ atk_test_action.c
app_test_CFLAGS = -I$(top_builddir) \
$(GLIB_CFLAGS) \
@@ -32,6 +34,7 @@ app_test_CFLAGS = -I$(top_builddir) \
-I$(top_srcdir)/atk-adaptor
app_test_LDFLAGS = libxmlloader.la \
+ libtestutils.la \
$(GLIB_LIBS) \
$(ATK_LIBS) \
$(top_srcdir)/tests/dummyatk/libdummyatk.la \
@@ -39,20 +42,27 @@ app_test_LDFLAGS = libxmlloader.la \
app_test_SOURCES = test-application.c
-libxmlloader_la_CFLAGS = \
- $(GLIB_CFLAGS) \
+libxmlloader_la_CFLAGS = $(GLIB_CFLAGS) \
$(GOBJ_CFLAGS) \
$(XML_CFLAGS) \
$(ATK_CFLAGS) \
-I$(top_srcdir)/tests/dummyatk/
-libxmlloader_la_LIBADD = \
- $(GLIB_LIBS) \
+libxmlloader_la_LIBADD = $(GLIB_LIBS) \
$(XML_LIBS) \
$(GOBJ_LIBS) \
$(top_srcdir)/tests/dummyatk/libdummyatk.la \
$(ATK_LIBS)
-libxmlloader_la_SOURCES =\
- atk-object-xml-loader.c\
- atk-object-xml-loader.h
+libxmlloader_la_SOURCES = atk-object-xml-loader.c\
+ atk-object-xml-loader.h
+
+libtestutils_la_CFLAGS = -I$(top_builddir) \
+ $(GLIB_CFLAGS) \
+ $(ATSPI_CFLAGS)
+
+libtestutils_la_LIBADD = $(GLIB_LIBS) \
+ $(ATSPI_LIBS)
+
+libtestutils_la_SOURCES = atk_test_util.c \
+ atk_test_util.h
diff --git a/tests/README b/tests/README
index b48cb51..b49f270 100644
--- a/tests/README
+++ b/tests/README
@@ -72,3 +72,11 @@ AVAILABLE TESTS:
-accessible_set_cache_mask
-accessible_clear_cache
-accessible_get_process_id
+- Action:
+ -get_action_interface
+ -action_get_action_description
+ -action_get_action_name
+ -action_get_n_actions
+ -action_get_key_binding
+ -action_get_localized_name
+ -action_do_action
diff --git a/tests/atk-object-xml-loader.c b/tests/atk-object-xml-loader.c
index a05b4ea..2174584 100644
--- a/tests/atk-object-xml-loader.c
+++ b/tests/atk-object-xml-loader.c
@@ -29,6 +29,8 @@
#include "my-atk.h"
#define ACCESSIBLE_NODE ((const xmlChar *) "accessible")
+#define ACC_ACTION_NODE ((const xmlChar *) "accessible_action")
+#define ACTION_NODE ((const xmlChar *) "action")
#define INTERFACE_NODE ((const xmlChar *) "interface")
#define RELATION_NODE ((const xmlChar *) "relation")
#define STATE_NODE ((const xmlChar *) "state")
@@ -40,22 +42,26 @@
#define RELATION_TYPE_ATTR ((const xmlChar *) "relation_type")
#define RELATION_TARGET_NAME_ATTR ((const xmlChar *) "target_name")
#define STATE_TYPE_ATTR ((const xmlChar *) "state_enum")
+#define ACTION_NAME_ATTR ((const xmlChar *) "action_name")
+#define ACTION_DES_ATTR ((const xmlChar *) "action_description")
+#define ACTION_KEY_BIND_ATTR ((const xmlChar *) "key_binding")
MyAtkObject *relation_target = NULL;
-static MyAtkObject *
+static gpointer
create_atk_object_from_element (xmlNode *element)
{
xmlNode *child_node;
xmlNode *child_node2;
- MyAtkObject *obj = NULL;
- MyAtkObject *child_obj = NULL;
+ gpointer obj;
+ gpointer child_obj;
AtkRelationSet *relation_set = NULL;
AtkObject *array[1];
AtkRelation *relation;
AtkStateSet *state_set = NULL;
AtkStateType state_type;
+ AtkAction *action;
xmlChar *name;
xmlChar *description;
@@ -65,51 +71,66 @@ create_atk_object_from_element (xmlNode *element)
xmlChar *role;
gint relation_type;
xmlChar *relation_target_name;
- GType type = MY_TYPE_ATK_OBJECT;
+ xmlChar *action_name;
+ xmlChar *action_des;
+ xmlChar *action_key_bind;
name = xmlGetProp (element, NAME_ATTR);
description = xmlGetProp (element, DESC_ATTR);
role = xmlGetProp (element, ROLE_ATTR);
type_text = xmlGetProp (element, TYPE_ATTR);
+ GType type = MY_TYPE_ATK_OBJECT;
+
+ if (!xmlStrcmp (element->name, ACCESSIBLE_NODE))
+ type = MY_TYPE_ATK_OBJECT;
+
+ if (!xmlStrcmp (element->name, ACC_ACTION_NODE))
+ type = MY_TYPE_ATK_ACTION;
- obj = MY_ATK_OBJECT (g_object_new (type,
- "accessible-name", name,
- "accessible-description", description,
- "accessible-role", atk_role_for_name (role),
- NULL));
+ obj = g_object_new (type,
+ "accessible-name", name,
+ "accessible-description", description,
+ "accessible-role", atk_role_for_name (role),
+ NULL);
child_node = element->xmlChildrenNode;
while (child_node != NULL) {
- if (!xmlStrcmp(child_node->name, ACCESSIBLE_NODE)) {
- child_obj = create_atk_object_from_element(child_node);
- my_atk_object_add_child(obj, child_obj);
-
- child_node2 = child_node->xmlChildrenNode;
- while (child_node2 != NULL) {
- if (!xmlStrcmp (child_node2->name, RELATION_NODE)) {
- relation_type_text = xmlGetProp (child_node2, RELATION_TYPE_ATTR);
- relation_type = atoi (relation_type_text);
- relation_target_name = xmlGetProp (child_node2, RELATION_TARGET_NAME_ATTR);
- relation_set = atk_object_ref_relation_set (ATK_OBJECT(child_obj));
- array[0] = ATK_OBJECT (obj);
- relation = atk_relation_new (array, 1, relation_type);
- atk_relation_new (array, 1, relation_type);
- atk_relation_set_add (relation_set, relation);
- g_object_unref (relation);
- g_object_unref (relation_set);
- xmlFree (relation_target_name);
- xmlFree (relation_type_text);
- }
- if (!xmlStrcmp (child_node2->name, STATE_NODE)) {
- state_set = atk_object_ref_state_set (ATK_OBJECT(child_obj));
- state_enum = xmlGetProp (child_node2, STATE_TYPE_ATTR);
- state_type = atk_state_type_for_name (state_enum);
- atk_state_set_add_state (state_set, state_type);
- g_object_unref (state_set);
- xmlFree (state_enum);
- }
- child_node2 = child_node2->next;
+ if (!xmlStrcmp (child_node->name, ACCESSIBLE_NODE) ||
+ !xmlStrcmp (child_node->name, ACC_ACTION_NODE)) {
+ child_obj = create_atk_object_from_element (child_node);
+ my_atk_object_add_child (obj, child_obj);
+ }
+ child_node2 = child_node->xmlChildrenNode;
+ while (child_node2 != NULL) {
+ if (!xmlStrcmp (child_node2->name, RELATION_NODE)) {
+ relation_type_text = xmlGetProp (child_node2, RELATION_TYPE_ATTR);
+ relation_type = atoi (relation_type_text);
+ relation_target_name = xmlGetProp (child_node2, RELATION_TARGET_NAME_ATTR);
+ relation_set = atk_object_ref_relation_set (ATK_OBJECT (child_obj));
+ array[0] = ATK_OBJECT (obj);
+ relation = atk_relation_new (array, 1, relation_type);
+ atk_relation_new (array, 1, relation_type);
+ atk_relation_set_add (relation_set, relation);
+ g_object_unref (relation);
+ g_object_unref (relation_set);
+ xmlFree (relation_target_name);
+ xmlFree (relation_type_text);
+ }
+ if (!xmlStrcmp (child_node2->name, STATE_NODE)) {
+ state_set = atk_object_ref_state_set (ATK_OBJECT (child_obj));
+ state_enum = xmlGetProp (child_node2, STATE_TYPE_ATTR);
+ state_type = atk_state_type_for_name (state_enum);
+ atk_state_set_add_state (state_set, state_type);
+ g_object_unref (state_set);
+ xmlFree (state_enum);
}
+ if (!xmlStrcmp (child_node2->name, ACTION_NODE)) {
+ action_name = xmlGetProp (child_node2, ACTION_NAME_ATTR);
+ action_des = xmlGetProp (child_node2, ACTION_DES_ATTR);
+ action_key_bind = xmlGetProp (child_node2, ACTION_KEY_BIND_ATTR);
+ my_atk_action_add_action (child_obj, action_name, action_des, action_key_bind);
+ }
+ child_node2 = child_node2->next;
}
child_node = child_node->next;
}
@@ -134,8 +155,10 @@ atk_object_xml_parse (gchar *filename)
root_element = xmlDocGetRootElement (doc);
- if (!xmlStrcmp (root_element->name, ACCESSIBLE_NODE))
- new_atk_object = create_atk_object_from_element (root_element);
+ if (!root_element)
+ return NULL;
+
+ new_atk_object = create_atk_object_from_element (root_element);
xmlFreeDoc (doc);
return new_atk_object;
diff --git a/tests/atk_suite.c b/tests/atk_suite.c
index 0c8a21b..0afb0ea 100644
--- a/tests/atk_suite.c
+++ b/tests/atk_suite.c
@@ -27,19 +27,21 @@
#include <sys/wait.h>
#include <unistd.h>
#include "atk_suite.h"
+#include "atk_test_util.h"
static gchar *tdata_list = NULL;
+static gchar *one_test = NULL;
typedef struct _Atk_Test_Case Atk_Test_Case;
-struct _Atk_Test_Case
-{
+struct _Atk_Test_Case {
const char *test_case;
void (*build)( void);
};
static const Atk_Test_Case atc[] = {
{ ATK_TEST_PATH_ACCESSIBLE, atk_test_accessible },
+ { ATK_TEST_PATH_ACTION, atk_test_action },
{ NULL, NULL}
};
@@ -59,11 +61,12 @@ atk_suite_build (int argc, char **argv )
{
g_test_init (&argc, &argv, NULL);
atk_test_accessible ();
+ atk_test_action ();
}
-static GOptionEntry optentries[] =
-{
+static GOptionEntry optentries[] = {
{"list", 'l', 0, G_OPTION_ARG_NONE, &tdata_list, "Display all available test cases", NULL},
+ {"separate", 0, 0, G_OPTION_ARG_STRING, &one_test, "Run only NAME test", "NAME"},
{NULL}
};
@@ -85,9 +88,28 @@ main(int argc, char **argv)
return EXIT_SUCCESS;
}
+ clean_exit_on_fail ();
+
+ if (one_test) {
+ if (!g_strcmp0 (one_test, "Accessible")) {
+ g_test_init (&argc, &argv, NULL);
+ atk_test_accessible ();
+ test_result = g_test_run ();
+ return (test_result == 0 ) ? 0 : 255;
+ }
+ if (!g_strcmp0 (one_test, "Action")) {
+ g_test_init (&argc, &argv, NULL);
+ atk_test_action ();
+ test_result = g_test_run ();
+ return (test_result == 0 ) ? 0 : 255;
+ }
+ g_print ("Unknown test name\n");
+ _list_tests ();
+ return EXIT_SUCCESS;
+ }
atk_suite_build (argc, argv);
test_result = g_test_run ();
- return ( test_result == 0 ) ? 0 : 255;
+ return (test_result == 0 ) ? 0 : 255;
}
diff --git a/tests/atk_suite.h b/tests/atk_suite.h
index 59b3892..2ac7e58 100644
--- a/tests/atk_suite.h
+++ b/tests/atk_suite.h
@@ -26,7 +26,9 @@
#include <atspi/atspi.h>
#define ATK_TEST_PATH_ACCESSIBLE (const char *)"/Accessible"
+#define ATK_TEST_PATH_ACTION (const char *)"/Action"
void atk_test_accessible (void);
+void atk_test_action (void);
#endif /* _ATK_SUITE_H */
diff --git a/tests/atk_test_accessible.c b/tests/atk_test_accessible.c
index 50ae9da..e6aeb2f 100644
--- a/tests/atk_test_accessible.c
+++ b/tests/atk_test_accessible.c
@@ -20,67 +20,10 @@
* Boston, MA 02111-1307, USA.
*/
-#include <stdio.h>
-#include <unistd.h>
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <locale.h>
#include "atk_suite.h"
+#include "atk_test_util.h"
-#define DATA_FILE TESTS_DATA_DIR"/test.xml"
-
-pid_t child_pid;
-
-void
-run_app (void)
-{
- int i=0;
- child_pid = fork ();
- if (child_pid == 0) {
- execlp ("./app-test",
- "./app-test",
- "--test-data-file",
- DATA_FILE,
- NULL);
- _exit(EXIT_SUCCESS);
- }
-}
-
-AtspiAccessible * get_root_obj (void)
-{
- int i;
- AtspiAccessible *obj= NULL;
-
- run_app ();
-
- /* sleep is needed to wait for forked test application */
- sleep (1);
-
- obj = atspi_get_desktop (0);
- gint child_count = atspi_accessible_get_child_count (obj, NULL);
- if (child_count < 1) {
- g_test_message ("Fail, test application not found\n");
- g_test_fail ();
- kill (child_pid, SIGTERM);
- return NULL;
- }
-
- for (i=0; i<child_count; i++) {
- AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,i, NULL);
- if (!strcmp (atspi_accessible_get_name (child, NULL), "root_object"))
- return child;
- }
- g_test_message ("test object not found\n");
- g_test_fail ();
-
- kill (child_pid, SIGTERM);
- return NULL;
-}
+#define DATA_FILE TESTS_DATA_DIR"/test-accessible.xml"
static void
teardown_accessible_test (gpointer fixture, gconstpointer user_data)
@@ -91,21 +34,21 @@ teardown_accessible_test (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_name (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
}
static void
atk_test_accessible_get_description (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
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)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
gint child_c = atspi_accessible_get_child_count (obj, NULL);
g_assert_cmpint ( 3, ==, child_c );
}
@@ -113,7 +56,7 @@ atk_test_accessible_get_child_count (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_parent (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL );
AtspiAccessible *parent = atspi_accessible_get_parent (child, NULL );
g_assert (parent == obj );
@@ -122,7 +65,7 @@ atk_test_accessible_get_parent (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_child_at_index (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL );
g_assert_cmpstr (atspi_accessible_get_name (child, NULL), ==, "obj2");
}
@@ -130,7 +73,7 @@ atk_test_accessible_get_child_at_index (gpointer fixture, gconstpointer user_dat
static void
atk_test_accessible_get_index_in_parent (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
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);
@@ -139,7 +82,7 @@ atk_test_accessible_get_index_in_parent (gpointer fixture, gconstpointer user_da
static void
atk_test_accessible_get_relation_set_1 (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
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);
@@ -149,8 +92,8 @@ 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)
{
- AtspiAccessible *root_object = get_root_obj ();
- AtspiAccessible *obj2 = atspi_accessible_get_child_at_index (root_object, 1, NULL);
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
+ 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);
int i=0;
@@ -166,7 +109,7 @@ atk_test_accessible_get_relation_set_2 (gpointer fixture, gconstpointer user_dat
static void
atk_test_accessible_get_role (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiRole root_role = atspi_accessible_get_role (obj, NULL);
g_assert_cmpint (root_role, ==, ATSPI_ROLE_ACCELERATOR_LABEL);
}
@@ -174,7 +117,7 @@ atk_test_accessible_get_role (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_role_name (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
gchar *root_role_name = atspi_accessible_get_role_name (obj, NULL);
g_assert_cmpstr (root_role_name, ==, "accelerator label");
}
@@ -182,7 +125,7 @@ atk_test_accessible_get_role_name (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_localized_role_name (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
gchar *root_role_name = atspi_accessible_get_localized_role_name (obj, NULL);
g_assert_cmpstr (root_role_name, ==, "accelerator label");
}
@@ -190,7 +133,7 @@ atk_test_accessible_get_localized_role_name (gpointer fixture, gconstpointer use
static void
atk_test_accessible_get_state_set (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
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);
@@ -211,13 +154,13 @@ atk_test_accessible_get_state_set (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_attributes (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
GHashTable *attr_hash_tab = atspi_accessible_get_attributes (obj, NULL);
GHashTableIter iter;
gpointer key, value;
- gchar *valid_keys[] = { "baz", "quux", "foo" };
- gchar *valid_values[] = { "qux", "corge", "bar" };
+ gchar *valid_keys[] = { "atspi" };
+ gchar *valid_values[] = { "test" };
g_hash_table_iter_init (&iter, attr_hash_tab );
int i = 0;
@@ -231,11 +174,11 @@ atk_test_accessible_get_attributes (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_attributes_as_array (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
- gchar *valid_attr[] = { "foo:bar", "baz:qux", "quux:corge", NULL };
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
+ gchar *valid_attr[] = { "atspi:test", NULL };
GArray *attr_arr = atspi_accessible_get_attributes_as_array ( obj, NULL);
int i = 0;
- g_assert (attr_arr->len == 3);
+ g_assert (attr_arr->len == (sizeof(valid_attr)/sizeof(gchar *))-1);
for( i = 0; i < attr_arr->len; ++i) {
g_assert_cmpstr (valid_attr[i], ==, g_array_index (attr_arr, gchar *, i));
}
@@ -244,7 +187,7 @@ atk_test_accessible_get_attributes_as_array (gpointer fixture, gconstpointer use
static void
atk_test_accessible_get_toolkit_name (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
gchar *toolkit_name = atspi_accessible_get_toolkit_name (obj, NULL);
g_assert_cmpstr (toolkit_name, ==, "atspitesting-toolkit");
@@ -253,7 +196,7 @@ atk_test_accessible_get_toolkit_name (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_toolkit_version (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
gchar *toolkit_ver = atspi_accessible_get_toolkit_version (obj, NULL);
/* should be empty string, because no value is setted */
g_assert_cmpstr (toolkit_ver, ==, "");
@@ -262,7 +205,7 @@ atk_test_accessible_get_toolkit_version (gpointer fixture, gconstpointer user_da
static void
atk_test_accessible_get_atspi_version (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
gchar *atspi_version = atspi_accessible_get_atspi_version (obj, NULL);
g_assert_cmpstr (atspi_version, ==, "2.0");
}
@@ -270,7 +213,7 @@ atk_test_accessible_get_atspi_version (gpointer fixture, gconstpointer user_data
static void
atk_test_accessible_get_id (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
gint app_id = atspi_accessible_get_id (obj, NULL);
g_assert_cmpint (app_id, !=, -1);
}
@@ -278,7 +221,7 @@ atk_test_accessible_get_id (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_application (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiAccessible *app = atspi_accessible_get_application (obj, NULL);
g_assert (app != NULL);
}
@@ -286,7 +229,7 @@ atk_test_accessible_get_application (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_action_iface (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiAction *iface = atspi_accessible_get_action_iface (obj);
g_assert (iface == NULL);
}
@@ -294,7 +237,7 @@ atk_test_accessible_get_action_iface (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_collection_iface (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiCollection *iface = atspi_accessible_get_collection_iface (obj);
g_assert (iface != NULL);
}
@@ -302,7 +245,7 @@ atk_test_accessible_get_collection_iface (gpointer fixture, gconstpointer user_d
static void
atk_test_accessible_get_component_iface (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiComponent *iface = atspi_accessible_get_component_iface (obj);
g_assert (iface == NULL);
}
@@ -310,7 +253,7 @@ atk_test_accessible_get_component_iface (gpointer fixture, gconstpointer user_da
static void
atk_test_accessible_get_document_iface (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiDocument *iface = atspi_accessible_get_document_iface (obj);
g_assert (iface == NULL);
}
@@ -318,7 +261,7 @@ atk_test_accessible_get_document_iface (gpointer fixture, gconstpointer user_dat
static void
atk_test_accessible_get_editable_text_iface (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (obj);
g_assert (iface == NULL);
}
@@ -326,7 +269,7 @@ atk_test_accessible_get_editable_text_iface (gpointer fixture, gconstpointer use
static void
atk_test_accessible_get_hypertext_iface (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiHypertext *iface = atspi_accessible_get_hypertext_iface (obj);
g_assert (iface == NULL);
}
@@ -334,7 +277,7 @@ atk_test_accessible_get_hypertext_iface (gpointer fixture, gconstpointer user_da
static void
atk_test_accessible_get_image_iface (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiImage *iface = atspi_accessible_get_image_iface (obj);
g_assert (iface == NULL);
}
@@ -342,7 +285,7 @@ atk_test_accessible_get_image_iface (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_selection_iface (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiSelection *iface = atspi_accessible_get_selection_iface (obj);
g_assert (iface == NULL);
}
@@ -350,7 +293,7 @@ atk_test_accessible_get_selection_iface (gpointer fixture, gconstpointer user_da
static void
atk_test_accessible_get_table_iface (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiTable *iface = atspi_accessible_get_table_iface (obj);
g_assert (iface == NULL);
}
@@ -358,7 +301,7 @@ atk_test_accessible_get_table_iface (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_text_iface (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiText *iface = atspi_accessible_get_text_iface (obj);
g_assert (iface == NULL);
}
@@ -366,7 +309,7 @@ atk_test_accessible_get_text_iface (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_value_iface (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiValue *iface = atspi_accessible_get_value_iface (obj);
g_assert (iface == NULL);
}
@@ -374,7 +317,7 @@ atk_test_accessible_get_value_iface (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_interfaces (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
gchar *valid_obj_ifaces[] = { "Accessible", "Collection" };
GArray *ifaces = atspi_accessible_get_interfaces (obj);
@@ -387,7 +330,7 @@ atk_test_accessible_get_interfaces (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_object_locale (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
const gchar *obj_locale = atspi_accessible_get_object_locale (obj, NULL);
g_assert_cmpstr (obj_locale, ==, setlocale (LC_MESSAGES, NULL));
}
@@ -395,7 +338,7 @@ atk_test_accessible_get_object_locale (gpointer fixture, gconstpointer user_data
static void
atk_test_accessible_set_cache_mask (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
AtspiCache cache_mask = ATSPI_CACHE_ROLE;
atspi_accessible_set_cache_mask (obj, cache_mask);
g_assert_cmpint (obj->parent.app->cache, ==, cache_mask);
@@ -413,7 +356,7 @@ atk_test_check_cache_cleared (AtspiAccessible *obj)
static void
atk_test_accessible_clear_cache (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
atspi_accessible_clear_cache (obj);
atk_test_check_cache_cleared (obj);
}
@@ -421,7 +364,7 @@ atk_test_accessible_clear_cache (gpointer fixture, gconstpointer user_data)
static void
atk_test_accessible_get_process_id (gpointer fixture, gconstpointer user_data)
{
- AtspiAccessible *obj = get_root_obj ();
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
guint proc_id = atspi_accessible_get_process_id (obj, NULL);
g_assert_cmpint (proc_id, ==, child_pid);
}
@@ -430,73 +373,73 @@ void
atk_test_accessible(void )
{
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accesible_get_name",
- 0, NULL, NULL, atk_test_accessible_get_name, teardown_accessible_test );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 0, NULL, NULL, atk_test_accessible_get_process_id, teardown_accessible_test );
}
diff --git a/tests/atk_test_action.c b/tests/atk_test_action.c
new file mode 100644
index 0000000..fa79d1e
--- /dev/null
+++ b/tests/atk_test_action.c
@@ -0,0 +1,120 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "atk_suite.h"
+#include "atk_test_util.h"
+
+#define DATA_FILE TESTS_DATA_DIR"/test-action.xml"
+
+static void
+teardown_action_test (gpointer fixture, gconstpointer user_data)
+{
+ kill (child_pid, SIGTERM);
+}
+
+static void
+atk_test_action_sample_get_interface (gpointer fixture, gconstpointer user_data)
+{
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
+ 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);
+ g_assert (iface != NULL);
+}
+
+static void
+atk_test_action_get_action_description (gpointer fixture, gconstpointer user_data)
+{
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
+ 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)
+{
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
+ 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)
+{
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
+ 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)
+{
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
+ 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)
+{
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
+ 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)
+{
+ AtspiAccessible *obj = get_root_obj (DATA_FILE);
+ AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
+ AtspiAction *action = atspi_accessible_get_action_iface (child);
+ g_assert (action != NULL);
+ atspi_action_do_action (action, 0, NULL);
+ atspi_accessible_clear_cache (obj);
+ AtspiStateSet *s = atspi_accessible_get_state_set (child);
+ GArray *array = atspi_state_set_get_states (s);
+ g_assert_cmpint (array->len, ==, 1);
+}
+
+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);
+}
diff --git a/tests/atk_test_util.c b/tests/atk_test_util.c
new file mode 100644
index 0000000..22c791d
--- /dev/null
+++ b/tests/atk_test_util.c
@@ -0,0 +1,80 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <signal.h>
+#include "atk_test_util.h"
+
+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)
+{
+ int i=0;
+ child_pid = fork ();
+ if (child_pid == 0) {
+ execlp ("./app-test",
+ "./app-test",
+ "--test-data-file",
+ file_name,
+ NULL);
+ _exit (EXIT_SUCCESS);
+ }
+}
+
+AtspiAccessible * get_root_obj (const char *file_name)
+{
+ int i;
+ AtspiAccessible *obj = NULL;
+
+ run_app (file_name);
+
+ /* sleep is needed to wait for fored test application*/
+ sleep (1);
+
+ obj = atspi_get_desktop (0);
+ gint child_count = atspi_accessible_get_child_count (obj, NULL);
+ if (child_count < 1) {
+ g_test_message ("Fail, test application not found\n");
+ g_test_fail ();
+ kill (child_pid, SIGTERM);
+ return NULL;
+ }
+
+ for (i=0; i<child_count; i++) {
+ AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,i, NULL);
+ if (!strcmp (atspi_accessible_get_name (child, NULL), "root_object"))
+ return child;
+ }
+ g_test_message ("test object not found\n");
+ g_test_fail ();
+
+ kill (child_pid, SIGTERM);
+ return NULL;
+}
diff --git a/tests/atk_test_util.h b/tests/atk_test_util.h
new file mode 100644
index 0000000..b2376d5
--- /dev/null
+++ b/tests/atk_test_util.h
@@ -0,0 +1,45 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef _ATK_TEST_UTIL_H
+#define _ATK_TEST_UTIL_H
+
+#include <stdio.h>
+#include <unistd.h>
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <locale.h>
+#include "atk_suite.h"
+
+pid_t child_pid;
+
+void run_app (const char *file_name);
+AtspiAccessible *get_root_obj (const char *file_name);
+void clean_exit_on_fail ();
+
+#endif /* _ATK_TEST_UTIL_H */
diff --git a/tests/data/test-accessible.xml b/tests/data/test-accessible.xml
new file mode 100644
index 0000000..26728dd
--- /dev/null
+++ b/tests/data/test-accessible.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" ?>
+<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
+ <accessible description="first child" name="obj1" role="alert">
+ <state state_enum="modal"/>
+ <state state_enum="multi-line"/>
+ </accessible>
+ <accessible description="second child" name="obj2" role="animation">
+ <accessible description="first prechild" name="obj2/1" role="arrow">
+ <relation relation_type="2" target_name="obj2"/>
+ </accessible>
+ <accessible description="second prechild" name="obj2/2" role="canvas"/>
+ </accessible>
+ <accessible description="third child" name="obj3" role="check box">
+ <accessible description="first prechild" name="obj3/1" role="check menu item"/>
+ </accessible>
+</accessible>
diff --git a/tests/data/test-action.xml b/tests/data/test-action.xml
new file mode 100644
index 0000000..41ddf00
--- /dev/null
+++ b/tests/data/test-action.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" ?>
+<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
+ <accessible description="first child" name="obj1" role="alert"/>
+ <accessible_action description="second child" name="obj2" role="application">
+ <action action_name="action1" action_description="action1 description" key_binding="action1 key binding"/>
+ <action action_name="action2" action_description="action2 description" key_binding="action2 key binding"/>
+ </accessible_action>
+ <accessible_action description="third child" name="obj3" role="push button">
+ <action action_name="action1" action_description="action1 description" key_binding="action1 key binding"/>
+ </accessible_action>
+</accessible>
diff --git a/tests/dummyatk/Makefile.am b/tests/dummyatk/Makefile.am
index ff018a9..631e986 100644
--- a/tests/dummyatk/Makefile.am
+++ b/tests/dummyatk/Makefile.am
@@ -1,18 +1,19 @@
lib_LTLIBRARIES = libdummyatk.la
-libdummyatk_la_CFLAGS = $(ATK_CFLAGS) \
- $(GMODULE_CFLAGS) \
- $(GLIB_CFLAGS) \
- $(GOBJ_CFLAGS) \
+libdummyatk_la_CFLAGS = $(ATK_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(GOBJ_CFLAGS) \
-I$(top_srcdir)
libdummyatk_la_LDFLAGS = -no-undefined
-libdummyatk_la_LIBADD = $(ATK_LIBS) \
- $(GMODULE_LIBS) \
- $(GLIB_LIBS) \
+libdummyatk_la_LIBADD = $(ATK_LIBS) \
+ $(GLIB_LIBS) \
$(GOBJ_LIBS)
-libdummyatk_la_SOURCES = my-atk-object.c \
- my-atk-object.h \
+libdummyatk_la_SOURCES = \
+ my-atk-action.c \
+ my-atk-action.h \
+ my-atk-object.c \
+ my-atk-object.h \
my-atk.h
diff --git a/tests/dummyatk/my-atk-action.c b/tests/dummyatk/my-atk-action.c
new file mode 100644
index 0000000..3f02356
--- /dev/null
+++ b/tests/dummyatk/my-atk-action.c
@@ -0,0 +1,270 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <atk/atk.h>
+
+#include "my-atk-object.h"
+#include "my-atk-action.h"
+
+typedef struct _MyAtkActionInfo MyAtkActionInfo;
+
+struct _MyAtkActionInfo {
+ gchar *name;
+ gchar *description;
+ gchar *keybinding;
+
+ MyAtkActionFunc do_action_func;
+};
+
+static void atk_action_interface_init (AtkActionIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (MyAtkAction,
+ my_atk_action,
+ MY_TYPE_ATK_OBJECT,
+ G_IMPLEMENT_INTERFACE(ATK_TYPE_ACTION,
+ atk_action_interface_init));
+
+#define MY_ATK_ACTION_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MY_TYPE_ATK_ACTION, MyAtkActionPrivate))
+
+struct _MyAtkActionPrivate
+{
+ GQueue *action_queue;
+ guint action_idle_handler;
+ GList *action_list;
+ GList *children;
+};
+
+static void
+my_atk_action_initialize (AtkObject *obj, gpointer data)
+{
+}
+
+static void
+my_atk_action_init (MyAtkAction *action_obj)
+{
+ MyAtkActionPrivate *priv = MY_ATK_ACTION_GET_PRIVATE (action_obj);
+ action_obj->priv = priv;
+ priv->action_queue = NULL;
+ priv->action_idle_handler = 0;
+ priv->action_list = NULL;
+ priv->children = NULL;
+}
+
+static void
+my_atk_action_finalize (GObject *object)
+{
+}
+
+static void
+my_atk_action_class_init (MyAtkActionClass *my_class)
+{
+ AtkObjectClass *atk_class = ATK_OBJECT_CLASS (my_class);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (my_class);
+
+ gobject_class->finalize = my_atk_action_finalize;
+
+ atk_class->initialize = my_atk_action_initialize;
+
+ g_type_class_add_private (gobject_class, sizeof (MyAtkActionPrivate));
+}
+
+static MyAtkActionInfo *
+_my_atk_action_get_action_info (MyAtkAction *action, gint i)
+{
+ MyAtkActionPrivate *priv = NULL;
+ MyAtkActionInfo *node_data = NULL;
+
+ g_return_val_if_fail (MY_IS_ATK_ACTION (action), NULL);
+
+ priv = action->priv;
+
+ if (priv->action_list == NULL)
+ return NULL;
+
+ node_data = g_list_nth_data (priv->action_list, i);
+
+ g_return_val_if_fail (node_data, NULL);
+
+ return node_data;
+}
+
+static const gchar*
+my_atk_action_description_get (AtkAction *action, gint i)
+{
+ MyAtkAction *my_action = NULL;
+ MyAtkActionInfo *info = NULL;
+
+ g_return_val_if_fail (MY_IS_ATK_ACTION (action), NULL);
+ my_action = MY_ATK_ACTION (action);
+
+ info = _my_atk_action_get_action_info (my_action, i);
+
+ if (info == NULL)
+ return NULL;
+
+ return strdup (info->description);
+}
+
+static gboolean
+my_atk_action_description_set (AtkAction *action, gint i, const char *des)
+{
+ MyAtkAction *my_action = NULL;
+ MyAtkActionInfo *info = NULL;
+
+ g_return_val_if_fail (MY_IS_ATK_ACTION (action), FALSE);
+ my_action = MY_ATK_ACTION (action);
+
+ info = _my_atk_action_get_action_info (my_action, i);
+
+ if (info == NULL)
+ return FALSE;
+
+ g_free (info->description);
+ info->description = g_strdup (des);
+
+ return TRUE;
+}
+
+static const gchar*
+my_atk_action_name_get (AtkAction *action, gint i)
+{
+ MyAtkAction *my_action = NULL;
+ MyAtkActionInfo *info = NULL;
+
+ g_return_val_if_fail (MY_IS_ATK_ACTION (action), NULL);
+ my_action = MY_ATK_ACTION (action);
+
+ info = _my_atk_action_get_action_info (my_action, i);
+
+ if (info == NULL)
+ return NULL;
+
+ return strdup (info->name);
+}
+
+static const gchar*
+my_atk_action_localized_name_get (AtkAction *action, gint i)
+{
+ MyAtkAction *my_action = NULL;
+ MyAtkActionInfo *info = NULL;
+
+ g_return_val_if_fail (MY_IS_ATK_ACTION (action), NULL);
+ my_action = MY_ATK_ACTION (action);
+
+ info = _my_atk_action_get_action_info (my_action, i);
+
+ if (info == NULL)
+ return NULL;
+
+ return strdup (info->name);
+}
+
+static gint
+my_atk_action_get_n_actions (AtkAction *action)
+{
+ MyAtkAction *action_obj = NULL;
+ MyAtkActionPrivate *priv = NULL;
+
+ action_obj = MY_ATK_ACTION (action);
+ priv = action_obj->priv;
+
+ return g_list_length (priv->action_list);
+}
+
+static const gchar *
+my_atk_action_get_keybinding (AtkAction *action, gint i)
+{
+ MyAtkAction *my_action = NULL;
+ MyAtkActionInfo *info = NULL;
+
+ g_return_val_if_fail (MY_IS_ATK_ACTION (action), NULL);
+ my_action = MY_ATK_ACTION (action);
+
+ info = _my_atk_action_get_action_info (my_action, i);
+
+ if (info == NULL)
+ return NULL;
+
+ return strdup (info->keybinding);
+}
+
+void perform_action (AtkObject *obj)
+{
+ AtkStateSet *state_set1 = atk_object_ref_state_set (obj);
+ atk_state_set_add_state (state_set1, ATK_STATE_ACTIVE);
+}
+
+static gboolean
+my_atk_action_do_action (AtkAction *action, gint i)
+{
+ g_return_val_if_fail (MY_IS_ATK_ACTION (action), NULL);
+
+ MyAtkAction *my_action = NULL;
+ MyAtkActionPrivate *priv = NULL;
+
+ my_action = MY_ATK_ACTION (action);
+ priv = my_action->priv;
+
+ perform_action (ATK_OBJECT (action));
+
+ return FALSE;
+}
+
+guint my_atk_action_add_action (MyAtkAction *action,
+ const gchar *action_name,
+ const gchar *action_description,
+ const gchar *action_keybinding)
+{
+ MyAtkActionInfo *info = NULL;
+ MyAtkActionPrivate *priv = NULL;
+
+ g_return_val_if_fail (MY_IS_ATK_ACTION (action), -1);
+
+ priv = action->priv;
+
+ info = g_slice_new (MyAtkActionInfo);
+ info->name = g_strdup (action_name);
+ info->description = g_strdup (action_description);
+ info->keybinding = g_strdup (action_keybinding);
+
+ priv->action_list = g_list_append (priv->action_list, info);
+
+ return g_list_length (priv->action_list);
+}
+
+static void
+atk_action_interface_init (AtkActionIface *iface)
+{
+ g_return_if_fail (iface);
+
+ iface->do_action = my_atk_action_do_action;
+
+ iface->get_n_actions = my_atk_action_get_n_actions;
+ iface->get_description = my_atk_action_description_get;
+ iface->get_keybinding = my_atk_action_get_keybinding;
+ iface->get_name = my_atk_action_name_get;
+ iface->set_description = my_atk_action_description_set;
+ iface->get_localized_name = my_atk_action_localized_name_get;
+}
diff --git a/tests/dummyatk/my-atk-action.h b/tests/dummyatk/my-atk-action.h
new file mode 100644
index 0000000..8bdb4f8
--- /dev/null
+++ b/tests/dummyatk/my-atk-action.h
@@ -0,0 +1,63 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MY_ATK_ACTION_H
+#define MY_ATK_ACTION_H
+
+#include <glib.h>
+#include <glib-object.h>
+#include <atk/atk.h>
+
+#include "my-atk-object.h"
+
+#define MY_TYPE_ATK_ACTION (my_atk_action_get_type ())
+#define MY_ATK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_ACTION, MyAtkAction))
+#define MY_ATK_ACTION_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_ACTION, MyAtkActionClass))
+#define MY_IS_ATK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_ACTION))
+#define MY_IS_ATK_ACTION_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_ACTION))
+#define MY_ATK_ACTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_ACTION, MyAtkActionClass))
+
+typedef struct _MyAtkAction MyAtkAction;
+typedef struct _MyAtkActionPrivate MyAtkActionPrivate;
+typedef struct _MyAtkActionClass MyAtkActionClass;
+
+typedef void (* MyAtkActionFunc) (MyAtkAction *action);
+
+struct _MyAtkAction {
+ MyAtkObject parent;
+ MyAtkActionPrivate *priv;
+ gint last_performed_action;//this field is changed when action is performed
+
+};
+
+struct _MyAtkActionClass {
+ MyAtkObjectClass parent;
+};
+
+GType my_atk_action_get_type (void);
+
+guint my_atk_action_add_action (MyAtkAction *action,
+ const gchar *action_name,
+ const gchar *action_description,
+ const gchar *action_keybinding);
+
+#endif /*MY_ATK_ACTION_H*/
diff --git a/tests/dummyatk/my-atk-object.c b/tests/dummyatk/my-atk-object.c
index c20ad7a..c0b3014 100644
--- a/tests/dummyatk/my-atk-object.c
+++ b/tests/dummyatk/my-atk-object.c
@@ -25,21 +25,6 @@
#include "my-atk-object.h"
-struct _MyAtkObject
-{
- AtkObject parent;
- AtkStateSet *state_set;
- AtkAttributeSet *attributes;
- AtkRelationSet *relation_set;
- GPtrArray* children;
- gint id;
-};
-
-struct _MyAtkObjectClass
-{
- AtkObjectClass parent;
-};
-
GType my_atk_object_get_type (void);
G_DEFINE_TYPE (MyAtkObject,
@@ -66,7 +51,7 @@ void my_atk_object_remove_child (MyAtkObject* parent,
for (i = parent->children->len - 1; i >= 0; i--) {
if (g_ptr_array_index (parent->children, i) == child)
break;
- }
+ }
g_return_if_fail (i < 0);
g_ptr_array_remove_index (parent->children, i);
g_signal_emit_by_name (parent, "children-changed::remove", i, child);
@@ -140,24 +125,16 @@ static AtkStateSet *my_atk_object_ref_state_set (AtkObject *accessible)
static AtkAttributeSet *my_atk_object_get_attributes (AtkObject *accessible)
{
- MyAtkObject *obj = MY_ATK_OBJECT (accessible);
- AtkAttributeSet *rs = obj->attributes = NULL;
- AtkAttribute *a, *b, *c;
-
- a = g_new (AtkAttribute, 1);
- b = g_new (AtkAttribute, 1);
- c = g_new (AtkAttribute, 1);
-
- a->name = g_strdup ("foo");
- a->value = g_strdup ("bar");
- b->name = g_strdup ("baz");
- b->value = g_strdup ("qux");
- c->name = g_strdup ("quux");
- c->value = g_strdup ("corge");
-
- rs = g_slist_append (rs, (gpointer) a);
- rs = g_slist_append (rs, (gpointer) b);
- rs = g_slist_append (rs, (gpointer) c);
+ AtkAttributeSet *attributes;
+ AtkAttribute *attr;
+
+ attr = g_malloc (sizeof (AtkAttribute));
+ attr->name = g_strdup ("atspi");
+ attr->value = g_strdup ("test");
+
+ attributes = g_slist_append (NULL, attr);
+
+ return attributes;
}
static void my_atk_object_init (MyAtkObject *self)
diff --git a/tests/dummyatk/my-atk-object.h b/tests/dummyatk/my-atk-object.h
index 10ab034..d4a1eec 100644
--- a/tests/dummyatk/my-atk-object.h
+++ b/tests/dummyatk/my-atk-object.h
@@ -36,6 +36,18 @@
typedef struct _MyAtkObject MyAtkObject;
typedef struct _MyAtkObjectClass MyAtkObjectClass;
+struct _MyAtkObject {
+ AtkObject parent;
+ AtkStateSet *state_set;
+ AtkRelationSet *relation_set;
+ GPtrArray* children;
+ gint id;
+};
+
+struct _MyAtkObjectClass {
+ AtkObjectClass parent;
+};
+
GType my_atk_object_get_type ();
void my_atk_object_add_child (MyAtkObject* parent,
diff --git a/tests/dummyatk/my-atk.h b/tests/dummyatk/my-atk.h
index 97e1bfd..f617c9d 100644
--- a/tests/dummyatk/my-atk.h
+++ b/tests/dummyatk/my-atk.h
@@ -23,6 +23,7 @@
#ifndef MY_ATK_H
#define MY_ATK_H
+#include "my-atk-action.h"
#include "my-atk-object.h"
#endif /*MY_ATK_H*/
diff --git a/tests/test-application.c b/tests/test-application.c
index 74265ae..fe9527d 100644
--- a/tests/test-application.c
+++ b/tests/test-application.c
@@ -49,8 +49,8 @@ test_init (gchar *path)
gchar *td;
if (path == NULL) {
- g_print("No test data file provided\n");
- exit(EXIT_FAILURE);
+ g_print ("No test data file provided\n");
+ exit (EXIT_FAILURE);
}
tdata_path = path;
@@ -88,8 +88,7 @@ setup_atk_util (void)
g_type_class_unref (klass);
}
-static GOptionEntry optentries[] =
-{
+static GOptionEntry optentries[] = {
{"test-data-file", 0, 0, G_OPTION_ARG_STRING, &tdata_path, "Path to file of test data", NULL},
{NULL}
};