summaryrefslogtreecommitdiff
path: root/gtk/tests/builder.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2009-06-05 14:56:08 -0400
committerMatthias Clasen <mclasen@redhat.com>2009-06-05 18:00:26 -0400
commita85fac714563f632a097d1c30332d10f6de50f63 (patch)
tree5c7cba14c3c71bc9867316525c1db02c5afe16ca /gtk/tests/builder.c
parent4d7bbd058ebf4451d8f5856f2193bf176df87644 (diff)
downloadgtk+-a85fac714563f632a097d1c30332d10f6de50f63.tar.gz
Add a message area widget
It is called GtkInfoBar. See bug 555344.
Diffstat (limited to 'gtk/tests/builder.c')
-rw-r--r--gtk/tests/builder.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/gtk/tests/builder.c b/gtk/tests/builder.c
index 7b2cc19b60..3dbf40d1e6 100644
--- a/gtk/tests/builder.c
+++ b/gtk/tests/builder.c
@@ -2483,6 +2483,56 @@ test_file (const gchar *filename)
builder = NULL;
}
+static void
+test_message_area (void)
+{
+ GtkBuilder *builder;
+ GError *error;
+ 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>"
+ " </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>";
+
+ error = NULL;
+ builder = builder_new_from_string (buffer, -1, &error);
+ g_assert (error == 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 (obj1)) == 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 (obj1)) == obj);
+
+ g_object_unref (builder);
+}
+
int
main (int argc, char **argv)
{
@@ -2525,6 +2575,7 @@ main (int argc, char **argv)
g_test_add_func ("/Builder/Requires", test_requires);
g_test_add_func ("/Builder/AddObjects", test_add_objects);
g_test_add_func ("/Builder/Menus", test_menus);
+ g_test_add_func ("/Builder/MessageArea", test_message_area);
return g_test_run();
}