From 551945ce6cc1438eec0b304cb9dc0a1b730bdb7e Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Wed, 7 Jul 2010 13:38:10 +0100 Subject: [PATCH] tests: Force X synchronization so the stage size is reliable Normally the asynchronous nature of X means that setting the clutter stage size may really happen an indefinite amount of time later but since the tests are so short lived and may only render a single frame this is not an acceptable semantic. This way we should be able to remove all the hacky sleeps and frame count delays from our tests. --- tests/conform/test-conform-common.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/conform/test-conform-common.c b/tests/conform/test-conform-common.c index d64c72f74..8ff8d0d6f 100644 --- a/tests/conform/test-conform-common.c +++ b/tests/conform/test-conform-common.c @@ -1,5 +1,10 @@ #include +#ifdef COGL_HAS_XLIB +#include +#include +#endif + #include "test-conform-common.h" /** @@ -21,6 +26,18 @@ test_conform_simple_fixture_setup (TestConformSimpleFixture *fixture, "If you want to run all the tests you should run\n" "$ make test-report"); counter++; + +#ifdef COGL_HAS_XLIB + /* A lot of the tests depend on a specific stage / framebuffer size + * when they read pixels back to verify the results of the test. + * + * Normally the asynchronous nature of X means that setting the + * clutter stage size may really happen an indefinite amount of time + * later but since the tests are so short lived and may only render + * a single frame this is not an acceptable semantic. + */ + XSynchronize (clutter_x11_get_default_display(), TRUE); +#endif }