summaryrefslogtreecommitdiff
path: root/tests/testrelation.c
diff options
context:
space:
mode:
authorPadraig O'Briain <padraigo@src.gnome.org>2001-12-04 18:39:20 +0000
committerPadraig O'Briain <padraigo@src.gnome.org>2001-12-04 18:39:20 +0000
commit344b987a21ee6f5be633a7fd469dfbe405023c2d (patch)
tree6a373ed8ab787dc2ec42b1ebacb0d848ae72e62d /tests/testrelation.c
parentcecce1cf6a6be8eb707462a5b2c80124fc84e7c7 (diff)
downloadatk-344b987a21ee6f5be633a7fd469dfbe405023c2d.tar.gz
Add implementation of atk_attribute_register, atk_attribute_for_name Udate
* atk/atktext.c: Add implementation of atk_attribute_register, atk_attribute_for_name Udate atk_attribute_get_name to use ATK_TYPE_TEXT__ATTRIBUTE and support extra attributes being defined * atk/atktext.h: Add ATK_TEXT_ATTR_INVALID and ATK_TEXT_ATTR_LAST_DEFINED to allow extra attributes to be defined Add atk_attribute_register() and atk_attribute_for_name() * atk/atk.def: Add new functions * docs/atk-sections.txt docs/tmpl/atktext.sgml Update because of additions to atk/atktext.h * tests/testrelation.c: Add tests for text attributes
Diffstat (limited to 'tests/testrelation.c')
-rw-r--r--tests/testrelation.c70
1 files changed, 68 insertions, 2 deletions
diff --git a/tests/testrelation.c b/tests/testrelation.c
index 6ea90ac..9c2216b 100644
--- a/tests/testrelation.c
+++ b/tests/testrelation.c
@@ -110,7 +110,7 @@ test_role (void)
role1 = atk_role_for_name ("list-item");
if (role1 != ATK_ROLE_LIST_ITEM)
{
- g_print ("Unexpected role for list_item\n");
+ g_print ("Unexpected role for list-item\n");
return FALSE;
}
@@ -135,7 +135,7 @@ test_role (void)
return FALSE;
}
/*
- * Check that a non-existent type returns NULL
+ * Check that a non-existent role returns NULL
*/
name = atk_role_get_name (ATK_ROLE_LAST_DEFINED + 2);
if (name)
@@ -146,6 +146,67 @@ test_role (void)
return TRUE;
}
+static gboolean
+test_text_attr (void)
+{
+ AtkTextAttribute attr1, attr2;
+ G_CONST_RETURN gchar *name;
+
+ name = atk_attribute_get_name (ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP);
+ g_return_val_if_fail (name, FALSE);
+ if (strcmp (name, "pixels-inside-wrap") != 0)
+ {
+ g_print ("Unexpected name for ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP %s\n", name);
+ return FALSE;
+ }
+
+ name = atk_attribute_get_name (ATK_TEXT_ATTR_BG_STIPPLE);
+ g_return_val_if_fail (name, FALSE);
+ if (strcmp (name, "bg-stipple") != 0)
+ {
+ g_print ("Unexpected name for ATK_TEXT_ATTR_BG_STIPPLE %s\n", name);
+ return FALSE;
+ }
+
+ attr1 = atk_attribute_for_name ("left-margin");
+ if (attr1 != ATK_TEXT_ATTR_LEFT_MARGIN)
+ {
+ g_print ("Unexpected attribute for left-margin\n");
+ return FALSE;
+ }
+
+ attr1 = atk_attribute_register ("test-attribute");
+ name = atk_attribute_get_name (attr1);
+ g_return_val_if_fail (name, FALSE);
+ if (strcmp (name, "test-attribute") != 0)
+ {
+ g_print ("Unexpected name for test-attribute %s\n", name);
+ return FALSE;
+ }
+ attr2 = atk_attribute_for_name ("test-attribute");
+ if (attr1 != attr2)
+ {
+ g_print ("Unexpected attribute for test-attribute\n");
+ return FALSE;
+ }
+ attr2 = atk_attribute_for_name ("TEST_ATTR");
+ if (attr2 != 0)
+ {
+ g_print ("Unexpected attribute for TEST_ATTR\n");
+ return FALSE;
+ }
+ /*
+ * Check that a non-existent attribute returns NULL
+ */
+ name = atk_attribute_get_name (ATK_TEXT_ATTR_LAST_DEFINED + 2);
+ if (name)
+ {
+ g_print ("Unexpected name for undefined attribute %s\n", name);
+ return FALSE;
+ }
+ return TRUE;
+}
+
int
gtk_module_init (gint argc,
char* argv[])
@@ -164,5 +225,10 @@ gtk_module_init (gint argc,
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;
}