Commit 185deee3 authored by Martin Nordholts's avatar Martin Nordholts

app: Don't run UI tests when there is no DISPLAY

parent c87af702
......@@ -17,6 +17,8 @@
#include "config.h"
#include <stdlib.h>
#include <gtk/gtk.h>
#include "gui/gui-types.h"
......@@ -160,3 +162,20 @@ gimp_test_run_mainloop_until_idle (void)
g_main_loop_unref (loop);
}
/**
* gimp_test_bail_if_no_display:
* @void:
*
* If no DISPLAY is set, call exit(EXIT_SUCCESS). There is no use in
* having UI tests failing in DISPLAY-less environments.
**/
void
gimp_test_bail_if_no_display (void)
{
if (! g_getenv ("DISPLAY"))
{
g_message ("No DISPLAY set, not running UI tests\n");
exit (EXIT_SUCCESS);
}
}
......@@ -24,6 +24,7 @@ Gimp * gimp_init_for_gui_testing (gboolean use_cpu_accel,
gboolean show_gui);
void gimp_test_run_temp_mainloop (guint32 running_time);
void gimp_test_run_mainloop_until_idle (void);
void gimp_test_bail_if_no_display (void);
#endif /* __TESTS_H__ */
......@@ -69,6 +69,7 @@ int main(int argc, char **argv)
gchar *dockrc_filename = NULL;
gint result = 0;
gimp_test_bail_if_no_display ();
gtk_test_init (&argc, &argv, NULL);
/* Make sure to run this before we use any GIMP functions */
......
......@@ -838,6 +838,7 @@ int main(int argc, char **argv)
Gimp *gimp = NULL;
gint result = -1;
gimp_test_bail_if_no_display ();
gtk_test_init (&argc, &argv, NULL);
gimp_test_utils_set_gimp2_directory ("GIMP_TESTING_ABS_TOP_SRCDIR",
......
......@@ -968,6 +968,7 @@ main (int argc,
{
int result;
gimp_test_bail_if_no_display ();
gtk_test_init (&argc, &argv, NULL);
gimp_test_utils_set_gimp2_directory ("GIMP_TESTING_ABS_TOP_SRCDIR",
......
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