GlueGen: src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen01.java Source File

GlueGen v2.6.0-rc-20250822 GlueGen, Native Binding Generator for Java™ (public API).

TestStructGen01.java
Go to the documentation of this file.
1package com.jogamp.gluegen.test.junit.structgen;
2
3import com.jogamp.common.os.Platform;
4import com.jogamp.junit.util.SingletonJunitCase;
5
6import org.junit.Assert;
7import org.junit.BeforeClass;
8import org.junit.Test;
9import org.junit.FixMethodOrder;
10import org.junit.runners.MethodSorters;
11
12@FixMethodOrder(MethodSorters.NAME_ASCENDING)
13public class TestStructGen01 extends SingletonJunitCase {
14
15 @BeforeClass
16 public static void init() {
17 // Enforce dependency,
18 // i.e. CStruct annotation processor to generate the types 'RenderingConfig' etc.
19 BuildStruct01.initSingleton();
20 Platform.initSingleton();
21 }
22
23 @Test
24 public void test01() {
25 final RenderingConfig config = RenderingConfig.create();
26 final Vec3f dir = config.getCamera().getDir();
27 dir.setX(0.5f);
28 dir.setY(0.6f);
29 dir.setZ(0.7f);
30 final Vec3f dir2 = Vec3f.create(dir.getBuffer());
31 Assert.assertEquals(dir.getX(), dir2.getX(), 0.0001f);
32 Assert.assertEquals(dir.getY(), dir2.getY(), 0.0001f);
33 Assert.assertEquals(dir.getZ(), dir2.getZ(), 0.0001f);
34 }
35
36 @Test
37 public void test02() {
38 final Camera cam = Camera.create();
39 final Vec3f cam_dir = cam.getDir();
40 final Vec3f cam_orig = cam.getOrig();
41 cam_dir.setX(1);
42 cam_dir.setY(2);
43 cam_dir.setZ(3);
44 cam_orig.setX(0);
45 cam_orig.setY(1);
46 cam_orig.setZ(2);
47 }
48
49 public static void main(final String args[]) {
50 final String tstname = TestStructGen01.class.getName();
51 org.junit.runner.JUnitCore.main(tstname);
52 }
53
54}
com.jogamp.common.os.Platform
Utility class for querying platform specific properties.
Definition: Platform.java:58
com.jogamp.common.os.Platform.initSingleton
static void initSingleton()
kick off static initialization of platform property information and native gluegen_rt lib loading
Definition: Platform.java:359
com.jogamp.gluegen.test.junit.structgen.BuildStruct01
Class simply triggering CStruct annotation processor to generate the types 'RenderingConfig' etc.
Definition: BuildStruct01.java:12
com.jogamp.gluegen.test.junit.structgen.BuildStruct01.initSingleton
static void initSingleton()
Definition: BuildStruct01.java:33
com.jogamp.gluegen.test.junit.structgen.TestStructGen01
Definition: TestStructGen01.java:13
com.jogamp.gluegen.test.junit.structgen.TestStructGen01.test01
void test01()
Definition: TestStructGen01.java:24
com.jogamp.gluegen.test.junit.structgen.TestStructGen01.test02
void test02()
Definition: TestStructGen01.java:37
com.jogamp.gluegen.test.junit.structgen.TestStructGen01.main
static void main(final String args[])
Definition: TestStructGen01.java:49
com.jogamp.gluegen.test.junit.structgen.TestStructGen01.init
static void init()
Definition: TestStructGen01.java:16
com.jogamp.junit.util.SingletonJunitCase
Definition: SingletonJunitCase.java:39