renderingtest

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: BSD-3-Clause Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package renderingtest is a temporary harness for the tests of the rendering library: it builds a RendererBinding on a fake engine, lays out and paints a render tree through the pipeline, and renders the scene with the software renderer. It stands in for gluttertest (step 7.5), which replaces it.

Flutter: no counterpart (test/rendering/rendering_tester.dart)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BundledTextEngine

func BundledTextEngine() *layout.Engine

BundledTextEngine is a text engine that has only the fonts bundled with Glutter, so that the text is laid out the same on every machine. The engine is made once per process, because registering the fonts is slow.

func NewTextEngine

func NewTextEngine(extra ...Font) (*layout.Engine, error)

NewTextEngine makes a text engine of its own, with the bundled fonts and the given ones and no system font, for a test that must not change the shared engine of BundledTextEngine. It fails with the tags of text.Collection.AddFont.

Types

type Font

type Font struct {
	Family string
	Data   []byte
}

Font is a font for NewTextEngine: the bytes of a TrueType or OpenType file under a family name (the name inside the font when Family is empty).

type Harness

type Harness struct {
	*renderhost.Stack
	// TextEngine is the engine that lays out the text.
	TextEngine ui.ParagraphFactory
	// Errors collects the errors that the binding reported.
	Errors []error
}

Harness is a rendering binding on a fake engine, with one view.

func New

func New(t *testing.T, opts ...Opts) *Harness

New creates the harness with the render view attached to the binding's root pipeline owner, ready for SetRoot.

func (*Harness) Image

func (h *Harness) Image() (*image.RGBA, error)

Image renders the last scene with the software renderer.

func (*Harness) Pump

func (h *Harness) Pump()

Pump runs one frame: layout, compositing bits, paint and composite.

type Host

type Host = renderhost.Host

Host is the fake engine.

type Opts

type Opts struct {
	// Size is the size of the view in physical pixels; the default is 800x600.
	Size ui.Size
	// DevicePixelRatio defaults to 1.
	DevicePixelRatio float64
	// Debug are the debug flags; the default is a fresh set.
	Debug *rendering.DebugOptions
	// TextEngine lays out the text; the default is BundledTextEngine().
	TextEngine ui.ParagraphFactory
	// CollectPanics makes the harness collect the panics that layout and paint
	// recover in Errors. By default it panics again with them, so that a test
	// that does not expect one fails where it happens.
	CollectPanics bool
}

Opts are the optional parameters of New.

Jump to

Keyboard shortcuts

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