static gboolean test_text_attr (void) { AtkTextAttribute attr1, attr2; G_CONST_RETURN gchar *name; name = atk_text_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_text_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_text_attribute_for_name ("left-margin"); if (attr1 != ATK_TEXT_ATTR_LEFT_MARGIN) { g_print ("Unexpected attribute for left-margin\n"); return FALSE; } attr1 = atk_text_attribute_register ("test-attribute"); name = atk_text_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_text_attribute_for_name ("test-attribute"); if (attr1 != attr2) { g_print ("Unexpected attribute for test-attribute\n"); return FALSE; } attr2 = atk_text_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_text_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; }
static VALUE rg_s_type_register(G_GNUC_UNUSED VALUE self, VALUE name) { return ATKTEXTATTRIBUTE2RVAL(atk_text_attribute_register(RVAL2CSTR(name))); }