rendertest

package
v0.0.0-...-1b8b794 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2025 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Overview

package rendertest implements testing helpers that are useful for projects that are using the 'render' package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdvanceTimeMillis

func AdvanceTimeMillis(sys system.System, delta uint64)

func AssertOffRenderThread

func AssertOffRenderThread(t *testing.T)

func AssertOnRenderThread

func AssertOnRenderThread(*testing.T)

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 CompareWithThreshold(lhs, rhs []byte, threshold Threshold) int

func ComputeImageDifference

func ComputeImageDifference(lhs, rhs []byte) []byte

func DrawRect

func DrawRect(x1, y1, x2, y2 float64)

func DrawRectNdc

func DrawRectNdc(x1, y1, x2, y2 float64)

func DrawTexturedQuad

func DrawTexturedQuad(pixelBounds image.Rectangle, tex gl.Texture, shaders *render.ShaderBank)

func ExpectationFile

func ExpectationFile(testDataKey TestDataReference, fileExt FileExtension, testnumber TestNumber) string

func Failfastqueue

func Failfastqueue(ctx *glContext) render.RenderQueueInterface

func GivenABufferWithData

func GivenABufferWithData(data []float32) gl.Buffer

func GivenATexture

func GivenATexture(imageFilePath string) (gl.Texture, func())

func ImagesAreWithinThreshold

func ImagesAreWithinThreshold(actual, expected image.Image, thresh Threshold, backgroundColour color.Color) bool

func MakePanicingRenderQueue

func MakePanicingRenderQueue() render.RenderQueueInterface

func MakeRejectName

func MakeRejectName(exp, suffix string) string

Return the given file but with a '.rej' component to signify a 'rejection'.

func MakeStubbedRenderQueue

func MakeStubbedRenderQueue() render.RenderQueueInterface

func MustLoadImage

func MustLoadImage(imageFilePath string) image.Image

func MustLoadImageFromReader

func MustLoadImageFromReader(file io.Reader) image.Image

func MustLoadImageNRGBA

func MustLoadImageNRGBA(imageFilePath string) *image.NRGBA

func MustLoadTestImage

func MustLoadTestImage(testdataref TestDataReference) image.Image

func MustLookLikeFile

func MustLookLikeFile(t *testing.T, actual any, expected ...any)

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

type BackgroundColour color.Color
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

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

type Threshold

type Threshold uint8

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL