@Test public final void testArrayDeleteUnbinds() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); ga.arrayBufferBind(a); Assert.assertEquals(Optional.of(a), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferDelete(a); Assert.assertTrue(a.isDeleted()); Assert.assertFalse(ga.arrayBufferGetCurrentlyBound().isPresent()); }
@Test public final void testArrayDeleteUnbinds() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); ga.arrayBufferBind(a); Assert.assertEquals(Optional.of(a), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferDelete(a); Assert.assertTrue(a.isDeleted()); Assert.assertFalse(ga.arrayBufferGetCurrentlyBound().isPresent()); }
@Test public final void testArrayDeleteNoUnbindOther() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayBufferType b = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); ga.arrayBufferBind(a); Assert.assertEquals(Optional.of(a), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferDelete(b); Assert.assertTrue(b.isDeleted()); Assert.assertFalse(a.isDeleted()); Assert.assertEquals(Optional.of(a), ga.arrayBufferGetCurrentlyBound()); }
@Test public final void testArrayBindIdentities() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); Assert.assertFalse(ga.arrayBufferGetCurrentlyBound().isPresent()); Assert.assertFalse(ga.arrayBufferAnyIsBound()); final JCGLArrayBufferType a0 = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayBufferType a1 = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); Assert.assertTrue(ga.arrayBufferAnyIsBound()); Assert.assertTrue(ga.arrayBufferIsBound(a1)); Assert.assertEquals(Optional.of(a1), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferBind(a0); Assert.assertTrue(ga.arrayBufferAnyIsBound()); Assert.assertTrue(ga.arrayBufferIsBound(a0)); Assert.assertEquals(Optional.of(a0), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferBind(a1); Assert.assertTrue(ga.arrayBufferAnyIsBound()); Assert.assertTrue(ga.arrayBufferIsBound(a1)); Assert.assertEquals(Optional.of(a1), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferUnbind(); Assert.assertEquals(Optional.empty(), ga.arrayBufferGetCurrentlyBound()); Assert.assertFalse(ga.arrayBufferGetCurrentlyBound().isPresent()); Assert.assertFalse(ga.arrayBufferAnyIsBound()); }
@Test public final void testArrayBindIdentities() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); Assert.assertFalse(ga.arrayBufferGetCurrentlyBound().isPresent()); Assert.assertFalse(ga.arrayBufferAnyIsBound()); final JCGLArrayBufferType a0 = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayBufferType a1 = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); Assert.assertTrue(ga.arrayBufferAnyIsBound()); Assert.assertTrue(ga.arrayBufferIsBound(a1)); Assert.assertEquals(Optional.of(a1), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferBind(a0); Assert.assertTrue(ga.arrayBufferAnyIsBound()); Assert.assertTrue(ga.arrayBufferIsBound(a0)); Assert.assertEquals(Optional.of(a0), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferBind(a1); Assert.assertTrue(ga.arrayBufferAnyIsBound()); Assert.assertTrue(ga.arrayBufferIsBound(a1)); Assert.assertEquals(Optional.of(a1), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferUnbind(); Assert.assertEquals(Optional.empty(), ga.arrayBufferGetCurrentlyBound()); Assert.assertFalse(ga.arrayBufferGetCurrentlyBound().isPresent()); Assert.assertFalse(ga.arrayBufferAnyIsBound()); }
@Test public final void testArrayDeleteNoUnbindOther() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayBufferType b = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); ga.arrayBufferBind(a); Assert.assertEquals(Optional.of(a), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferDelete(b); Assert.assertTrue(b.isDeleted()); Assert.assertFalse(a.isDeleted()); Assert.assertEquals(Optional.of(a), ga.arrayBufferGetCurrentlyBound()); }