final Set<JCGLReferableType> ai0_refs = ai_0.references(); final Set<JCGLReferableType> ai1_refs = ai_1.references(); final Set<JCGLReferableType> ai2_refs = ai_2.references();
@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 testArrayDeleteIdentity() { 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.setAttributeFloatingPoint( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); final JCGLArrayObjectType ai = go.arrayObjectAllocate(b); go.arrayObjectDelete(ai); Assert.assertTrue(ai.isDeleted()); final Set<JCGLReferableType> ai_refs = ai.references(); Assert.assertEquals(0L, (long) ai_refs.size()); final Set<JCGLReferenceContainerType> a_refs = a.referringContainers(); Assert.assertEquals(0L, (long) a_refs.size()); }
Assert.assertEquals(Optional.of(i), ai.indexBufferBound()); final Set<JCGLReferableType> ai_refs = ai.references(); Assert.assertEquals(2L, (long) ai_refs.size()); Assert.assertTrue(ai_refs.contains(a));