summaryrefslogtreecommitdiff
path: root/gtk/gtktestutils.h
diff options
context:
space:
mode:
authorTim Janik <timj@src.gnome.org>2007-11-20 15:03:26 +0000
committerTim Janik <timj@src.gnome.org>2007-11-20 15:03:26 +0000
commit936d27a475e9ecfb2c79dd1c0c46d679fea815c8 (patch)
tree020bd55bc90f6669cac253fb070aa9c157e5a6a5 /gtk/gtktestutils.h
parent9e0b0194ed7ded02d3093daaa6da7e7958eb4127 (diff)
downloadgtk+-936d27a475e9ecfb2c79dd1c0c46d679fea815c8.tar.gz
Added Gtk+ testing utilities.
* gtk/gtktestutils.h, gtk/gtktestutils.c: added unit test utility functions. for the most part, the functions herein involve navigating and interacting with dialog elements programatically, to automate user interaction tests of dialogs and widgets. * gtk/gtk.h: include gtk/gtktestutils.h as public API. * gtk/gtk.symbols: added gtk_test_* symbols. * gtk/Makefile.am: include gtktestutils.h and gtktestutils.c into the build. generate gtktypefuncs.c which contains a list of all _get_type functions in Gtk+ and Gdk. svn path=/trunk/; revision=19010
Diffstat (limited to 'gtk/gtktestutils.h')
-rw-r--r--gtk/gtktestutils.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/gtk/gtktestutils.h b/gtk/gtktestutils.h
new file mode 100644
index 0000000000..3550ae949d
--- /dev/null
+++ b/gtk/gtktestutils.h
@@ -0,0 +1,80 @@
+/* Gtk+ testing utilities
+ * Copyright (C) 2007 Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.
+ */
+#ifndef __GTK_TEST_UTILS_H__
+#define __GTK_TEST_UTILS_H__
+
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkspinbutton.h>
+
+G_BEGIN_DECLS;
+
+/* --- Gtk+ Test Utility API --- */
+void gtk_test_init (int *argcp,
+ char ***argvp,
+ ...);
+void gtk_test_register_all_types (void);
+GtkWidget* gtk_test_find_widget (GtkWidget *widget,
+ const gchar *label_pattern,
+ GType widget_type);
+GtkWidget* gtk_test_create_widget (GType widget_type,
+ const gchar *first_property_name,
+ ...);
+GtkWidget* gtk_test_create_simple_window (const gchar *window_title,
+ const gchar *dialog_text);
+GtkWidget* gtk_test_display_button_window (const gchar *window_title,
+ const gchar *dialog_text,
+ ...); /* NULL terminated list of (label, &int) pairs */
+void gtk_test_xserver_render_sync (GdkWindow *window);
+void gtk_test_slider_set_perc (GtkWidget *widget, /* GtkRange-alike */
+ double percentage);
+double gtk_test_slider_get_value (GtkWidget *widget);
+gboolean gtk_test_spin_button_click (GtkSpinButton *widget,
+ guint button,
+ gboolean upwards);
+gboolean gtk_test_widget_click (GtkWidget *widget,
+ guint button,
+ GdkModifierType modifiers);
+gboolean gtk_test_widget_send_key (GtkWidget *widget,
+ guint keyval,
+ GdkModifierType modifiers);
+/* operate on GtkEntry, GtkText, GtkTextView or GtkLabel */
+void gtk_test_text_set (GtkWidget *widget,
+ const gchar *string);
+gchar* gtk_test_text_get (GtkWidget *widget);
+
+/* --- Gtk+ Test low-level API --- */
+GtkWidget* gtk_test_find_sibling (GtkWidget *base_widget,
+ GType widget_type);
+GtkWidget* gtk_test_find_label (GtkWidget *widget,
+ const gchar *label_pattern);
+gboolean gtk_test_simulate_key (GdkWindow *window,
+ gint x,
+ gint y,
+ guint keyval,
+ GdkModifierType modifiers,
+ gboolean press_or_release);
+gboolean gtk_test_simulate_button (GdkWindow *window,
+ gint x,
+ gint y,
+ guint button, /*1..3*/
+ GdkModifierType modifiers,
+ gboolean press_or_release);
+G_END_DECLS;
+
+#endif /* __GTK_TEST_UTILS_H__ */