Documentation
¶
Overview ¶
Package irtest provides a recording ir.Backend for tests.
It lets a test assert on what a geom or the renderer actually emitted — which primitives, in which order, with which style — instead of inspecting rendered pixels or scraped SVG. That keeps model-layer tests independent of any backend.
Index ¶
- type Call
- type Recorder
- func (r *Recorder) Count(op string) int
- func (r *Recorder) FillPath(p *ir.Path, fill ir.Fill, rule ir.FillRule)
- func (r *Recorder) Filter(op string) []Call
- func (r *Recorder) Flush() error
- func (r *Recorder) Image(img image.Image, dst ir.Rect)
- func (r *Recorder) Markers(shape ir.Marker, at []ir.Point, style ir.MarkerStyle)
- func (r *Recorder) Measure(run ir.TextRun) ir.TextMetrics
- func (r *Recorder) Ops() []string
- func (r *Recorder) Polyline(pts []ir.Point, style ir.Stroke)
- func (r *Recorder) Pop()
- func (r *Recorder) Push(clip *ir.Path, xform ir.Affine)
- func (r *Recorder) String() string
- func (r *Recorder) StrokePath(p *ir.Path, style ir.Stroke)
- func (r *Recorder) Text(run ir.TextRun)
- func (r *Recorder) Texts() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Call ¶
type Call struct {
Op string
Points []ir.Point
Path *ir.Path
Stroke ir.Stroke
Fill ir.Fill
Rule ir.FillRule
Text ir.TextRun
Marker ir.Marker
Style ir.MarkerStyle
Image image.Image
Rect ir.Rect
Affine ir.Affine
HasClip bool
ClipRect ir.Rect
}
Call is one recorded drawing operation.
type Recorder ¶
type Recorder struct {
Calls []Call
Depth int
// MaxDepth is the deepest the Push/Pop stack ever got, which is how a test
// checks that clipping was actually applied around the data layers.
MaxDepth int
}
Recorder is an ir.Backend that remembers every call.
It measures with the same built-in metrics table the SVG backend falls back to, so layout in a test behaves like layout in a real stdlib-only render.
Click to show internal directories.
Click to hide internal directories.