mutter/tests/conform/test-object.c
Robert Bragg bbcbece6c9 tests: Improve thoroughness and reporting of make test
This patch reworks our conformance testing framework because it seems
that glib's gtesting framework isn't really well suited to our use case.
For example we weren't able to test windows builds given the way we
were using it and also for each test we'd like to repeat the test
with several different environments so we can test important driver and
feature combinations.

This patch instead switches away to a simplified but custom approach for
running our unit tests. We hope that having a more bespoke setup will
enable us to easily extend it to focus on the details important to us.

Notable changes with this new approach are:

We can now run 'make test' for our mingw windows builds.

We've got rid of all the test-*report* make rules and we're just left
with 'make test'

'make test' now runs each test several times with different driver and
feature combinations checking the result for each run. 'make test' will
then output a concise table of all of the results.

The combinations tested are:
- OpenGL Fixed Function
- OpenGL ARBfp
- OpenGL GLSL
- OpenGL No NPOT texture support
- OpenGLES 2.0
- OpenGLES 2.0 No NPOT texture support

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-24 14:42:31 +00:00

87 lines
2.0 KiB
C

#include <clutter/clutter.h>
#include <cogl/cogl.h>
#include <string.h>
#include "test-conform-common.h"
CoglUserDataKey private_key0;
CoglUserDataKey private_key1;
CoglUserDataKey private_key2;
static int user_data0;
static int user_data1;
static int user_data2;
static int destroy0_count = 0;
static int destroy1_count = 0;
static int destroy2_count = 0;
static void
destroy0_cb (void *user_data)
{
g_assert (user_data == &user_data0);
destroy0_count++;
}
static void
destroy1_cb (void *user_data)
{
g_assert (user_data == &user_data1);
destroy1_count++;
}
static void
destroy2_cb (void *user_data)
{
g_assert (user_data == &user_data2);
destroy2_count++;
}
void
test_cogl_object (TestUtilsGTestFixture *fixture,
void *data)
{
CoglPath *path;
/* Assuming that COGL_OBJECT_N_PRE_ALLOCATED_USER_DATA_ENTRIES == 2
* test associating 2 pointers to private data with an object */
cogl_path_new ();
path = cogl_get_path ();
cogl_object_set_user_data (COGL_OBJECT (path),
&private_key0,
&user_data0,
destroy0_cb);
cogl_object_set_user_data (COGL_OBJECT (path),
&private_key1,
&user_data1,
destroy1_cb);
cogl_object_set_user_data (COGL_OBJECT (path),
&private_key2,
&user_data2,
destroy2_cb);
cogl_object_set_user_data (COGL_OBJECT (path),
&private_key1,
NULL,
destroy1_cb);
cogl_object_set_user_data (COGL_OBJECT (path),
&private_key1,
&user_data1,
destroy1_cb);
cogl_object_unref (path);
g_assert_cmpint (destroy0_count, ==, 1);
g_assert_cmpint (destroy1_count, ==, 2);
g_assert_cmpint (destroy2_count, ==, 1);
if (cogl_test_verbose ())
g_print ("OK\n");
}