node tests: Show the window

This avoids using default styles.
This commit is contained in:
Matthias Clasen 2020-01-17 20:35:00 -05:00
parent f1fce5253e
commit 2e7cb6019f

View File

@ -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);
output = gtk_style_context_to_string (context, GTK_STYLE_CONTEXT_PRINT_RECURSE);
gtk_widget_show (window);
while (!output)
g_main_context_iteration (NULL, FALSE);
if (generate)
{