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.
Description
Section titled “Description”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.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| RenderBridgeContractSuite() | Creates the suite, for a subclass. |
Methods
Section titled “Methods”Colors
Section titled “Colors”| Returns | Signature | Summary |
|---|---|---|
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. |
Drawing
Section titled “Drawing”| Returns | Signature | Summary |
|---|---|---|
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. |
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. |
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. |
Actions
Section titled “Actions”| Returns | Signature | Summary |
|---|---|---|
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. |
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. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
ISnapshotBackend | createBackend() hook abstract protected | JOID calls it once, at the first test of the class. |
Creation details
Section titled “Creation details”RenderBridgeContractSuite
Section titled “RenderBridgeContractSuite”RenderBridgeContractSuite()
Creates the suite, for a subclass.
Method details
Section titled “Method details”drawsVertexColors
Section titled “drawsVertexColors”void drawsVertexColors()
Checks that a quad takes the colors of its vertices.
drawsWithTheCurrentColor
Section titled “drawsWithTheCurrentColor”void drawsWithTheCurrentColor()
Checks that a quad without vertex colors takes the color of the render state.
drawsEveryFrameBegunBeforeThePresent
Section titled “drawsEveryFrameBegunBeforeThePresent”void drawsEveryFrameBegunBeforeThePresent()
Checks that two beginFrame()/endFrame() pairs before one present both reach the target.
refusesToDrawOutsideAFrame
Section titled “refusesToDrawOutsideAFrame”void refusesToDrawOutsideAFrame()
Checks that draw, clearColor, clearDepth and raster throw an IllegalStateException outside a frame.
skipsTheDrawsOfAShaderThatFailsToCompile
Section titled “skipsTheDrawsOfAShaderThatFailsToCompile”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.
readsTheLightingOfEachDraw
Section titled “readsTheLightingOfEachDraw”void readsTheLightingOfEachDraw()
Checks that the uLighting built-in follows the render state at each draw.
appliesTheStencilStateOfEachDraw
Section titled “appliesTheStencilStateOfEachDraw”void appliesTheStencilStateOfEachDraw()
Checks that a draw writes the stencil and a later draw is masked by it.
drawsLinesOnePixelWide
Section titled “drawsLinesOnePixelWide”void drawsLinesOnePixelWide()
Checks that LINES are one pixel wide.
drawsAWideLineAsWideAsItsWidth
Section titled “drawsAWideLineAsWideAsItsWidth”void drawsAWideLineAsWideAsItsWidth()
Checks that a line of width 6 covers 6 pixels.
drawsAWideLineWithTheBoundShader
Section titled “drawsAWideLineWithTheBoundShader”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.
rastersADrawingUprightAtItsPixelSize
Section titled “rastersADrawingUprightAtItsPixelSize”void rastersADrawingUprightAtItsPixelSize()
Checks that DrawUtils.RASTER runs the drawing at the pixel size of its area, upright.
startBackend
Section titled “startBackend”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.
stopBackend
Section titled “stopBackend”void stopBackend() static
Destroys the snapshot backend after the last test of the class.
refusesATextureLargerThanTheBackend
Section titled “refusesATextureLargerThanTheBackend”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.
compilesCoreShaders
Section titled “compilesCoreShaders”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.
appliesEveryUniformType
Section titled “appliesEveryUniformType”void appliesEveryUniformType()
Checks the floats, vectors, integers, booleans, matrices and arrays of uniforms.
samplesTheTextureOfASampler
Section titled “samplesTheTextureOfASampler”void samplesTheTextureOfASampler()
Checks that a shader samples the texture set on its sampler.
litsAFaceTheSameAtAnyScale
Section titled “litsAFaceTheSameAtAnyScale”void litsAFaceTheSameAtAnyScale()
Checks that the lighting of a face does not change with the scale of the modelview.
disablesTheAlphaTestAtZero
Section titled “disablesTheAlphaTestAtZero”void disablesTheAlphaTestAtZero()
Checks that an alpha cutoff discards transparent fragments, and that a cutoff of 0F discards none.
cullsTheBackFacesLikeOpenGl
Section titled “cullsTheBackFacesLikeOpenGl”void cullsTheBackFacesLikeOpenGl()
Checks that culling removes the faces that OpenGL removes, on the window.
cullsTheBackFacesInFrameBuffersLikeOpenGl
Section titled “cullsTheBackFacesInFrameBuffersLikeOpenGl”void cullsTheBackFacesInFrameBuffersLikeOpenGl()
Checks that culling removes the same faces in a framebuffer.
exposesTheLineState
Section titled “exposesTheLineState”void exposesTheLineState()
Checks that the render state keeps the line width and the smooth flag.
joinsTheSegmentsOfAWideLine
Section titled “joinsTheSegmentsOfAWideLine”void joinsTheSegmentsOfAWideLine()
Checks that the segments of a wide line strip join without a gap at the corner.
uploadsArgbTextures
Section titled “uploadsArgbTextures”void uploadsArgbTextures()
Checks that an uploaded ARGB texture keeps its colors and its rows from the top.
minifiesThroughMipmaps
Section titled “minifiesThroughMipmaps”void minifiesThroughMipmaps()
Checks that a mipmapped texture, mipmapped before or after its upload, minifies to the average of its texels.
samplesATransparentBorderBeyondTheTexture
Section titled “samplesATransparentBorderBeyondTheTexture”void samplesATransparentBorderBeyondTheTexture()
Checks that CLAMP_TO_BORDER fades to transparent beyond the edges, native or emulated.
deletesTexturesTwice
Section titled “deletesTexturesTwice”void deletesTexturesTwice()
Checks that deleting a texture twice does not throw.
restoresTheStateOnPop
Section titled “restoresTheStateOnPop”void restoresTheStateOnPop()
Checks that popState() restores the framebuffer, the shader, the viewport and the lines.
rendersIntoFrameBuffers
Section titled “rendersIntoFrameBuffers”void rendersIntoFrameBuffers()
Checks that a framebuffer is cleared and drawn into, then sampled on the window.
hidesFarFacesBehindNearOnes
Section titled “hidesFarFacesBehindNearOnes”void hidesFarFacesBehindNearOnes()
Checks the depth test: a far quad drawn after a near one stays hidden.
clearsTheDepth
Section titled “clearsTheDepth”void clearsTheDepth()
Checks that clearDepth() lets a far quad draw again.
testsTheDepthInFrameBuffers
Section titled “testsTheDepthInFrameBuffers”void testsTheDepthInFrameBuffers()
Checks the depth test inside a framebuffer.
keepsTheFrameBufferDepthAcrossTargets
Section titled “keepsTheFrameBufferDepthAcrossTargets”void keepsTheFrameBufferDepthAcrossTargets()
Checks that the depth of a framebuffer survives a switch to the window and back.
followsTheOpenGlProjection
Section titled “followsTheOpenGlProjection”void followsTheOpenGlProjection()
Checks that the projection of screen puts (0, 0) at the top-left corner of the window.
resetsToAnOpaqueWhiteTexture
Section titled “resetsToAnOpaqueWhiteTexture”void resetsToAnOpaqueWhiteTexture()
Checks that a state without texture samples opaque white.
keepsTranslationsExact
Section titled “keepsTranslationsExact”void keepsTranslationsExact()
Checks that a translation after a scale reaches the pixel grid without rounding.
quantizesAMotionToWholePixels
Section titled “quantizesAMotionToWholePixels”void quantizesAMotionToWholePixels()
Checks that quantize lands a motion on whole screen pixels.
restoresTheMatrixAfterATransformation
Section titled “restoresTheMatrixAfterATransformation”void restoresTheMatrixAfterATransformation()
Checks that applying then removing a Transformation gives the modelview back exactly.
createBackend
Section titled “createBackend”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
