[libdazzle] tests: add hook to swap orientation
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] tests: add hook to swap orientation
- Date: Wed, 21 Jun 2017 22:54:24 +0000 (UTC)
commit 2636788898b81e96d0397900de1fc9031d23e95a
Author: Christian Hergert <chergert redhat com>
Date: Wed Jun 21 15:54:09 2017 -0700
tests: add hook to swap orientation
We have a small orientation bug and this exposes it in horizontal mode.
tests/data/test-multi-paned.ui | 6 +++---
tests/test-multi-paned.c | 16 ++++++++++++++++
2 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/tests/data/test-multi-paned.ui b/tests/data/test-multi-paned.ui
index 6869041..11e4813 100644
--- a/tests/data/test-multi-paned.ui
+++ b/tests/data/test-multi-paned.ui
@@ -3,7 +3,7 @@
<object class="GtkWindow" id="window">
<property name="title">Test Panel</property>
<child>
- <object class="DzlMultiPaned">
+ <object class="DzlMultiPaned" id="paned">
<property name="visible">true</property>
<child>
<object class="GtkButton">
@@ -18,8 +18,8 @@
</object>
</child>
<child>
- <object class="GtkButton">
- <property name="label">Button</property>
+ <object class="GtkButton" id="swap">
+ <property name="label">Swap Orientation</property>
<property name="expand">true</property>
<property name="visible">true</property>
</object>
diff --git a/tests/test-multi-paned.c b/tests/test-multi-paned.c
index f4f29e6..2174c3d 100644
--- a/tests/test-multi-paned.c
+++ b/tests/test-multi-paned.c
@@ -1,5 +1,15 @@
#include <dazzle.h>
+static void
+swap_orientation (GtkWidget *button,
+ GtkWidget *paned)
+{
+ GtkOrientation orientation;
+
+ orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (paned));
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (paned), !orientation);
+}
+
gint
main (gint argc,
gchar *argv[])
@@ -7,6 +17,8 @@ main (gint argc,
GtkBuilder *builder = NULL;
GtkWindow *window = NULL;
GError *error = NULL;
+ GObject *button;
+ GObject *paned;
g_autofree gchar *path = g_build_filename (TEST_DATA_DIR, "test-multi-paned.ui", NULL);
gtk_init (&argc, &argv);
@@ -17,6 +29,10 @@ main (gint argc,
gtk_builder_add_from_file (builder, path, &error);
g_assert_no_error (error);
+ paned = gtk_builder_get_object (builder, "paned");
+ button = gtk_builder_get_object (builder, "swap");
+ g_signal_connect (button, "clicked", G_CALLBACK (swap_orientation), paned);
+
window = GTK_WINDOW (gtk_builder_get_object (builder, "window"));
g_signal_connect (window, "delete-event", gtk_main_quit, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]