+static void
+test_message_area (void)
+{
+ GtkBuilder *builder;
+ GObject *obj, *obj1;
+ const gchar buffer[] =
+ "<interface>"
+ " <object class=\"GtkInfoBar\" id=\"infobar1\">"
+ " <child internal-child=\"content_area\">"
+ " <object class=\"GtkHBox\" id=\"contentarea1\">"
+ " <child>"
+ " <object class=\"GtkLabel\" id=\"content\">"
+ " <property name=\"label\" translatable=\"yes\">Message</property>"
+ " </object>"
+ " <packing>"
+ " <property name='expand'>False</property>"
+ " </packing>"
+ " </child>"
+ " </object>"
+ " </child>"
+ " <child internal-child=\"action_area\">"
+ " <object class=\"GtkVButtonBox\" id=\"actionarea1\">"
+ " <child>"
+ " <object class=\"GtkButton\" id=\"button_ok\">"
+ " <property name=\"label\">gtk-ok</property>"
+ " <property name=\"use-stock\">yes</property>"
+ " </object>"
+ " </child>"
+ " </object>"
+ " </child>"
+ " <action-widgets>"
+ " <action-widget response=\"1\">button_ok</action-widget>"
+ " </action-widgets>"
+ " </object>"
+ "</interface>";
+
+ builder = builder_new_from_string (buffer, -1, NULL);
+ obj = gtk_builder_get_object (builder, "infobar1");
+ g_assert (GTK_IS_INFO_BAR (obj));
+ obj1 = gtk_builder_get_object (builder, "content");
+ g_assert (GTK_IS_LABEL (obj1));
+ g_assert (gtk_widget_get_parent (gtk_widget_get_parent (GTK_WIDGET (obj1))) == GTK_WIDGET (obj));
+
+ obj1 = gtk_builder_get_object (builder, "button_ok");
+ g_assert (GTK_IS_BUTTON (obj1));
+ g_assert (gtk_widget_get_parent (gtk_widget_get_parent (GTK_WIDGET (obj1))) == GTK_WIDGET (obj));
+
+ g_object_unref (builder);
+}
+
+static void
+test_gmenu (void)
+{
+ GtkBuilder *builder;
+ GObject *obj, *obj1;
+ const gchar buffer[] =
+ "<interface>"
+ " <object class=\"GtkWindow\" id=\"window\">"
+ " </object>"
+ " <menu id='edit-menu'>"
+ " <section>"
+ " <item>"
+ " <attribute name='label'>Undo</attribute>"
+ " <attribute name='action'>undo</attribute>"
+ " </item>"
+ " <item>"
+ " <attribute name='label'>Redo</attribute>"
+ " <attribute name='action'>redo</attribute>"
+ " </item>"
+ " </section>"
+ " <section></section>"
+ " <section>"
+ " <attribute name='label'>Copy & Paste</attribute>"
+ " <item>"
+ " <attribute name='label'>Cut</attribute>"
+ " <attribute name='action'>cut</attribute>"
+ " </item>"
+ " <item>"
+ " <attribute name='label'>Copy</attribute>"
+ " <attribute name='action'>copy</attribute>"
+ " </item>"
+ " <item>"
+ " <attribute name='label'>Paste</attribute>"
+ " <attribute name='action'>paste</attribute>"
+ " </item>"
+ " </section>"
+ " <item><link name='section' id='blargh'>"
+ " <item>"
+ " <attribute name='label'>Bold</attribute>"
+ " <attribute name='action'>bold</attribute>"
+ " </item>"
+ " <submenu>"
+ " <attribute name='label'>Language</attribute>"
+ " <item>"
+ " <attribute name='label'>Latin</attribute>"
+ " <attribute name='action'>lang</attribute>"
+ " <attribute name='target'>'latin'</attribute>"
+ " </item>"
+ " <item>"
+ " <attribute name='label'>Greek</attribute>"
+ " <attribute name='action'>lang</attribute>"
+ " <attribute name='target'>'greek'</attribute>"
+ " </item>"
+ " <item>"
+ " <attribute name='label'>Urdu</attribute>"
+ " <attribute name='action'>lang</attribute>"
+ " <attribute name='target'>'urdu'</attribute>"
+ " </item>"
+ " </submenu>"
+ " </link></item>"
+ " </menu>"
+ "</interface>";
+
+ builder = builder_new_from_string (buffer, -1, NULL);
+ obj = gtk_builder_get_object (builder, "window");
+ g_assert (GTK_IS_WINDOW (obj));
+ obj1 = gtk_builder_get_object (builder, "edit-menu");
+ g_assert (G_IS_MENU_MODEL (obj1));
+ obj1 = gtk_builder_get_object (builder, "blargh");
+ g_assert (G_IS_MENU_MODEL (obj1));
+ g_object_unref (builder);
+}
+
+static void
+test_level_bar (void)
+{
+ GtkBuilder *builder;
+ GError *error = NULL;
+ GObject *obj, *obj1;
+ const gchar buffer1[] =
+ "<interface>"
+ " <object class=\"GtkWindow\" id=\"window\">"
+ " <child>"
+ " <object class=\"GtkLevelBar\" id=\"levelbar\">"
+ " <property name=\"value\">4.70</property>"
+ " <property name=\"min-value\">2</property>"
+ " <property name=\"max-value\">5</property>"
+ " <offsets>"
+ " <offset name=\"low\" value=\"2.25\"/>"
+ " <offset name=\"custom\" value=\"3\"/>"
+ " <offset name=\"high\" value=\"3\"/>"
+ " </offsets>"
+ " </object>"
+ " </child>"
+ " </object>"
+ "</interface>";
+ const gchar buffer2[] =
+ "<interface>"
+ " <object class=\"GtkLevelBar\" id=\"levelbar\">"
+ " <offsets>"
+ " <offset name=\"low\" bogus_attr=\"foo\"/>"
+ " </offsets>"
+ " </object>"
+ "</interface>";
+ const gchar buffer3[] =
+ "<interface>"
+ " <object class=\"GtkLevelBar\" id=\"levelbar\">"
+ " <offsets>"
+ " <offset name=\"low\" value=\"1\"/>"
+ " </offsets>"
+ " <bogus_tag>"
+ " </bogus_tag>"
+ " </object>"
+ "</interface>";
+
+ builder = gtk_builder_new ();
+ gtk_builder_add_from_string (builder, buffer1, -1, &error);
+ g_assert (error == NULL);
+
+ obj = gtk_builder_get_object (builder, "window");
+ g_assert (GTK_IS_WINDOW (obj));
+ obj1 = gtk_builder_get_object (builder, "levelbar");
+ g_assert (GTK_IS_LEVEL_BAR (obj1));
+ g_object_unref (builder);
+
+ error = NULL;
+ builder = gtk_builder_new ();
+ gtk_builder_add_from_string (builder, buffer2, -1, &error);
+ g_assert (g_error_matches (error,
+ GTK_BUILDER_ERROR,
+ GTK_BUILDER_ERROR_INVALID_ATTRIBUTE));
+ g_error_free (error);
+ g_object_unref (builder);
+
+ error = NULL;
+ builder = gtk_builder_new ();
+ gtk_builder_add_from_string (builder, buffer3, -1, &error);
+ g_assert (g_error_matches (error,
+ GTK_BUILDER_ERROR,
+ GTK_BUILDER_ERROR_UNHANDLED_TAG));
+ g_error_free (error);
+ g_object_unref (builder);
+}
+