[gtk/focusable-containers: 1/3] testsuite: Be robust against broken focus



commit 1d93e3845626080bf52d1693896bf7b6d404a349
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jun 11 15:48:07 2019 +0000

    testsuite: Be robust against broken focus
    
    When we start cycling on a subset, abort
    after a while.

 testsuite/gtk/test-focus-chain.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/testsuite/gtk/test-focus-chain.c b/testsuite/gtk/test-focus-chain.c
index dac0d114ac..a76082feca 100644
--- a/testsuite/gtk/test-focus-chain.c
+++ b/testsuite/gtk/test-focus-chain.c
@@ -92,9 +92,10 @@ generate_focus_chain (GtkWidget        *window,
 {
   char *first = NULL;
   char *last = NULL;
-  char *name;
+  char *name = NULL;
   GString *output = g_string_new ("");
   GtkWidget *focus;
+  int count = 0;
 
   gtk_widget_show (window);
 
@@ -135,6 +136,7 @@ generate_focus_chain (GtkWidget        *window,
         }
 
       g_string_append_printf (output, "%s\n", name);
+      count++;
 
       if (!first)
         first = g_strdup (name);
@@ -142,9 +144,16 @@ generate_focus_chain (GtkWidget        *window,
       g_free (last);
       last = g_strdup (name);
 
+      if (count == 100)
+        {
+          g_string_append (output, "ABORT\n");
+          break;
+        }
+
       g_free (name);
     }
 
+  g_free (name);
   g_free (first);
   g_free (last);
 


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