Commit 62ece2ff authored by Martin Nordholts's avatar Martin Nordholts

app/tests: Make gimp_ui_synthesize_key_event() a global test util

parent edff4949
......@@ -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);
}
......@@ -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__ */
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment