From 2e7cb6019f7a6d159d3c980726ca94c83ba1b5c2 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 17 Jan 2020 20:35:00 -0500 Subject: [PATCH] node tests: Show the window This avoids using default styles. --- testsuite/css/nodes/test-css-nodes.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) 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) { -- 2.30.2