style tests: Show the window

Not doing so somewhat defeats the point that we want
to verify the regular styles, not some weird initial
conditions.
This commit is contained in:
Matthias Clasen 2020-01-15 02:00:09 -05:00
parent d9b1a1ebb1
commit 7b1ab8fb8b

View File

@ -98,12 +98,23 @@ done:
return diff; 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 |
GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE);
g_main_context_wakeup (NULL);
}
static void static void
load_ui_file (GFile *file, gboolean generate) load_ui_file (GFile *file, gboolean generate)
{ {
GtkBuilder *builder; GtkBuilder *builder;
GtkWidget *window; GtkWidget *window;
GtkStyleContext *context;
char *output, *diff; char *output, *diff;
char *ui_file, *css_file, *reference_file; char *ui_file, *css_file, *reference_file;
GtkCssProvider *provider; GtkCssProvider *provider;
@ -125,10 +136,13 @@ load_ui_file (GFile *file, gboolean generate)
g_assert (window != NULL); 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);
GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE);
while (!output)
g_main_context_iteration (NULL, FALSE);
if (generate) if (generate)
{ {