app/tests: Make gimp_ui_synthesize_key_event() a global test util
This commit is contained in:
@ -134,3 +134,26 @@ gimp_test_utils_create_image (Gimp *gimp,
|
|||||||
|
|
||||||
return image;
|
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);
|
||||||
|
}
|
||||||
|
@ -25,6 +25,8 @@ void gimp_test_utils_setup_menus_dir (void);
|
|||||||
GimpImage * gimp_test_utils_create_image (Gimp *gimp,
|
GimpImage * gimp_test_utils_create_image (Gimp *gimp,
|
||||||
gint width,
|
gint width,
|
||||||
gint height);
|
gint height);
|
||||||
|
void gimp_test_utils_synthesize_key_event (GtkWidget *widget,
|
||||||
|
guint keyval);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_RECTANGLE_SELECT_TOOL_H__ */
|
#endif /* __GIMP_RECTANGLE_SELECT_TOOL_H__ */
|
||||||
|
@ -89,8 +89,6 @@ typedef struct
|
|||||||
|
|
||||||
static GimpUIManager * gimp_ui_get_ui_manager (Gimp *gimp);
|
static GimpUIManager * gimp_ui_get_ui_manager (Gimp *gimp);
|
||||||
static void gimp_ui_synthesize_delete_event (GtkWidget *widget);
|
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,
|
static gboolean gimp_ui_synthesize_click (GtkWidget *widget,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
@ -327,7 +325,7 @@ keyboard_zoom_focus (GimpTestFixture *fixture,
|
|||||||
factor_before_zoom = gimp_zoom_model_get_factor (shell->zoom);
|
factor_before_zoom = gimp_zoom_model_get_factor (shell->zoom);
|
||||||
|
|
||||||
/* Do the 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 ();
|
gimp_test_run_mainloop_until_idle ();
|
||||||
|
|
||||||
/* Make sure the zoom focus point remained fixed */
|
/* Make sure the zoom focus point remained fixed */
|
||||||
@ -747,22 +745,6 @@ gimp_ui_synthesize_delete_event (GtkWidget *widget)
|
|||||||
gdk_event_free (event);
|
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
|
static gboolean
|
||||||
gimp_ui_synthesize_click (GtkWidget *widget,
|
gimp_ui_synthesize_click (GtkWidget *widget,
|
||||||
gint x,
|
gint x,
|
||||||
|
Reference in New Issue
Block a user