[gtk/better-test-isolation-2: 6/6] testsuite: Make tests run without a11y bus



commit d1bd1270c9e7e6c57085d8624d7f6086c4992318
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Feb 5 22:24:39 2020 -0500

    testsuite: Make tests run without a11y bus
    
    Not having an a11y bus around causes warnings from
    at-spi, which make tests fail. Explicitly ignore those
    warnings.

 testsuite/gtk/defaultvalue.c     | 15 +++++++++++++++
 testsuite/gtk/objects-finalize.c | 16 +++++++++++++++-
 2 files changed, 30 insertions(+), 1 deletion(-)
---
diff --git a/testsuite/gtk/defaultvalue.c b/testsuite/gtk/defaultvalue.c
index fd7bc37fcd..cfe9623cf2 100644
--- a/testsuite/gtk/defaultvalue.c
+++ b/testsuite/gtk/defaultvalue.c
@@ -415,6 +415,19 @@ G_GNUC_END_IGNORE_DEPRECATIONS
   g_type_class_unref (klass);
 }
 
+static gboolean
+dbind_warning_handler (const char     *log_domain,
+                       GLogLevelFlags  log_level,
+                       const char     *message,
+                       gpointer        user_data)
+{
+  if (strcmp (log_domain, "dbind") == 0 &&
+      log_level == (G_LOG_LEVEL_WARNING|G_LOG_FLAG_FATAL))
+    return FALSE;
+
+  return TRUE;
+}
+
 int
 main (int argc, char **argv)
 {
@@ -445,6 +458,8 @@ main (int argc, char **argv)
   if (x_r_d)
     g_setenv ("XDG_RUNTIME_DIR", x_r_d, TRUE);
 
+  g_test_log_set_fatal_handler (dbind_warning_handler, NULL);
+
   gtk_test_init (&argc, &argv);
   gtk_test_register_all_types();
 
diff --git a/testsuite/gtk/objects-finalize.c b/testsuite/gtk/objects-finalize.c
index f1d85016ed..67a1a8217c 100644
--- a/testsuite/gtk/objects-finalize.c
+++ b/testsuite/gtk/objects-finalize.c
@@ -101,6 +101,19 @@ test_finalize_object (gconstpointer data)
   gtk_main();
 }
 
+static gboolean
+dbind_warning_handler (const char     *log_domain,
+                       GLogLevelFlags  log_level,
+                       const char     *message,
+                       gpointer        user_data)
+{
+  if (strcmp (log_domain, "dbind") == 0 &&
+      log_level == (G_LOG_LEVEL_WARNING|G_LOG_FLAG_FATAL))
+    return FALSE;
+
+  return TRUE;
+}
+
 int
 main (int argc, char **argv)
 {
@@ -129,11 +142,12 @@ main (int argc, char **argv)
   if (x_r_d)
     g_setenv ("XDG_RUNTIME_DIR", x_r_d, TRUE);
 
+  g_test_log_set_fatal_handler (dbind_warning_handler, NULL);
+
   /* initialize test program */
   gtk_test_init (&argc, &argv);
   gtk_test_register_all_types ();
 
-
   all_types = gtk_test_list_all_types (&n_types);
 
   for (i = 0; i < n_types; i++)


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