summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Piñeiro <apinheiro@igalia.com>2013-07-31 19:03:20 +0200
committerAlejandro Piñeiro <apinheiro@igalia.com>2013-08-01 10:01:55 +0200
commit67f02cb13547e90eb4e694d07942e7f3e2766e3c (patch)
treee926a22e67e4c76a2ccfbd0cf120a69ca1adfb84
parentdac4a581ebd377e4e67c35bf2c0a6a7f86fa03de (diff)
downloadatk-67f02cb13547e90eb4e694d07942e7f3e2766e3c.tar.gz
Refactor tests directory
Each test suite is no longer a loadable module. Split testrelation into testrelation and testrole.
-rw-r--r--.gitignore5
-rw-r--r--tests/Makefile.am28
-rw-r--r--tests/README9
-rw-r--r--tests/testrelation.c77
-rw-r--r--tests/testrole.c113
-rw-r--r--tests/teststateset.c4
6 files changed, 137 insertions, 99 deletions
diff --git a/.gitignore b/.gitignore
index b48d386..f361944 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,4 +37,7 @@ Makefile.in
/missing
/mkinstalldirs
/stamp-h1
-atkversion.h \ No newline at end of file
+atkversion.h
+tests/testrelation
+tests/testrole
+tests/teststateset
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7758530..3a3d191 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,32 +4,20 @@ else
no_undefined =
endif
-noinst_LTLIBRARIES = \
- libteststateset.la \
- libtestrelation.la
-
libatk = $(top_builddir)/atk/libatk-$(ATK_API_VERSION).la
-INCLUDES = -I$(top_srcdir) \
+AM_CPPFLAGS = -I$(top_srcdir) \
-DG_DISABLE_DEPRECATED \
$(DEP_CFLAGS)
DEPS = \
$(libatk)
-moduledir = $(libdir)/gtk-2.0/modules
+noinst_PROGRAMS = testrole \
+ testrelation \
+ teststateset
-libteststateset_la_SOURCES = teststateset.c
-libteststateset_la_LDFLAGS = \
- -rpath $(moduledir) \
- $(no_undefined) \
- -avoid-version \
- -module
-libteststateset_la_LIBADD = $(libatk) $(DEP_LIBS)
+LDADD = $(libatk) $(DEP_LIBS)
-libtestrelation_la_SOURCES = testrelation.c
-libtestrelation_la_LDFLAGS = \
- -rpath $(moduledir) \
- $(no_undefined) \
- -avoid-version \
- -module
-libtestrelation_la_LIBADD = $(libatk) $(DEP_LIBS)
+testrole_SOURCES = testrole.c
+testrelation_SOURCES = testrelation.c
+teststateset_SOURCES = teststateset.c
diff --git a/tests/README b/tests/README
index 91ed76b..f31dbb2 100644
--- a/tests/README
+++ b/tests/README
@@ -1,7 +1,3 @@
-The tests in this directory are grouped into shared libraries, each of
-which is a GTK_MODULE. That is, they are designed to be loaded into a running
-GTK program by specifying the GTK_MODULES environment variable.
-
teststateset
============
This module tests the interfaces in atk/atkstateset.h
@@ -9,3 +5,8 @@ This module tests the interfaces in atk/atkstateset.h
testrelation
============
This module tests the interfaces in atk/atkrelation.h
+
+testrole
+========
+This module tests the methods related with roles and role names,
+defined at atk/atkobject.h \ No newline at end of file
diff --git a/tests/testrelation.c b/tests/testrelation.c
index 8111d88..6cc0be5 100644
--- a/tests/testrelation.c
+++ b/tests/testrelation.c
@@ -21,9 +21,6 @@
#include <string.h>
-static gboolean test_relation (void);
-static gboolean test_role (void);
-
static gboolean
test_relation (void)
{
@@ -166,67 +163,6 @@ test_relation (void)
}
static gboolean
-test_role (void)
-{
- AtkRole role1, role2;
- const gchar *name;
-
- name = atk_role_get_name (ATK_ROLE_PAGE_TAB);
- g_return_val_if_fail (name, FALSE);
- if (strcmp (name, "page tab") != 0)
- {
- g_print ("Unexpected name for ATK_ROLE_PAGE_TAB %s\n", name);
- return FALSE;
- }
-
- name = atk_role_get_name (ATK_ROLE_LAYERED_PANE);
- g_return_val_if_fail (name, FALSE);
- if (strcmp (name, "layered pane") != 0)
- {
- g_print ("Unexpected name for ATK_ROLE_LAYERED_PANE %s\n", name);
- return FALSE;
- }
-
- role1 = atk_role_for_name ("list item");
- if (role1 != ATK_ROLE_LIST_ITEM)
- {
- g_print ("Unexpected role for list item\n");
- return FALSE;
- }
-
- role1 = atk_role_register ("test-role");
- name = atk_role_get_name (role1);
- g_return_val_if_fail (name, FALSE);
- if (strcmp (name, "test-role") != 0)
- {
- g_print ("Unexpected name for test-role %s\n", name);
- return FALSE;
- }
- role2 = atk_role_for_name ("test-role");
- if (role1 != role2)
- {
- g_print ("Unexpected role for test-role\n");
- return FALSE;
- }
- role2 = atk_role_for_name ("TEST_ROLE");
- if (role2 != 0)
- {
- g_print ("Unexpected role for TEST_ROLE\n");
- return FALSE;
- }
- /*
- * Check that a non-existent role returns NULL
- */
- name = atk_role_get_name (ATK_ROLE_LAST_DEFINED + 2);
- if (name)
- {
- g_print ("Unexpected name for undefined role %s\n", name);
- return FALSE;
- }
- return TRUE;
-}
-
-static gboolean
test_text_attr (void)
{
AtkTextAttribute attr1, attr2;
@@ -288,27 +224,24 @@ test_text_attr (void)
}
int
-gtk_module_init (gint argc,
- char* argv[])
+main (gint argc,
+ char* argv[])
{
gboolean b_ret;
- g_print("Relation test module loaded\n");
+ g_print("Starting Relation test suite\n");
b_ret = test_relation ();
if (b_ret)
g_print ("Relation tests succeeded\n");
else
g_print ("Relation tests failed\n");
- b_ret = test_role ();
- if (b_ret)
- g_print ("Role tests succeeded\n");
- else
- g_print ("Role tests failed\n");
+
b_ret = test_text_attr ();
if (b_ret)
g_print ("Text Attribute tests succeeded\n");
else
g_print ("Text Attribute tests failed\n");
+
return 0;
}
diff --git a/tests/testrole.c b/tests/testrole.c
new file mode 100644
index 0000000..7e95200
--- /dev/null
+++ b/tests/testrole.c
@@ -0,0 +1,113 @@
+/* ATK - Accessibility Toolkit
+ * Copyright (C) 2013 Igalia, S.L.
+ *
+ * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
+ *
+ * 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/atk.h>
+#include <string.h>
+
+static gboolean
+test_role (void)
+{
+ AtkRole role1, role2;
+ const gchar *name;
+
+ name = atk_role_get_name (ATK_ROLE_PAGE_TAB);
+ g_return_val_if_fail (name, FALSE);
+ if (strcmp (name, "page tab") != 0)
+ {
+ g_print ("Unexpected name for ATK_ROLE_PAGE_TAB %s\n", name);
+ return FALSE;
+ }
+
+ name = atk_role_get_name (ATK_ROLE_LAYERED_PANE);
+ g_return_val_if_fail (name, FALSE);
+ if (strcmp (name, "layered pane") != 0)
+ {
+ g_print ("Unexpected name for ATK_ROLE_LAYERED_PANE %s\n", name);
+ return FALSE;
+ }
+
+ role1 = atk_role_for_name ("list item");
+ if (role1 != ATK_ROLE_LIST_ITEM)
+ {
+ g_print ("Unexpected role for list item\n");
+ return FALSE;
+ }
+
+ role1 = atk_role_register ("test-role");
+ name = atk_role_get_name (role1);
+ g_return_val_if_fail (name, FALSE);
+ if (strcmp (name, "test-role") != 0)
+ {
+ g_print ("Unexpected name for test-role %s\n", name);
+ return FALSE;
+ }
+ role2 = atk_role_for_name ("test-role");
+ if (role1 != role2)
+ {
+ g_print ("Unexpected role for test-role\n");
+ return FALSE;
+ }
+ role2 = atk_role_for_name ("TEST_ROLE");
+ if (role2 != 0)
+ {
+ g_print ("Unexpected role for TEST_ROLE\n");
+ return FALSE;
+ }
+ /*
+ * Check that a non-existent role returns NULL
+ */
+ name = atk_role_get_name (ATK_ROLE_LAST_DEFINED + 2);
+ if (name)
+ {
+ g_print ("Unexpected name for undefined role %s\n", name);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void
+print_roles()
+{
+ AtkRole role;
+
+ g_print("(Role, name, localized name) defined by the ATK library:\n");
+
+ for (role = ATK_ROLE_INVALID; role < ATK_ROLE_LAST_DEFINED; role++)
+ g_print ("(%i, %s, %s)\n", role,
+ atk_role_get_name(role), atk_role_get_localized_name(role));
+}
+
+int
+main (int argc, char **argv)
+{
+ gboolean b_ret;
+
+ g_print ("Starting Role test suite\n");
+
+ print_roles();
+
+ b_ret = test_role ();
+ if (b_ret)
+ g_print ("Role tests succeeded\n");
+ else
+ g_print ("Role tests failed\n");
+
+ return 0;
+}
diff --git a/tests/teststateset.c b/tests/teststateset.c
index f2cb1d4..a9a3a6c 100644
--- a/tests/teststateset.c
+++ b/tests/teststateset.c
@@ -267,11 +267,11 @@ test_state (void)
}
int
-gtk_module_init (gint argc, char* argv[])
+main (gint argc, char* argv[])
{
gboolean b_ret;
- g_print("State Set test module loaded\n");
+ g_print("Starting State Set test suite\n");
b_ret = test_state_set ();
if (b_ret)