summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTristan Van Berkom <tvb@src.gnome.org>2008-05-25 15:16:52 +0000
committerTristan Van Berkom <tvb@src.gnome.org>2008-05-25 15:16:52 +0000
commitcd697bb2e3dec998b559ac8db2e505c0f4172953 (patch)
treea75257790c35edbae4fcc9e5f76ef225ba7f4d32 /tests
parent97902c7c6aa17a96b459a6357458398c981c7412 (diff)
downloadgtk+-cd697bb2e3dec998b559ac8db2e505c0f4172953.tar.gz
Enhanced pango attribute tests, Added tests for requires tag handling.
* tests/buildertest.c: Enhanced pango attribute tests, Added tests for requires tag handling. svn path=/trunk/; revision=20154
Diffstat (limited to 'tests')
-rw-r--r--tests/buildertest.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/buildertest.c b/tests/buildertest.c
index b3214574ef..601a5f5bea 100644
--- a/tests/buildertest.c
+++ b/tests/buildertest.c
@@ -2084,6 +2084,8 @@ test_pango_attributes (void)
gtk_builder_add_from_string (builder, err_buffer1, -1, &error);
label = gtk_builder_get_object (builder, "label1");
g_assert (error);
+ g_assert (error->domain == GTK_BUILDER_ERROR);
+ g_assert (error->code == GTK_BUILDER_ERROR_MISSING_ATTRIBUTE);
g_object_unref (builder);
g_error_free (error);
error = NULL;
@@ -2091,12 +2093,38 @@ test_pango_attributes (void)
builder = gtk_builder_new ();
gtk_builder_add_from_string (builder, err_buffer2, -1, &error);
label = gtk_builder_get_object (builder, "label1");
+
g_assert (error);
+ g_assert (error->domain == GTK_BUILDER_ERROR);
+ g_assert (error->code == GTK_BUILDER_ERROR_INVALID_ATTRIBUTE);
g_object_unref (builder);
g_error_free (error);
}
+
+static void
+test_requires (void)
+{
+ GtkBuilder *builder;
+ GError *error = NULL;
+ gchar *buffer;
+ const gchar buffer_fmt[] =
+ "<interface>"
+ " <requires lib=\"gtk+\" version=\"%d.%d\"/>"
+ "</interface>";
+
+ buffer = g_strdup_printf (buffer_fmt, GTK_MAJOR_VERSION, GTK_MINOR_VERSION + 1);
+ builder = gtk_builder_new ();
+ gtk_builder_add_from_string (builder, buffer, -1, &error);
+ g_assert (error);
+ g_assert (error->domain == GTK_BUILDER_ERROR);
+ g_assert (error->code == GTK_BUILDER_ERROR_VERSION_MISMATCH);
+ g_object_unref (builder);
+ g_error_free (error);
+}
+
+
static void
test_file (const gchar *filename)
{
@@ -2180,6 +2208,7 @@ main (int argc, char **argv)
g_test_add_func ("/Builder/Window", test_window);
g_test_add_func ("/Builder/IconFactory", test_icon_factory);
g_test_add_func ("/Builder/PangoAttributes", test_pango_attributes);
+ g_test_add_func ("/Builder/Requires", test_requires);
return g_test_run();
}