Skip to content

RenderBridgeContractSuite

abstract class RenderBridgeContractSuite
Package: dev.joid.test.contract · Module: tool-testkit · Source: RenderBridgeContractSuite.java

The contract tests of a render bridge, run on your snapshot backend in a few seconds.

Extend it in the tests of your backend and return your snapshot backend from createBackend(); every test then runs on your render bridge. Each test name states the rule it checks; the rules are those of the render contract.

ReturnsSignatureSummary
RenderBridgeContractSuite()Creates the suite, for a subclass.

ReturnsSignatureSummary
voiddrawsVertexColors()Checks that a quad takes the colors of its vertices.
voiddrawsWithTheCurrentColor()Checks that a quad without vertex colors takes the color of the render state.
ReturnsSignatureSummary
voiddrawsEveryFrameBegunBeforeThePresent()Checks that two beginFrame()/endFrame() pairs before one present both reach the target.
voidrefusesToDrawOutsideAFrame()Checks that draw, clearColor, clearDepth and raster throw an IllegalStateException outside a frame.
voidskipsTheDrawsOfAShaderThatFailsToCompile()Checks that a shader that does not compile reports isActive() == false, prints one [JOID] warning that names the compilation, and draws nothing while the next draws go on.
voidsamplesEveryTextureOfTheFirstDrawOfABackend()Checks that the first draw of a backend binds a texture on every sampler, the 1×1 white texture on those without one.
voidreadsTheLightingOfEachDraw()Checks that the uLighting built-in follows the render state at each draw.
voidappliesTheStencilStateOfEachDraw()Checks that a draw writes the stencil and a later draw is masked by it.
voiddrawsLinesOnePixelWide()Checks that LINES are one pixel wide.
voiddrawsAWideLineAsWideAsItsWidth()Checks that a line of width 6 covers 6 pixels.
voiddrawsAWideLineWithTheBoundShader()Checks that a wide line draws with the shader bound by the application, through its line variant.
voiddrawsTheScreenAfterAFrameBufferDeletedDuringItsPass()Checks that the window still draws after a framebuffer is deleted in the middle of its own pass.
voidrastersADrawingUprightAtItsPixelSize()Checks that DrawUtils.RASTER runs the drawing at the pixel size of its area, upright.
ReturnsSignatureSummary
voidstartBackend()Creates the snapshot backend at the first test of the class, at 64×64 pixels, and resets the matrices and the state before each test.
voidstopBackend() staticDestroys the snapshot backend after the last test of the class.
voidrefusesATextureLargerThanTheBackend()Checks that allocating a texture larger than the API allows throws an IllegalArgumentException that starts with A texture of 1048576x1 exceeds the maximum size.
voidcompilesCoreShaders()Checks that every built-in shader of JOID compiles.
voidappliesTheUniformsSetBeforeTheShaderIsBound()Checks that a uniform set before bind() reaches the draw.
voidappliesEveryUniformType()Checks the floats, vectors, integers, booleans, matrices and arrays of uniforms.
voidsamplesTheTextureOfASampler()Checks that a shader samples the texture set on its sampler.
voidlitsAFaceTheSameAtAnyScale()Checks that the lighting of a face does not change with the scale of the modelview.
voiddisablesTheAlphaTestAtZero()Checks that an alpha cutoff discards transparent fragments, and that a cutoff of 0F discards none.
voidcullsTheBackFacesLikeOpenGl()Checks that culling removes the faces that OpenGL removes, on the window.
voidcullsTheBackFacesInFrameBuffersLikeOpenGl()Checks that culling removes the same faces in a framebuffer.
voidexposesTheLineState()Checks that the render state keeps the line width and the smooth flag.
voidjoinsTheSegmentsOfAWideLine()Checks that the segments of a wide line strip join without a gap at the corner.
voiduploadsArgbTextures()Checks that an uploaded ARGB texture keeps its colors and its rows from the top.
voidminifiesThroughMipmaps()Checks that a mipmapped texture, mipmapped before or after its upload, minifies to the average of its texels.
voidsamplesATransparentBorderBeyondTheTexture()Checks that CLAMP_TO_BORDER fades to transparent beyond the edges, native or emulated.
voiddeletesTexturesTwice()Checks that deleting a texture twice does not throw.
voidrestoresTheStateOnPop()Checks that popState() restores the framebuffer, the shader, the viewport and the lines.
voidrendersIntoFrameBuffers()Checks that a framebuffer is cleared and drawn into, then sampled on the window.
voidhidesFarFacesBehindNearOnes()Checks the depth test: a far quad drawn after a near one stays hidden.
voidclearsTheDepth()Checks that clearDepth() lets a far quad draw again.
voidtestsTheDepthInFrameBuffers()Checks the depth test inside a framebuffer.
voidkeepsTheFrameBufferDepthAcrossTargets()Checks that the depth of a framebuffer survives a switch to the window and back.
voidfollowsTheOpenGlProjection()Checks that the projection of screen puts (0, 0) at the top-left corner of the window.
voidresetsToAnOpaqueWhiteTexture()Checks that a state without texture samples opaque white.
voidkeepsTranslationsExact()Checks that a translation after a scale reaches the pixel grid without rounding.
voidquantizesAMotionToWholePixels()Checks that quantize lands a motion on whole screen pixels.
voidrestoresTheMatrixAfterATransformation()Checks that applying then removing a Transformation gives the modelview back exactly.
ReturnsSignatureSummary
ISnapshotBackendcreateBackend() hook abstract protectedJOID calls it once, at the first test of the class.

RenderBridgeContractSuite()

Creates the suite, for a subclass.

void drawsVertexColors()

Checks that a quad takes the colors of its vertices.

void drawsWithTheCurrentColor()

Checks that a quad without vertex colors takes the color of the render state.

void drawsEveryFrameBegunBeforeThePresent()

Checks that two beginFrame()/endFrame() pairs before one present both reach the target.

void refusesToDrawOutsideAFrame()

Checks that draw, clearColor, clearDepth and raster throw an IllegalStateException outside a frame.

void skipsTheDrawsOfAShaderThatFailsToCompile()

Checks that a shader that does not compile reports isActive() == false, prints one [JOID] warning that names the compilation, and draws nothing while the next draws go on.

samplesEveryTextureOfTheFirstDrawOfABackend

Section titled “samplesEveryTextureOfTheFirstDrawOfABackend”

void samplesEveryTextureOfTheFirstDrawOfABackend()

Checks that the first draw of a backend binds a texture on every sampler, the 1×1 white texture on those without one.

void readsTheLightingOfEachDraw()

Checks that the uLighting built-in follows the render state at each draw.

void appliesTheStencilStateOfEachDraw()

Checks that a draw writes the stencil and a later draw is masked by it.

void drawsLinesOnePixelWide()

Checks that LINES are one pixel wide.

void drawsAWideLineAsWideAsItsWidth()

Checks that a line of width 6 covers 6 pixels.

void drawsAWideLineWithTheBoundShader()

Checks that a wide line draws with the shader bound by the application, through its line variant.

drawsTheScreenAfterAFrameBufferDeletedDuringItsPass

Section titled “drawsTheScreenAfterAFrameBufferDeletedDuringItsPass”

void drawsTheScreenAfterAFrameBufferDeletedDuringItsPass()

Checks that the window still draws after a framebuffer is deleted in the middle of its own pass.

void rastersADrawingUprightAtItsPixelSize()

Checks that DrawUtils.RASTER runs the drawing at the pixel size of its area, upright.

void startBackend()

Creates the snapshot backend at the first test of the class, at 64×64 pixels, and resets the matrices and the state before each test.

void stopBackend() static

Destroys the snapshot backend after the last test of the class.

void refusesATextureLargerThanTheBackend()

Checks that allocating a texture larger than the API allows throws an IllegalArgumentException that starts with A texture of 1048576x1 exceeds the maximum size.

void compilesCoreShaders()

Checks that every built-in shader of JOID compiles.

appliesTheUniformsSetBeforeTheShaderIsBound

Section titled “appliesTheUniformsSetBeforeTheShaderIsBound”

void appliesTheUniformsSetBeforeTheShaderIsBound()

Checks that a uniform set before bind() reaches the draw.

void appliesEveryUniformType()

Checks the floats, vectors, integers, booleans, matrices and arrays of uniforms.

void samplesTheTextureOfASampler()

Checks that a shader samples the texture set on its sampler.

void litsAFaceTheSameAtAnyScale()

Checks that the lighting of a face does not change with the scale of the modelview.

void disablesTheAlphaTestAtZero()

Checks that an alpha cutoff discards transparent fragments, and that a cutoff of 0F discards none.

void cullsTheBackFacesLikeOpenGl()

Checks that culling removes the faces that OpenGL removes, on the window.

void cullsTheBackFacesInFrameBuffersLikeOpenGl()

Checks that culling removes the same faces in a framebuffer.

void exposesTheLineState()

Checks that the render state keeps the line width and the smooth flag.

void joinsTheSegmentsOfAWideLine()

Checks that the segments of a wide line strip join without a gap at the corner.

void uploadsArgbTextures()

Checks that an uploaded ARGB texture keeps its colors and its rows from the top.

void minifiesThroughMipmaps()

Checks that a mipmapped texture, mipmapped before or after its upload, minifies to the average of its texels.

void samplesATransparentBorderBeyondTheTexture()

Checks that CLAMP_TO_BORDER fades to transparent beyond the edges, native or emulated.

void deletesTexturesTwice()

Checks that deleting a texture twice does not throw.

void restoresTheStateOnPop()

Checks that popState() restores the framebuffer, the shader, the viewport and the lines.

void rendersIntoFrameBuffers()

Checks that a framebuffer is cleared and drawn into, then sampled on the window.

void hidesFarFacesBehindNearOnes()

Checks the depth test: a far quad drawn after a near one stays hidden.

void clearsTheDepth()

Checks that clearDepth() lets a far quad draw again.

void testsTheDepthInFrameBuffers()

Checks the depth test inside a framebuffer.

void keepsTheFrameBufferDepthAcrossTargets()

Checks that the depth of a framebuffer survives a switch to the window and back.

void followsTheOpenGlProjection()

Checks that the projection of screen puts (0, 0) at the top-left corner of the window.

void resetsToAnOpaqueWhiteTexture()

Checks that a state without texture samples opaque white.

void keepsTranslationsExact()

Checks that a translation after a scale reaches the pixel grid without rounding.

void quantizesAMotionToWholePixels()

Checks that quantize lands a motion on whole screen pixels.

void restoresTheMatrixAfterATransformation()

Checks that applying then removing a Transformation gives the modelview back exactly.

ISnapshotBackend createBackend() hook abstract protected

JOID calls it once, at the first test of the class. Return a new snapshot backend of your backend, not created yet.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page