From: Matthias Clasen Date: Sat, 18 Jan 2020 01:35:00 +0000 (-0500) Subject: node tests: Show the window X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~20^2~308^2~14 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2e7cb6019f7a6d159d3c980726ca94c83ba1b5c2;p=gtk4.git node tests: Show the window This avoids using default styles. --- diff --git a/testsuite/css/nodes/test-css-nodes.c b/testsuite/css/nodes/test-css-nodes.c index 54664c7d45..28bdfcb9b1 100644 --- a/testsuite/css/nodes/test-css-nodes.c +++ b/testsuite/css/nodes/test-css-nodes.c @@ -96,12 +96,23 @@ done: return diff; } +static void +style_context_changed (GtkWidget *window, const char **output) +{ + GtkStyleContext *context; + + context = gtk_widget_get_style_context (window); + + *output = gtk_style_context_to_string (context, GTK_STYLE_CONTEXT_PRINT_RECURSE); + + g_main_context_wakeup (NULL); +} + static void load_ui_file (GFile *file, gboolean generate) { GtkBuilder *builder; GtkWidget *window; - GtkStyleContext *context; char *output, *diff; char *ui_file, *reference_file; GError *error = NULL; @@ -118,9 +129,13 @@ load_ui_file (GFile *file, gboolean generate) g_assert (window != NULL); - context = gtk_widget_get_style_context (window); + output = NULL; + g_signal_connect (window, "map", G_CALLBACK (style_context_changed), &output); + + gtk_widget_show (window); - output = gtk_style_context_to_string (context, GTK_STYLE_CONTEXT_PRINT_RECURSE); + while (!output) + g_main_context_iteration (NULL, FALSE); if (generate) {