gtk+ r20154 - in trunk: . tests



Author: tvb
Date: Sun May 25 15:16:52 2008
New Revision: 20154
URL: http://svn.gnome.org/viewvc/gtk+?rev=20154&view=rev

Log:

	* tests/buildertest.c: Enhanced pango attribute tests, Added tests
	for requires tag handling.



Modified:
   trunk/ChangeLog
   trunk/tests/buildertest.c

Modified: trunk/tests/buildertest.c
==============================================================================
--- trunk/tests/buildertest.c	(original)
+++ trunk/tests/buildertest.c	Sun May 25 15:16:52 2008
@@ -2084,6 +2084,8 @@
   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 @@
   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 @@
   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();
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]