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.
This commit is contained in:
Robert Bragg 2010-07-07 13:38:10 +01:00
parent b24c96189d
commit 551945ce6c

View File

@ -1,5 +1,10 @@
#include <clutter/clutter.h>
#ifdef COGL_HAS_XLIB
#include <X11/Xlib.h>
#include <clutter/x11/clutter-x11.h>
#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
}