[gtk+/overlay: 33/34] Add a testcase for full-width overlays



commit 030cbf7c5481f0cba724c7a4ac0aa42da6ae3729
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 10 20:54:44 2011 -0400

    Add a testcase for full-width overlays

 tests/testoverlay.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/tests/testoverlay.c b/tests/testoverlay.c
index ed63c5f..2c27500 100644
--- a/tests/testoverlay.c
+++ b/tests/testoverlay.c
@@ -87,11 +87,41 @@ test_relative (void)
   return win;
 }
 
+static GtkWidget *
+test_fullwidth (void)
+{
+  GtkWidget *win;
+  GtkWidget *overlay;
+  GtkWidget *text;
+  GtkWidget *child;
+
+  win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_title (GTK_WINDOW (win), "Full-width");
+
+  overlay = gtk_overlay_new ();
+  gtk_container_add (GTK_CONTAINER (win), overlay);
+
+  text = gtk_text_view_new ();
+  gtk_widget_set_size_request (text, 200, 200);
+  gtk_widget_set_hexpand (text, TRUE);
+  gtk_widget_set_vexpand (text, TRUE);
+  gtk_container_add (GTK_CONTAINER (overlay), text);
+
+  child = gtk_label_new ("Fullwidth top overlay");
+  gtk_widget_set_halign (child, GTK_ALIGN_FILL);
+  gtk_widget_set_valign (child, GTK_ALIGN_START);
+  gtk_overlay_add (GTK_OVERLAY (overlay), child);
+  gtk_overlay_set_offset (GTK_OVERLAY (overlay), child, 4, 4);
+
+  return win;
+}
+
 int
 main (int argc, char *argv[])
 {
   GtkWidget *win1;
   GtkWidget *win2;
+  GtkWidget *win3;
 
   gtk_init (&argc, &argv);
 
@@ -104,6 +134,9 @@ main (int argc, char *argv[])
   win2 = test_relative ();
   gtk_widget_show_all (win2);
 
+  win3 = test_fullwidth ();
+  gtk_widget_show_all (win3);
+
   gtk_main ();
 
   return 0;



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