[evolution] Add --background option for test-html-editor-units



commit f228666d2631de89754e25b33272cb46a139e714
Author: Milan Crha <mcrha redhat com>
Date:   Wed Aug 24 16:17:08 2016 +0200

    Add --background option for test-html-editor-units

 e-util/test-html-editor-units-utils.c |   19 +++++++++++++++++--
 e-util/test-html-editor-units-utils.h |    2 ++
 e-util/test-html-editor-units.c       |    6 ++++++
 3 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/e-util/test-html-editor-units-utils.c b/e-util/test-html-editor-units-utils.c
index 8e6044e..fbe3bd3 100644
--- a/e-util/test-html-editor-units-utils.c
+++ b/e-util/test-html-editor-units-utils.c
@@ -26,6 +26,7 @@
 #include "test-html-editor-units-utils.h"
 
 static guint event_processing_delay_ms = 25;
+static gboolean in_background = FALSE;
 
 void
 test_utils_set_event_processing_delay_ms (guint value)
@@ -39,6 +40,18 @@ test_utils_get_event_processing_delay_ms (void)
        return event_processing_delay_ms;
 }
 
+void
+test_utils_set_background (gboolean background)
+{
+       in_background = background;
+}
+
+gboolean
+test_utils_get_background (void)
+{
+       return in_background;
+}
+
 typedef struct _UndoContent {
        gchar *html;
        gchar *plain;
@@ -206,8 +219,10 @@ test_utils_fixture_set_up (TestFixture *fixture,
        fixture->undo_stack = NULL;
        fixture->key_state = 0;
 
-       gtk_window_set_keep_below (GTK_WINDOW (fixture->window), TRUE);
-       gtk_window_set_focus_on_map (GTK_WINDOW (fixture->window), FALSE);
+       if (test_utils_get_background ()) {
+               gtk_window_set_keep_below (GTK_WINDOW (fixture->window), TRUE);
+               gtk_window_set_focus_on_map (GTK_WINDOW (fixture->window), FALSE);
+       }
 
        create_data.async_data = test_utils_async_call_prepare ();
        create_data.fixture = fixture;
diff --git a/e-util/test-html-editor-units-utils.h b/e-util/test-html-editor-units-utils.h
index bf3a208..2e5a14b 100644
--- a/e-util/test-html-editor-units-utils.h
+++ b/e-util/test-html-editor-units-utils.h
@@ -43,6 +43,8 @@ void          test_utils_set_event_processing_delay_ms
                                                (guint value);
 guint          test_utils_get_event_processing_delay_ms
                                                (void);
+void           test_utils_set_background       (gboolean background);
+gboolean       test_utils_get_background       (void);
 void           test_utils_add_test             (const gchar *name,
                                                 ETestFixtureSimpleFunc func);
 void           test_utils_fixture_set_up       (TestFixture *fixture,
diff --git a/e-util/test-html-editor-units.c b/e-util/test-html-editor-units.c
index cedf5a5..dc155f0 100644
--- a/e-util/test-html-editor-units.c
+++ b/e-util/test-html-editor-units.c
@@ -2565,11 +2565,16 @@ main (gint argc,
 {
        gchar *test_keyfile_filename;
        gint cmd_delay = -1;
+       gboolean background = FALSE;
        GOptionEntry entries[] = {
                { "cmd-delay", '\0', 0,
                  G_OPTION_ARG_INT, &cmd_delay,
                  "Specify delay, in milliseconds, to use during processing commands. Default is 25 ms.",
                  NULL },
+               { "background", '\0', 0,
+                 G_OPTION_ARG_NONE, &background,
+                 "Use to run tests in the background, not stealing focus and such.",
+                 NULL },
                { NULL }
        };
        GOptionContext *context;
@@ -2609,6 +2614,7 @@ main (gint argc,
 
        if (cmd_delay > 0)
                test_utils_set_event_processing_delay_ms ((guint) cmd_delay);
+       test_utils_set_background (background);
 
        e_util_init_main_thread (NULL);
        e_passwords_init ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]