[gimp] app/tests: Make gimp_ui_synthesize_key_event() a global test util
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app/tests: Make gimp_ui_synthesize_key_event() a global test util
- Date: Tue, 26 Oct 2010 12:15:55 +0000 (UTC)
commit 62ece2ff180bde8914d5ab61730bc04ca0767be6
Author: Martin Nordholts <martinn src gnome org>
Date: Tue Oct 26 13:53:24 2010 +0200
app/tests: Make gimp_ui_synthesize_key_event() a global test util
app/tests/gimp-app-test-utils.c | 23 +++++++++++++++++++++++
app/tests/gimp-app-test-utils.h | 14 ++++++++------
app/tests/test-ui.c | 20 +-------------------
3 files changed, 32 insertions(+), 25 deletions(-)
---
diff --git a/app/tests/gimp-app-test-utils.c b/app/tests/gimp-app-test-utils.c
index 392857c..c063109 100644
--- a/app/tests/gimp-app-test-utils.c
+++ b/app/tests/gimp-app-test-utils.c
@@ -134,3 +134,26 @@ gimp_test_utils_create_image (Gimp *gimp,
return image;
}
+
+/**
+ * gimp_test_utils_synthesize_key_event:
+ * @widget: Widget to target.
+ * @keyval: Keyval, e.g. GDK_Return
+ *
+ * Simulates a keypress and release with gdk_test_simulate_key().
+ **/
+void
+gimp_test_utils_synthesize_key_event (GtkWidget *widget,
+ guint keyval)
+{
+ gdk_test_simulate_key (gtk_widget_get_window (widget),
+ -1, -1, /*x, y*/
+ keyval,
+ 0 /*modifiers*/,
+ GDK_KEY_PRESS);
+ gdk_test_simulate_key (gtk_widget_get_window (widget),
+ -1, -1, /*x, y*/
+ keyval,
+ 0 /*modifiers*/,
+ GDK_KEY_RELEASE);
+}
diff --git a/app/tests/gimp-app-test-utils.h b/app/tests/gimp-app-test-utils.h
index 3224cf4..086037c 100644
--- a/app/tests/gimp-app-test-utils.h
+++ b/app/tests/gimp-app-test-utils.h
@@ -19,12 +19,14 @@
#define __GIMP_RECTANGLE_SELECT_TOOL_H__
-void gimp_test_utils_set_gimp2_directory (const gchar *root_env_var,
- const gchar *subdir);
-void gimp_test_utils_setup_menus_dir (void);
-GimpImage * gimp_test_utils_create_image (Gimp *gimp,
- gint width,
- gint height);
+void gimp_test_utils_set_gimp2_directory (const gchar *root_env_var,
+ const gchar *subdir);
+void gimp_test_utils_setup_menus_dir (void);
+GimpImage * gimp_test_utils_create_image (Gimp *gimp,
+ gint width,
+ gint height);
+void gimp_test_utils_synthesize_key_event (GtkWidget *widget,
+ guint keyval);
#endif /* __GIMP_RECTANGLE_SELECT_TOOL_H__ */
diff --git a/app/tests/test-ui.c b/app/tests/test-ui.c
index b6d115e..0cf3180 100644
--- a/app/tests/test-ui.c
+++ b/app/tests/test-ui.c
@@ -89,8 +89,6 @@ typedef struct
static GimpUIManager * gimp_ui_get_ui_manager (Gimp *gimp);
static void gimp_ui_synthesize_delete_event (GtkWidget *widget);
-static void gimp_ui_synthesize_key_event (GtkWidget *widget,
- guint keyval);
static gboolean gimp_ui_synthesize_click (GtkWidget *widget,
gint x,
gint y,
@@ -327,7 +325,7 @@ keyboard_zoom_focus (GimpTestFixture *fixture,
factor_before_zoom = gimp_zoom_model_get_factor (shell->zoom);
/* Do the zoom */
- gimp_ui_synthesize_key_event (GTK_WIDGET (window), GDK_plus);
+ gimp_test_utils_synthesize_key_event (GTK_WIDGET (window), GDK_plus);
gimp_test_run_mainloop_until_idle ();
/* Make sure the zoom focus point remained fixed */
@@ -747,22 +745,6 @@ gimp_ui_synthesize_delete_event (GtkWidget *widget)
gdk_event_free (event);
}
-static void
-gimp_ui_synthesize_key_event (GtkWidget *widget,
- guint keyval)
-{
- gdk_test_simulate_key (gtk_widget_get_window (widget),
- -1, -1, /*x, y*/
- keyval,
- 0 /*modifiers*/,
- GDK_KEY_PRESS);
- gdk_test_simulate_key (gtk_widget_get_window (widget),
- -1, -1, /*x, y*/
- keyval,
- 0 /*modifiers*/,
- GDK_KEY_RELEASE);
-}
-
static gboolean
gimp_ui_synthesize_click (GtkWidget *widget,
gint x,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]