From e95f6da1161d604b254b3b1e42de2a47caeff223 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 15 Jul 2010 01:08:03 +0200 Subject: [PATCH] testing: Use Cairo calls instead of gdk_draw_line() to test server sync --- gtk/tests/testing.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gtk/tests/testing.c b/gtk/tests/testing.c index dcc2d02706..40c7a021ed 100644 --- a/gtk/tests/testing.c +++ b/gtk/tests/testing.c @@ -137,16 +137,19 @@ test_xserver_sync (void) gtk_widget_show_now (window); while (repeat--) { - gint i, many = 100; + gint i, many = 200; double nosync_time, sync_time; + cairo_t *cr; + while (gtk_events_pending ()) gtk_main_iteration (); + cr = gdk_cairo_create (darea->window); + cairo_set_source_rgba (cr, 0, 1, 0, 0.1); /* run a number of consecutive drawing requests, just using drawing queue */ g_timer_start (gtimer); for (i = 0; i < many; i++) { - gdk_draw_line (darea->window, darea->style->black_gc, 0, 0, 320, 200); - gdk_draw_line (darea->window, darea->style->black_gc, 320, 0, 0, 200); + cairo_paint (cr); } g_timer_stop (gtimer); nosync_time = g_timer_elapsed (gtimer, NULL); @@ -157,8 +160,7 @@ test_xserver_sync (void) /* run a number of consecutive drawing requests with intermediate drawing syncs */ for (i = 0; i < many; i++) { - gdk_draw_line (darea->window, darea->style->black_gc, 0, 0, 320, 200); - gdk_draw_line (darea->window, darea->style->black_gc, 320, 0, 0, 200); + cairo_paint (cr); gdk_test_render_sync (darea->window); } g_timer_stop (gtimer);