mutter/tests/conform/test-utils.h
Robert Bragg b5a7657076 Starts porting Cogl conformance tests from Clutter
This makes a start on porting the Cogl conformance tests that currently
still live in the Clutter repository to be standalone Cogl tests that no
longer require a ClutterStage.

The main thing is that this commit brings in is the basic testing
infrastructure we need, so now we can port more and more tests
incrementally.

Since the test suite wants a way to synchronize X requests/replies and
we can't simply call XSynchronize in the test-utils code before we know
if we are really running on X this adds a check for an environment
variable named "COGL_X11_SYNC" in cogl-xlib-renderer.c and if it's set
it forces XSynchronize (dpy, TRUE) to be called.

By default the conformance tests are run off screen. This makes the
tests run much faster and they also don't interfere with other work you
may want to do by constantly stealing focus. CoglOnscreen framebuffers
obviously don't get tested this way so it's important that the tests
also get run on screen every once in a while, especially if changes are
being made to CoglFramebuffer related code.  On screen testing can be
enabled by setting COGL_TEST_ONSCREEN=1 in your environment.
2011-09-08 15:48:07 +01:00

42 lines
1.1 KiB
C

#ifndef _TEST_UTILS_H_
#define _TEST_UTILS_H_
/* This fixture structure is allocated by glib, and before running
* each test we get a callback to initialize it.
*
* Actually we don't use this currently, we instead manage our own
* TestUtilsSharedState structure which also gets passed as a private
* data argument to the same initialization callback. The advantage of
* allocating our own shared state structure is that we can put data
* in it before we start running anything.
*/
typedef struct _TestUtilsGTestFixture
{
/**/
int dummy;
} TestUtilsGTestFixture;
/* Stuff you put in here is setup once in main() and gets passed around to
* all test functions and fixture setup/teardown functions in the data
* argument */
typedef struct _TestUtilsSharedState
{
int *argc_addr;
char ***argv_addr;
void (* todo_func) (TestUtilsGTestFixture *, void *data);
CoglContext *ctx;
CoglFramebuffer *fb;
} TestUtilsSharedState;
void
test_utils_init (TestUtilsGTestFixture *fixture,
const void *data);
void
test_utils_fini (TestUtilsGTestFixture *fixture,
const void *data);
#endif /* _TEST_UTILS_H_ */