@Test public final void testIntegralArrayAlreadyAssigned() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setStrictChecking(true); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, 16, 0L); this.expected.expect(JCGLExceptionAttributeAlreadyAssigned.class); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, 16, 0L); Assert.fail(); }
@Test public final void testIntegralArrayAlreadyAssigned() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setStrictChecking(true); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, 16, 0L); this.expected.expect(JCGLExceptionAttributeAlreadyAssigned.class); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, 16, 0L); Assert.fail(); }
@Test public final void testArrayBufferDeletion() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayBuffersType ga = i.getArrayBuffers(); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); ga.arrayBufferUnbind(); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); b.setAttributeIntegral( 0, a, 1, JCGLScalarIntegralType.TYPE_UNSIGNED_BYTE, 0, 0L); final JCGLArrayObjectType ao = go.arrayObjectAllocate(b); Assert.assertEquals(ao, go.arrayObjectGetCurrentlyBound()); ga.arrayBufferDelete(a); go.arrayObjectBind(ao); final Set<JCGLReferableType> refs = ao.getReferences(); Assert.assertEquals(1L, (long) refs.size()); Assert.assertTrue(refs.contains(a)); }
@Test public final void testIntegralArrayBadOffset() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, 16, 100L); Assert.fail(); }
@Test public final void testArrayBufferDeletion() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayBuffersType ga = i.getArrayBuffers(); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); ga.arrayBufferUnbind(); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); b.setAttributeIntegral( 0, a, 1, JCGLScalarIntegralType.TYPE_UNSIGNED_BYTE, 0, 0L); final JCGLArrayObjectType ao = go.arrayObjectAllocate(b); Assert.assertEquals(ao, go.arrayObjectGetCurrentlyBound()); ga.arrayBufferDelete(a); go.arrayObjectBind(ao); final Set<JCGLReferableType> refs = ao.references(); Assert.assertEquals(1L, (long) refs.size()); Assert.assertTrue(refs.contains(a)); }
@Test public final void testIntegralArrayBadIndex() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.setAttributeIntegral( -1, a, 4, JCGLScalarIntegralType.TYPE_INT, 16, 0L); Assert.fail(); }
@Test public final void testIntegralArrayBadElements1() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.setAttributeIntegral( 0, a, 5, JCGLScalarIntegralType.TYPE_INT, 16, 0L); Assert.fail(); }
@Test public final void testIntegralArrayBadStride() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, -1, 0L); Assert.fail(); }
@Test public final void testIntegralArrayBadStride() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, -1, 0L); Assert.fail(); }
@Test public final void testIntegralArrayBadElements0() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.setAttributeIntegral( 0, a, -1, JCGLScalarIntegralType.TYPE_INT, 16, 0L); Assert.fail(); }
@Test public final void testIntegralArrayBadElements1() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.setAttributeIntegral( 0, a, 5, JCGLScalarIntegralType.TYPE_INT, 16, 0L); Assert.fail(); }
@Test public final void testIntegralArrayBadOffset() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, 16, 100L); Assert.fail(); }
@Test public final void testIntegralArrayBadElements0() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.setAttributeIntegral( 0, a, -1, JCGLScalarIntegralType.TYPE_INT, 16, 0L); Assert.fail(); }
@Test public final void testIntegralArrayBadIndex() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.setAttributeIntegral( -1, a, 4, JCGLScalarIntegralType.TYPE_INT, 16, 0L); Assert.fail(); }
@Test public final void testIntegralArrayDeleted() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayBuffersType ga = i.getArrayBuffers(); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); ga.arrayBufferDelete(a); this.expected.expect(JCGLExceptionDeleted.class); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, 16, 0L); Assert.fail(); }
@Test public final void testIntegralArrayDeleted() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayBuffersType ga = i.getArrayBuffers(); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); ga.arrayBufferDelete(a); this.expected.expect(JCGLExceptionDeleted.class); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, 16, 0L); Assert.fail(); }
@Test public final void testArrayFromIdentities() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayBuffersType ga = i.getArrayBuffers(); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setAttributeFloatingPointWithDivisor( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false, 23); b.setAttributeFloatingPoint( 1, a, 3, JCGLScalarType.TYPE_INT, 20, 4L, true); b.setAttributeIntegral( 2, a, 2, JCGLScalarIntegralType.TYPE_INT, 24, 8L); final JCGLArrayObjectType o = go.arrayObjectAllocate(b); final JCGLArrayObjectBuilderType c = go.arrayObjectNewBuilderFromObject(o); for (int index = 0; index < b.getMaximumVertexAttributes(); ++index) { Assert.assertEquals(b.getAttributeAt(index), c.getAttributeAt(index)); } }
@Test public final void testArrayFromIdentities() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayBuffersType ga = i.getArrayBuffers(); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setAttributeFloatingPointWithDivisor( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false, 23); b.setAttributeFloatingPoint( 1, a, 3, JCGLScalarType.TYPE_INT, 20, 4L, true); b.setAttributeIntegral( 2, a, 2, JCGLScalarIntegralType.TYPE_INT, 24, 8L); final JCGLArrayObjectType o = go.arrayObjectAllocate(b); final JCGLArrayObjectBuilderType c = go.arrayObjectNewBuilderFromObject(o); for (int index = 0; index < b.getMaximumVertexAttributes(); ++index) { Assert.assertEquals(b.getAttributeAt(index), c.getAttributeAt(index)); } }
@Test public final void testIntegralArrayWrongContext() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLContextType c_main = i_main.getContext(); final Interfaces i_alt = this.getInterfaces("alt"); final JCGLArrayObjectsType go_alt = i_alt.getArrayObjects(); final JCGLContextType c_alt = i_alt.getContext(); Assert.assertFalse(c_main.contextIsCurrent()); Assert.assertTrue(c_alt.contextIsCurrent()); c_alt.contextReleaseCurrent(); c_main.contextMakeCurrent(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); c_main.contextReleaseCurrent(); c_alt.contextMakeCurrent(); final JCGLArrayObjectBuilderType b = go_alt.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(JCGLExceptionWrongContext.class); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, 16, 0L); Assert.fail(); }
@Test public final void testIntegralArrayWrongContext() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLContextType c_main = i_main.getContext(); final Interfaces i_alt = this.getInterfaces("alt"); final JCGLArrayObjectsType go_alt = i_alt.getArrayObjects(); final JCGLContextType c_alt = i_alt.getContext(); Assert.assertFalse(c_main.contextIsCurrent()); Assert.assertTrue(c_alt.contextIsCurrent()); c_alt.contextReleaseCurrent(); c_main.contextMakeCurrent(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); c_main.contextReleaseCurrent(); c_alt.contextMakeCurrent(); final JCGLArrayObjectBuilderType b = go_alt.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(JCGLExceptionWrongContext.class); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, 16, 0L); Assert.fail(); }