summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2009-06-17 12:56:05 +0200
committerAlexander Larsson <alexl@redhat.com>2009-06-17 12:56:05 +0200
commit7303f3c9fdc2fcb75907a3fd81cc4a44446931a7 (patch)
tree7607ea832b4c8ddb1f61240b7ca43299f9f67e6e /tests
parentc08bf93fe5fd0f7192aec9ad0358da246c211e0f (diff)
parent1a385c50f041cdcc8ee88b27af85094901c2b05d (diff)
downloadgtk+-7303f3c9fdc2fcb75907a3fd81cc4a44446931a7.tar.gz
Merge branch 'master' into client-side-windows
This updates client-side-windows to the the latest soname change for easier testing. Conflicts: gdk/x11/gdkwindow-x11.c tests/Makefile.am
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/testfilechooser.c18
-rw-r--r--tests/testgtk.c2
-rw-r--r--tests/testorientable.c111
4 files changed, 133 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 48e440550c..db686263af 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -57,6 +57,7 @@ noinst_PROGRAMS = $(TEST_PROGS) \
testnotebookdnd \
testnouiprint \
testoffscreen \
+ testorientable \
testprint \
testrgb \
testrecentchooser \
@@ -138,6 +139,7 @@ testmultiscreen_DEPENDENCIES = $(TEST_DEPS)
testnotebookdnd_DEPENDENCIES = $(TEST_DEPS)
testnouiprint_DEPENDENCIES = $(TEST_DEPS)
testoffscreen_DEPENDENCIES = $(TEST_DEPS)
+testorientable_DEPENDENCIES = $(TEST_DEPS)
testprint_DEPENDENCIES = $(TEST_DEPS)
testrecentchooser_DEPENDENCIES = $(TEST_DEPS)
testrecentchoosermenu_DEPENDENCIES = $(TEST_DEPS)
@@ -199,6 +201,7 @@ testmultiscreen_LDADD = $(LDADDS)
testnotebookdnd_LDADD = $(LDADDS)
testnouiprint_LDADD = $(LDADDS)
testoffscreen_LDADD = $(LDADDS)
+testorientable_LDADD = $(LDADDS)
testprint_LDADD = $(LDADDS)
testrecentchooser_LDADD = $(LDADDS)
testrecentchoosermenu_LDADD = $(LDADDS)
diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c
index 7c008055ee..443f5c38a8 100644
--- a/tests/testfilechooser.c
+++ b/tests/testfilechooser.c
@@ -489,12 +489,16 @@ main (int argc, char **argv)
gboolean multiple = FALSE;
char *action_arg = NULL;
char *backend = NULL;
+ char *initial_filename = NULL;
+ char *initial_folder = NULL;
GError *error = NULL;
GOptionEntry options[] = {
{ "action", 'a', 0, G_OPTION_ARG_STRING, &action_arg, "Filechooser action", "ACTION" },
{ "backend", 'b', 0, G_OPTION_ARG_STRING, &backend, "Filechooser backend (default: gtk+)", "BACKEND" },
{ "multiple", 'm', 0, G_OPTION_ARG_NONE, &multiple, "Select-multiple", NULL },
{ "right-to-left", 'r', 0, G_OPTION_ARG_NONE, &force_rtl, "Force right-to-left layout.", NULL },
+ { "initial-filename", 'f', 0, G_OPTION_ARG_FILENAME, &initial_filename, "Initial filename to select", "FILENAME" },
+ { "initial-folder", 'F', 0, G_OPTION_ARG_FILENAME, &initial_folder, "Initial folder to show", "FILENAME" },
{ NULL }
};
@@ -505,6 +509,12 @@ main (int argc, char **argv)
return 1;
}
+ if (initial_filename && initial_folder)
+ {
+ g_print ("Only one of --initial-filename and --initial-folder may be specified");
+ return 1;
+ }
+
if (force_rtl)
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
@@ -625,6 +635,14 @@ main (int argc, char **argv)
"file:///usr/share/pixmaps",
NULL);
+ /* Initial filename or folder */
+
+ if (initial_filename)
+ set_filename (GTK_FILE_CHOOSER (dialog), initial_filename);
+
+ if (initial_folder)
+ set_current_folder (GTK_FILE_CHOOSER (dialog), initial_folder);
+
/* show_all() to reveal bugs in composite widget handling */
gtk_widget_show_all (dialog);
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 075bb8eb10..80e2fc03dd 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -5297,7 +5297,7 @@ entry_toggle_pulse (GtkWidget *checkbutton,
GtkWidget *entry)
{
g_object_set_data (G_OBJECT (entry), "progress-pulse",
- GINT_TO_POINTER (GTK_TOGGLE_BUTTON (checkbutton)->active));
+ GUINT_TO_POINTER ((guint) GTK_TOGGLE_BUTTON (checkbutton)->active));
}
static void
diff --git a/tests/testorientable.c b/tests/testorientable.c
new file mode 100644
index 0000000000..024816f745
--- /dev/null
+++ b/tests/testorientable.c
@@ -0,0 +1,111 @@
+/* testorientable.c
+ * Copyright (C) 2004 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+
+static void
+orient_toggled (GtkToggleButton *button, gpointer user_data)
+{
+ GList *orientables = (GList *) user_data, *ptr;
+ gboolean state = gtk_toggle_button_get_active (button);
+ GtkOrientation orientation;
+
+ if (state)
+ {
+ orientation = GTK_ORIENTATION_VERTICAL;
+ gtk_button_set_label (GTK_BUTTON (button), "Vertical");
+ }
+ else
+ {
+ orientation = GTK_ORIENTATION_HORIZONTAL;
+ gtk_button_set_label (GTK_BUTTON (button), "Horizontal");
+ }
+
+ for (ptr = orientables; ptr; ptr = ptr->next)
+ {
+ GtkOrientable *orientable = GTK_ORIENTABLE (ptr->data);
+
+ gtk_orientable_set_orientation (orientable, orientation);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ GtkWidget *window;
+ GtkWidget *table;
+ GtkWidget *box, *button;
+ GList *orientables = NULL;
+
+ gtk_init (&argc, &argv);
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ table = gtk_table_new (2, 3, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 12);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+
+ /* GtkBox */
+ box = gtk_hbox_new (6, FALSE);
+ orientables = g_list_prepend (orientables, box);
+ gtk_table_attach_defaults (GTK_TABLE (table), box, 0, 1, 1, 2);
+ gtk_box_pack_start (GTK_BOX (box),
+ gtk_button_new_with_label ("GtkBox 1"),
+ TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box),
+ gtk_button_new_with_label ("GtkBox 2"),
+ TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box),
+ gtk_button_new_with_label ("GtkBox 3"),
+ TRUE, TRUE, 0);
+
+ /* GtkButtonBox */
+ box = gtk_hbutton_box_new ();
+ orientables = g_list_prepend (orientables, box);
+ gtk_table_attach_defaults (GTK_TABLE (table), box, 1, 2, 1, 2);
+ gtk_box_pack_start (GTK_BOX (box),
+ gtk_button_new_with_label ("GtkButtonBox 1"),
+ TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box),
+ gtk_button_new_with_label ("GtkButtonBox 2"),
+ TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box),
+ gtk_button_new_with_label ("GtkButtonBox 3"),
+ TRUE, TRUE, 0);
+
+ /* GtkSeparator */
+ box = gtk_hseparator_new ();
+ orientables = g_list_prepend (orientables, box);
+ gtk_table_attach_defaults (GTK_TABLE (table), box, 2, 3, 1, 2);
+
+ button = gtk_toggle_button_new_with_label ("Horizontal");
+ gtk_table_attach (GTK_TABLE (table), button, 0, 1, 0, 1,
+ GTK_FILL, GTK_FILL, 0, 0);
+ g_signal_connect (button, "toggled",
+ G_CALLBACK (orient_toggled), orientables);
+
+ gtk_container_add (GTK_CONTAINER (window), table);
+ gtk_widget_show_all (window);
+
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (gtk_main_quit), NULL);
+
+ gtk_main ();
+
+ return 0;
+}