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.
This commit is contained in:
Matthias Clasen 2020-04-03 11:22:00 -04:00
parent de481a7b5e
commit 324af2f701

View File

@ -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)
{