reftests: Create the surface after running the main loop

Running the main loop may cause resizes, so creating the surface based
on the size before running it seems wrong.
This commit is contained in:
Benjamin Otte 2014-05-10 17:20:11 +02:00
parent fa8ca5fd13
commit f2258cb05c

View File

@ -232,11 +232,6 @@ snapshot_widget (GtkWidget *widget, SnapshotMode mode)
g_assert (gtk_widget_get_realized (widget));
surface = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
CAIRO_CONTENT_COLOR,
gtk_widget_get_allocated_width (widget),
gtk_widget_get_allocated_height (widget));
loop = g_main_loop_new (NULL, FALSE);
/* We wait until the widget is drawn for the first time.
* We can not wait for a GtkWidget::draw event, because that might not
@ -246,6 +241,11 @@ snapshot_widget (GtkWidget *widget, SnapshotMode mode)
gdk_event_handler_set (check_for_draw, loop, NULL);
g_main_loop_run (loop);
surface = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
CAIRO_CONTENT_COLOR,
gtk_widget_get_allocated_width (widget),
gtk_widget_get_allocated_height (widget));
cr = cairo_create (surface);
switch (mode)