tests: OSX - activate GIMP window when tests are running
If window is not focused gimp_test_utils_synthesize_key_event would fail.
This commit is contained in:
@ -1,5 +1,11 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
if PLATFORM_OSX
|
||||
xobjective_c = "-xobjective-c"
|
||||
xobjective_cxx = "-xobjective-c++"
|
||||
xnone = "-xnone"
|
||||
endif
|
||||
|
||||
libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
|
||||
libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
|
||||
libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
|
||||
@ -125,6 +131,7 @@ AM_CPPFLAGS = \
|
||||
$(LCMS_CFLAGS) \
|
||||
$(GEXIV2_CFLAGS) \
|
||||
$(psapi_cflags) \
|
||||
$(xobjective_c) \
|
||||
-I$(includedir) \
|
||||
-I$(builddir)/gui
|
||||
|
||||
|
15
app/tests.c
15
app/tests.c
@ -42,6 +42,10 @@
|
||||
#include "gimp-log.h"
|
||||
#include "tests.h"
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
gimp_status_func_dummy (const gchar *text1,
|
||||
@ -92,6 +96,14 @@ gimp_init_icon_theme_for_testing (void)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
static void
|
||||
gimp_osx_focus_window (void)
|
||||
{
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
#endif
|
||||
|
||||
static Gimp *
|
||||
gimp_init_for_gui_testing_internal (gboolean show_gui,
|
||||
GFile *gimprc)
|
||||
@ -129,6 +141,9 @@ gimp_init_for_gui_testing_internal (gboolean show_gui,
|
||||
gimp_init_icon_theme_for_testing ();
|
||||
gimp_initialize (gimp, gimp_status_func_dummy);
|
||||
gimp_restore (gimp, gimp_status_func_dummy, NULL);
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
g_idle_add ((GSourceFunc) gimp_osx_focus_window, NULL);
|
||||
#endif
|
||||
|
||||
return gimp;
|
||||
}
|
||||
|
Reference in New Issue
Block a user