summaryrefslogtreecommitdiffstats
path: root/src/junit/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-12-18 04:17:47 +0100
committerSven Gothel <[email protected]>2011-12-18 04:17:47 +0100
commitf20389b3f59c5d8c6d9afe0df16282dd09115640 (patch)
tree142ade0593db5b2a602be5aaff0c9756859f7d14 /src/junit/com
parent53bcf1366374a2005003088b02d6019ca402843c (diff)
JavaEmitter: Fix primitive StructEmitter for non-fixed-sized (size conversion, ie. 32/64 bits)
An opaque type still needs to be converted to the right size (32/64 bit). In case of a conversion, respect the pointer type. This fixes bug 536 .
Diffstat (limited to 'src/junit/com')
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java28
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1.c3
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1.h5
3 files changed, 33 insertions, 3 deletions
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java
index 4673805..8d9c73a 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java
@@ -685,10 +685,34 @@ public class BaseClass extends JunitTracer {
TK_Surface surface = binding.createSurface();
- assertAPTR(0x123456789abcdef0L, surface.getCtx());
+ final long surfaceContext = surface.getCtx();
+ assertAPTR(0x123456789abcdef0L, surfaceContext);
+
+ TK_ContextWrapper ctxWrapper = surface.getCtxWrapper();
+ final long wrapperContext = ctxWrapper.getCtx();
+ assertAPTR(0xA23456781abcdef0L, wrapperContext);
TK_Engine engine = surface.getEngine();
- assertAPTR(0x123456789abcdef0L, engine.getCtx());
+ final long engineContext = engine.getCtx();
+ assertAPTR(0xB23456782abcdef0L, engineContext);
+ Assert.assertEquals(0x0111, engine.render(0x0100, 0x0010, 0x0001));
+
+ surface.setCtx(surfaceContext);
+ assertAPTR(surfaceContext, surface.getCtx());
+ assertAPTR(wrapperContext, ctxWrapper.getCtx());
+ assertAPTR(engineContext, engine.getCtx());
+ Assert.assertEquals(0x0111, engine.render(0x0100, 0x0010, 0x0001));
+
+ ctxWrapper.setCtx(wrapperContext);
+ assertAPTR(surfaceContext, surface.getCtx());
+ assertAPTR(wrapperContext, ctxWrapper.getCtx());
+ assertAPTR(engineContext, engine.getCtx());
+ Assert.assertEquals(0x0111, engine.render(0x0100, 0x0010, 0x0001));
+
+ engine.setCtx(engineContext);
+ assertAPTR(surfaceContext, surface.getCtx());
+ assertAPTR(wrapperContext, ctxWrapper.getCtx());
+ assertAPTR(engineContext, engine.getCtx());
Assert.assertEquals(0x0111, engine.render(0x0100, 0x0010, 0x0001));
TK_Dimension dimension = surface.getBounds();
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c
index ae3c8a5..ebb1e08 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c
@@ -259,10 +259,11 @@ MYAPI TK_Surface * MYAPIENTRY createSurface() {
s->getClip = _TK_getClip;
s->ctx = (void *) 0x123456789abcdef0UL;
+ s->ctxWrapper.ctx = (void *) 0xA23456781abcdef0UL;
//s->engine = (TK_Engine *) calloc(1, sizeof(TK_Engine));
//s->engine->ctx = (void *) 0x123456789abcdef0UL;
//s->engine->render = _TK_render;
- s->engine.ctx = (void *) 0x123456789abcdef0UL;
+ s->engine.ctx = (void *) 0xB23456782abcdef0UL;
s->engine.render = _TK_render;
s->bounds.x = 0x11111111U;
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
index 6c38a03..76a15f2 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
@@ -143,8 +143,13 @@ typedef struct {
int32_t (MYAPIENTRY *render) (int x, int y, int ps);
} TK_Engine;
+typedef struct {
+ TK_Context ctx;
+} TK_ContextWrapper;
+
typedef struct tk_Surface {
TK_Context ctx;
+ TK_ContextWrapper ctxWrapper;
// const TK_Engine * engine;
TK_Engine engine;
TK_Dimension bounds;