1
0
Fork 0
mutter-performance-source/cogl/tests/conform/test-version.c
Jonas Ådahl d62d780a95 Remove cogl-1.0 vs cogl-2.0 vs cogl experimental API split
Mutter (and libmutter users) are the only users of this version of
cogl, and will more or less only use the cogl-1.0, cogl-2.0 and cogl
experimental API variants, and having the possibility of having
different API versions of the same API depending on what file includes
it is error prone and confusing. Lets just remove the possibility of
having different versions of the same API.

https://bugzilla.gnome.org/show_bug.cgi?id=768977
2016-07-20 14:23:48 +08:00

81 lines
3.7 KiB
C

#include <cogl/cogl.h>
#include "test-utils.h"
#include "cogl-config.h"
/* So we can use _COGL_STATIC_ASSERT we include the internal
* cogl-util.h header. Since internal headers explicitly guard against
* applications including them directly instead of including
* <cogl/cogl.h> we define __COGL_H_INSIDE__ here to subvert those
* guards in this case... */
#define __COGL_H_INSIDE__
#include <cogl/cogl-util.h>
#undef __COGL_H_INSIDE__
_COGL_STATIC_ASSERT (COGL_VERSION_ENCODE (COGL_VERSION_MAJOR,
COGL_VERSION_MINOR,
COGL_VERSION_MICRO) ==
COGL_VERSION,
"The pre-encoded Cogl version does not match the version "
"encoding macro");
_COGL_STATIC_ASSERT (COGL_VERSION_GET_MAJOR (COGL_VERSION_ENCODE (100,
200,
300)) ==
100,
"Getting the major component out of a encoded version "
"does not work");
_COGL_STATIC_ASSERT (COGL_VERSION_GET_MINOR (COGL_VERSION_ENCODE (100,
200,
300)) ==
200,
"Getting the minor component out of a encoded version "
"does not work");
_COGL_STATIC_ASSERT (COGL_VERSION_GET_MICRO (COGL_VERSION_ENCODE (100,
200,
300)) ==
300,
"Getting the micro component out of a encoded version "
"does not work");
_COGL_STATIC_ASSERT (COGL_VERSION_CHECK (COGL_VERSION_MAJOR,
COGL_VERSION_MINOR,
COGL_VERSION_MICRO),
"Checking the Cogl version against the current version "
"does not pass");
_COGL_STATIC_ASSERT (!COGL_VERSION_CHECK (COGL_VERSION_MAJOR,
COGL_VERSION_MINOR,
COGL_VERSION_MICRO + 1),
"Checking the Cogl version against a later micro version "
"should not pass");
_COGL_STATIC_ASSERT (!COGL_VERSION_CHECK (COGL_VERSION_MAJOR,
COGL_VERSION_MINOR + 1,
COGL_VERSION_MICRO),
"Checking the Cogl version against a later minor version "
"should not pass");
_COGL_STATIC_ASSERT (!COGL_VERSION_CHECK (COGL_VERSION_MAJOR + 1,
COGL_VERSION_MINOR,
COGL_VERSION_MICRO),
"Checking the Cogl version against a later major version "
"should not pass");
_COGL_STATIC_ASSERT (COGL_VERSION_CHECK (COGL_VERSION_MAJOR - 1,
COGL_VERSION_MINOR,
COGL_VERSION_MICRO),
"Checking the Cogl version against a older major version "
"should pass");
void
test_version (void)
{
const char *version = g_strdup_printf ("version = %i.%i.%i",
COGL_VERSION_MAJOR,
COGL_VERSION_MINOR,
COGL_VERSION_MICRO);
g_assert_cmpstr (version, ==, "version = " COGL_VERSION_STRING);
if (cogl_test_verbose ())
g_print ("OK\n");
}