diff options
author | Padraig O'Briain <padraigo@src.gnome.org> | 2001-11-22 15:58:58 +0000 |
---|---|---|
committer | Padraig O'Briain <padraigo@src.gnome.org> | 2001-11-22 15:58:58 +0000 |
commit | 904c325f06e97a4c2cf376f294b95bc23d0793d8 (patch) | |
tree | e7f4534e104092ab64ac96a8cf058fa982493323 /tests | |
parent | 77626512f3d262bf2eb3986f5d42cb567184554d (diff) | |
download | atk-904c325f06e97a4c2cf376f294b95bc23d0793d8.tar.gz |
Change atk_relation_type_from_string to atk_relation_type_for_name Add
* atk/atk.def, atk/atkrelationtype.h, docs/atk-sections.txt,
docs/tmpl/atkrelation.sgml:
Change atk_relation_type_from_string to atk_relation_type_for_name
Add atk_relation_type_get_name
* atk/atkrelationtype.c:
Change atk_relation_type_from_string to atk_relation_type_for_name
Add atk_relation_type_get_name
Update atk_relation_type_register() to correctly register new
relation types
* atk/atkstate.c:
Changed name of static variable type to last_type
Changed name of paremeter if atk_state_type_get_name to type to match
comments
* docs/tmpl/*sgml
Updated files
* tests/README, tests/Makefile.am
Add new test file testrelation.c
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 8 | ||||
-rw-r--r-- | tests/README | 6 | ||||
-rw-r--r-- | tests/testrelation.c | 101 |
3 files changed, 113 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 6e6767d..33d4bb8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,7 @@ -lib_LTLIBRARIES = libteststateset.la +lib_LTLIBRARIES = \ + libteststateset.la \ + libtestrelation.la libatk = $(top_builddir)/atk/libatk.la @@ -11,3 +13,7 @@ DEPS = \ libteststateset_la_SOURCES = teststateset.c libteststateset_la_LDFLAGS = -avoid-version \ -module + +libtestrelation_la_SOURCES = testrelation.c +libtestrelation_la_LDFLAGS = -avoid-version \ + -module diff --git a/tests/README b/tests/README index b3973c0..91ed76b 100644 --- a/tests/README +++ b/tests/README @@ -4,4 +4,8 @@ GTK program by specifying the GTK_MODULES environment variable. teststateset ============ -This module tests the interfaces in atk/atkstatset.h +This module tests the interfaces in atk/atkstateset.h + +testrelation +============ +This module tests the interfaces in atk/atkrelation.h diff --git a/tests/testrelation.c b/tests/testrelation.c new file mode 100644 index 0000000..9ffaec2 --- /dev/null +++ b/tests/testrelation.c @@ -0,0 +1,101 @@ +/* ATK - Accessibility Toolkit + * Copyright 2001 Sun Microsystems Inc. + * + * 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_relation (void); + +static gboolean +test_relation (void) +{ + AtkRelationType type1, type2; + G_CONST_RETURN gchar *name; + + name = atk_relation_type_get_name (ATK_RELATION_LABEL_FOR); + g_return_val_if_fail (name, FALSE); + if (strcmp (name, "label_for") != 0) + { + g_print ("Unexpected name for ATK_RELATION_LABEL_FOR %s\n", name); + return FALSE; + } + + name = atk_relation_type_get_name (ATK_RELATION_NODE_CHILD_OF); + g_return_val_if_fail (name, FALSE); + if (strcmp (name, "node_child_of") != 0) + { + g_print ("Unexpected name for ATK_STATE_MODAL %s\n", name); + return FALSE; + } + + type1 = atk_relation_type_for_name ("controlled_by"); + if (type1 != ATK_RELATION_CONTROLLED_BY) + { + g_print ("Unexpected type for focused\n"); + return FALSE; + } + + type1 = atk_relation_type_register ("test_state"); + name = atk_relation_type_get_name (type1); + g_return_val_if_fail (name, FALSE); + if (strcmp (name, "test_state") != 0) + { + g_print ("Unexpected name for test_state %s\n", name); + return FALSE; + } + type2 = atk_relation_type_for_name ("test_state"); + if (type1 != type2) + { + g_print ("Unexpected type for test_state\n"); + return FALSE; + } + type2 = atk_relation_type_for_name ("TEST-STATE"); + if (type2 != 0) + { + g_print ("Unexpected type for TEST-STATE\n"); + return FALSE; + } + /* + * Check that a non-existent type returns NULL + */ + name = atk_relation_type_get_name (ATK_RELATION_LAST_DEFINED + 2); + if (name) + { + g_print ("Unexpected name for undefined type\n"); + return FALSE; + } + return TRUE; +} + +int +gtk_module_init (gint argc, + char* argv[]) +{ + gboolean b_ret; + + g_print("Relation test module loaded\n"); + + b_ret = test_relation (); + if (b_ret) + g_print ("Relation tests succeeded\n"); + else + g_print ("Relation tests failed\n"); + return 0; +} |