Documentation
¶
Overview ¶
package rendertest implements testing helpers that are useful for projects that are using the 'render' package.
Index ¶
- func AdvanceTimeMillis(sys system.System, delta uint64)
- func AssertOffRenderThread(t *testing.T)
- func AssertOnRenderThread(*testing.T)
- func BlankAndDrawRect(x1, y1, x2, y2 float64)
- func BlankAndDrawRectNdc(x1, y1, x2, y2 float64)
- func ClearScreen()
- func CompareWithThreshold(lhs, rhs []byte, threshold Threshold) int
- func ComputeImageDifference(lhs, rhs []byte) []byte
- func DrawRect(x1, y1, x2, y2 float64)
- func DrawRectNdc(x1, y1, x2, y2 float64)
- func DrawTexturedQuad(pixelBounds image.Rectangle, tex gl.Texture, shaders *render.ShaderBank)
- func ExpectationFile(testDataKey TestDataReference, fileExt FileExtension, testnumber TestNumber) string
- func Failfastqueue(ctx *glContext) render.RenderQueueInterface
- func GivenABufferWithData(data []float32) gl.Buffer
- func GivenATexture(imageFilePath string) (gl.Texture, func())
- func ImagesAreWithinThreshold(actual, expected image.Image, thresh Threshold, backgroundColour color.Color) bool
- func MakePanicingRenderQueue() render.RenderQueueInterface
- func MakeRejectName(exp, suffix string) string
- func MakeStubbedRenderQueue() render.RenderQueueInterface
- func MustLoadImage(imageFilePath string) image.Image
- func MustLoadImageFromReader(file io.Reader) image.Image
- func MustLoadImageNRGBA(imageFilePath string) *image.NRGBA
- func MustLoadTestImage(testdataref TestDataReference) image.Image
- func MustLookLikeFile(t *testing.T, actual any, expected ...any)
- func RunTestWithCachedContext(width, height int, ...)
- func ShouldLookLike(actual interface{}, expected ...interface{}) string
- func ShouldLookLikeFile(actual interface{}, expected ...interface{}) string
- func ShouldLookLikeText(actual interface{}, expected ...interface{}) string
- func ShouldNotLookLikeFile(actual interface{}, expected ...interface{}) string
- func StubShaderBank(shaderNames ...string) *render.ShaderBank
- func WithShaderProgs(shaders *render.ShaderBank, vertShader string, fragShader string, fn func())
- type BackgroundColour
- type DebugDumpFilePath
- type FileExtension
- type MakeRejectFiles
- type PanicQueueShouldNotBeCalledError
- type TestDataReference
- type TestNumber
- type Threshold
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdvanceTimeMillis ¶
func AssertOffRenderThread ¶
func AssertOnRenderThread ¶
func BlankAndDrawRect ¶
func BlankAndDrawRect(x1, y1, x2, y2 float64)
func BlankAndDrawRectNdc ¶
func BlankAndDrawRectNdc(x1, y1, x2, y2 float64)
func ClearScreen ¶
func ClearScreen()
func CompareWithThreshold ¶
func ComputeImageDifference ¶
func DrawRectNdc ¶
func DrawRectNdc(x1, y1, x2, y2 float64)
func DrawTexturedQuad ¶
func ExpectationFile ¶
func ExpectationFile(testDataKey TestDataReference, fileExt FileExtension, testnumber TestNumber) string
func Failfastqueue ¶
func Failfastqueue(ctx *glContext) render.RenderQueueInterface
func GivenABufferWithData ¶
func GivenATexture ¶
func MakePanicingRenderQueue ¶
func MakePanicingRenderQueue() render.RenderQueueInterface
func MakeRejectName ¶
Return the given file but with a '.rej' component to signify a 'rejection'.
func MakeStubbedRenderQueue ¶
func MakeStubbedRenderQueue() render.RenderQueueInterface
func MustLoadImage ¶
func MustLoadImageNRGBA ¶
func MustLoadTestImage ¶
func MustLoadTestImage(testdataref TestDataReference) image.Image
func MustLookLikeFile ¶
Usage is
'MustLookLikeFile(t, something, options...)'
'options' is an optional bag of control parameters
func RunTestWithCachedContext ¶
func RunTestWithCachedContext(width, height int, fn func(system.System, system.NativeWindowHandle, render.RenderQueueInterface))
func ShouldLookLike ¶
func ShouldLookLike(actual interface{}, expected ...interface{}) string
func ShouldLookLikeFile ¶
func ShouldLookLikeFile(actual interface{}, expected ...interface{}) string
Usage is
'So(something, ShouldLookLikeFile, "test-case-family", options...)'
'options' is an optional bag of control parameters
func ShouldLookLikeText ¶
func ShouldLookLikeText(actual interface{}, expected ...interface{}) string
func ShouldNotLookLikeFile ¶
func ShouldNotLookLikeFile(actual interface{}, expected ...interface{}) string
func StubShaderBank ¶
func StubShaderBank(shaderNames ...string) *render.ShaderBank
func WithShaderProgs ¶
func WithShaderProgs(shaders *render.ShaderBank, vertShader string, fragShader string, fn func())
Types ¶
type BackgroundColour ¶
var DefaultBackground BackgroundColour = color.RGBA{
R: 0,
G: 0,
B: 0,
A: 255,
}
DefaultBackground is an opaque black
type DebugDumpFilePath ¶
type DebugDumpFilePath string
type FileExtension ¶
type FileExtension string
type MakeRejectFiles ¶
type MakeRejectFiles bool
type PanicQueueShouldNotBeCalledError ¶
type PanicQueueShouldNotBeCalledError struct{}
func (*PanicQueueShouldNotBeCalledError) Error ¶
func (*PanicQueueShouldNotBeCalledError) Error() string
type TestDataReference ¶
type TestDataReference string
func NewTestdataReference ¶
func NewTestdataReference(datakey string) TestDataReference
func (*TestDataReference) MustValidate ¶
func (ref *TestDataReference) MustValidate()
func (*TestDataReference) Path ¶
func (ref *TestDataReference) Path(args ...interface{}) string
func (*TestDataReference) PathExtension ¶
func (ref *TestDataReference) PathExtension(ext string) string
func (*TestDataReference) PathNumber ¶
func (ref *TestDataReference) PathNumber(n int) string
func (*TestDataReference) Validate ¶
func (ref *TestDataReference) Validate() bool
type TestNumber ¶
type TestNumber uint8
Source Files
¶
Click to show internal directories.
Click to hide internal directories.