Documentation
¶
Overview ¶
Package canvastest holds drawings that exercise a canvas player, and what their pixels must show, so each backend's tests check their player the same way: they draw each Sample on white at twice its points and run its probes.
Index ¶
Constants ¶
const Scale = 2
Scale is the pixels a point the samples are drawn at.
Variables ¶
This section is empty.
Functions ¶
func CacheSources ¶ added in v0.2.0
func CacheSources(n int) []driver.ImageSource
CacheSources returns distinct, tiny red images for cache-pressure tests. Their data stays owned by the caller, so address-based source keys stay unique.
func Differ ¶
Differ counts the pixels of a and b that differ by more than anti-aliasing may, and returns the first.
Types ¶
type Probe ¶
Probe is a point, or a rectangle when W and H are set, in points, and what its pixel must be: some pixel of the rectangle, or all of them with All.
type Sample ¶
type Sample struct {
Name string
Width, Height int // points
Drawing *driver.Drawing
Probes []Probe
}
Sample is a drawing and the pixels it must make.
func Samples ¶
func Samples(text driver.TextEngine, logo []byte) []*Sample
Samples returns the drawings, recorded with the platform's text engine as a canvas's are, logo being an image the last one draws.
func Split ¶
func Split(text driver.TextEngine) []*Sample
Split returns drawings whose static part (driver.CanvasSplit) is long, each with a bound argument: a chart's area, line and bars under a clip and a shadow, then a ring, which keeps the path it builds, and a bar filled with the path the static part left. A backend that keeps a static part checks that playing the ops after it over the part's pixels draws what a full replay does.