[gtk/focus-test: 1/2] testsuite: Try harder to record a full focus chain
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/focus-test: 1/2] testsuite: Try harder to record a full focus chain
- Date: Fri, 3 Apr 2020 16:56:20 +0000 (UTC)
commit 324af2f7010762beaead0da5cab68b30b95d2f3c
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Apr 3 11:22:00 2020 -0400
testsuite: Try harder to record a full focus chain
It is hard to avoid widgets with the same name in a
large ui file - try harder to record a full focus chain
before decide that we've wrapped, by including the widget
address in the comparison. Note that we don't include
the addresses in the generated output, since that would
make expected output vary from run to run.
testsuite/gtk/test-focus-chain.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/testsuite/gtk/test-focus-chain.c b/testsuite/gtk/test-focus-chain.c
index a76082feca..53fab0d5a3 100644
--- a/testsuite/gtk/test-focus-chain.c
+++ b/testsuite/gtk/test-focus-chain.c
@@ -93,6 +93,7 @@ generate_focus_chain (GtkWidget *window,
char *first = NULL;
char *last = NULL;
char *name = NULL;
+ char *key = NULL;
GString *output = g_string_new ("");
GtkWidget *focus;
int count = 0;
@@ -119,17 +120,22 @@ generate_focus_chain (GtkWidget *window,
gtk_widget_get_name (focus));
else
name = g_strdup (gtk_widget_get_name (focus));
+
+ key = g_strdup_printf ("%s %p", name, focus);
}
else
- name = g_strdup ("NONE");
+ {
+ name = g_strdup ("NONE");
+ key = g_strdup (key);
+ }
- if (first && g_str_equal (name, first))
+ if (first && g_str_equal (key, first))
{
g_string_append (output, "WRAP\n");
break; /* cycle completed */
}
- if (last && g_str_equal (name, last))
+ if (last && g_str_equal (key, last))
{
g_string_append (output, "STOP\n");
break; /* dead end */
@@ -139,10 +145,10 @@ generate_focus_chain (GtkWidget *window,
count++;
if (!first)
- first = g_strdup (name);
+ first = g_strdup (key);
g_free (last);
- last = g_strdup (name);
+ last = key;
if (count == 100)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]