summaryrefslogtreecommitdiff
path: root/test-fixtures/test-utils.h
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2013-10-09 13:31:12 +0100
committerRobert Bragg <robert@linux.intel.com>2013-11-27 19:33:44 +0000
commit6436cd073d256e54f82e7607874006862b2f0ad6 (patch)
treebb1217fdca60579ad36e8ac581d0bb6e08986b23 /test-fixtures/test-utils.h
parentd24f632d91d18909e2ca033e300b3679d927752f (diff)
downloadcogl-6436cd073d256e54f82e7607874006862b2f0ad6.tar.gz
Declare interface types as void and remove cast macros
This declares the interface types CoglFramebuffer, CoglBuffer, CoglTexture, CoglMetaTexture and CoglPrimitiveTexture as void when including the public cogl.h header so that users don't have to use lots of C type casts between instance types and interface types. This also removes all of the COGL_XYZ() type cast macros since they do nothing more than compile time type casting but it's less readable if you haven't seen that coding pattern before. Unlike with gobject based apis that use per-type macros for casting and performing runtime type checking we instead prefer to do our runtime type checking internally within the front-end public apis when objects are passed into Cogl. This greatly reduces the verbosity for users of the api and may help reduce the chance of excessive runtime type checking that can sometimes be a problem. (cherry picked from commit 248a76f5eac7e5ae4fb45208577f9a55360812a7) Since we can't break the 1.x api this version of the patch actually defines compatible NOP macros within deprecated/cogl-type-casts.h
Diffstat (limited to 'test-fixtures/test-utils.h')
-rw-r--r--test-fixtures/test-utils.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/test-fixtures/test-utils.h b/test-fixtures/test-utils.h
index 8449df22..9093fa86 100644
--- a/test-fixtures/test-utils.h
+++ b/test-fixtures/test-utils.h
@@ -1,6 +1,13 @@
#ifndef _TEST_UTILS_H_
#define _TEST_UTILS_H_
+/* NB: This header is for private and public api testing and so
+ * we need consider that if we are testing the public api we should
+ * just include <cogl/cogl.h> but since that will only provide
+ * opaque typedefs we need to include the specific internal headers
+ * for testing private apis...
+ */
+#ifdef COGL_COMPILATION
#include <cogl/cogl-context.h>
#include <cogl/cogl-onscreen.h>
#include <cogl/cogl-offscreen.h>
@@ -9,6 +16,10 @@
#include <cogl/cogl-texture-2d-sliced.h>
#include <cogl/cogl-meta-texture.h>
#include <cogl/cogl-atlas-texture.h>
+#else
+#include <cogl/cogl.h>
+#endif
+
#include <glib.h>
/* We don't really care about functions that are defined without a