[gtk+/overlay] Add a GtkOverlay builder testcase
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/overlay] Add a GtkOverlay builder testcase
- Date: Sat, 11 Jun 2011 02:23:31 +0000 (UTC)
commit 706e95fee401a581d42d9b278c0851a450430bc4
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jun 10 22:21:52 2011 -0400
Add a GtkOverlay builder testcase
tests/testoverlay.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 86 insertions(+), 0 deletions(-)
---
diff --git a/tests/testoverlay.c b/tests/testoverlay.c
index b564a94..de8f726 100644
--- a/tests/testoverlay.c
+++ b/tests/testoverlay.c
@@ -165,6 +165,88 @@ test_scrolling (void)
return win;
}
+static const gchar *buffer =
+"<interface>"
+" <object class='GtkWindow' id='window'>"
+" <property name='title'>GtkBuilder support</property>"
+" <child>"
+" <object class='GtkOverlay' id='overlay'>"
+" <property name='relative_widget'>text</property>"
+" <child type='overlay'>"
+" <object class='GtkLabel' id='overlay-child'>"
+" <property name='label'>Witty remark goes here</property>"
+" <property name='halign'>end</property>"
+" <property name='valign'>end</property>"
+" </object>"
+" <packing>"
+" <property name='x-offset'>-2</property>"
+" <property name='y-offset'>-2</property>"
+" </packing>"
+" </child>"
+" <child>"
+" <object class='GtkGrid' id='grid'>"
+" <child>"
+" <object class='GtkLabel' id='left'>"
+" <property name='label'>Left</property>"
+" </object>"
+" <packing>"
+" <property name='left_attach'>0</property>"
+" <property name='top_attach'>0</property>"
+" </packing>"
+" </child>"
+" <child>"
+" <object class='GtkLabel' id='right'>"
+" <property name='label'>Right</property>"
+" </object>"
+" <packing>"
+" <property name='left_attach'>2</property>"
+" <property name='top_attach'>0</property>"
+" </packing>"
+" </child>"
+" <child>"
+" <object class='GtkTextView' id='text'>"
+" <property name='width-request'>200</property>"
+" <property name='height-request'>200</property>"
+" <property name='hexpand'>True</property>"
+" <property name='vexpand'>True</property>"
+" </object>"
+" <packing>"
+" <property name='left_attach'>1</property>"
+" <property name='top_attach'>0</property>"
+" </packing>"
+" </child>"
+" </object>"
+" </child>"
+" </object>"
+" </child>"
+" </object>"
+"</interface>";
+
+static GtkWidget *
+test_builder (void)
+{
+ GtkBuilder *builder;
+ GtkWidget *win;
+ GError *error;
+
+ builder = gtk_builder_new ();
+
+ error = NULL;
+ if (!gtk_builder_add_from_string (builder, buffer, -1, &error))
+ {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ return NULL;
+ }
+
+ win = (GtkWidget *)gtk_builder_get_object (builder, "window");
+ g_object_ref (win);
+
+ g_object_unref (builder);
+
+ return win;
+}
+
int
main (int argc, char *argv[])
{
@@ -172,6 +254,7 @@ main (int argc, char *argv[])
GtkWidget *win2;
GtkWidget *win3;
GtkWidget *win4;
+ GtkWidget *win5;
gtk_init (&argc, &argv);
@@ -190,6 +273,9 @@ main (int argc, char *argv[])
win4 = test_scrolling ();
gtk_widget_show_all (win4);
+ win5 = test_builder ();
+ gtk_widget_show_all (win5);
+
gtk_main ();
return 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]