1 /* ATK - Accessibility Toolkit
2 * Copyright 2001 Sun Microsystems Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
24 static gboolean test_relation (void);
29 AtkRelationType type1, type2;
30 G_CONST_RETURN gchar *name;
32 name = atk_relation_type_get_name (ATK_RELATION_LABEL_FOR);
33 g_return_val_if_fail (name, FALSE);
34 if (strcmp (name, "label_for") != 0)
36 g_print ("Unexpected name for ATK_RELATION_LABEL_FOR %s\n", name);
40 name = atk_relation_type_get_name (ATK_RELATION_NODE_CHILD_OF);
41 g_return_val_if_fail (name, FALSE);
42 if (strcmp (name, "node_child_of") != 0)
44 g_print ("Unexpected name for ATK_STATE_MODAL %s\n", name);
48 type1 = atk_relation_type_for_name ("controlled_by");
49 if (type1 != ATK_RELATION_CONTROLLED_BY)
51 g_print ("Unexpected type for focused\n");
55 type1 = atk_relation_type_register ("test_state");
56 name = atk_relation_type_get_name (type1);
57 g_return_val_if_fail (name, FALSE);
58 if (strcmp (name, "test_state") != 0)
60 g_print ("Unexpected name for test_state %s\n", name);
63 type2 = atk_relation_type_for_name ("test_state");
66 g_print ("Unexpected type for test_state\n");
69 type2 = atk_relation_type_for_name ("TEST-STATE");
72 g_print ("Unexpected type for TEST-STATE\n");
76 * Check that a non-existent type returns NULL
78 name = atk_relation_type_get_name (ATK_RELATION_LAST_DEFINED + 2);
81 g_print ("Unexpected name for undefined type\n");
88 gtk_module_init (gint argc,
93 g_print("Relation test module loaded\n");
95 b_ret = test_relation ();
97 g_print ("Relation tests succeeded\n");
99 g_print ("Relation tests failed\n");