diff --git a/a11ydisabled_audit_test.go b/a11ydisabled_audit_test.go index 4fb8770..288725e 100644 --- a/a11ydisabled_audit_test.go +++ b/a11ydisabled_audit_test.go @@ -749,7 +749,7 @@ var disabledA11yExempt = exemptions(map[string][]string{ "ContrastBadge", "Diff", "Gauge", "GroupCard", "Image", "Kbd", "Label", "LevelBar", "LineChart", "LinkCard", "LoadMask", "MarkdownView", "MediaCard", "Notification", "PieChart", "PostCard", "ProgressBar", "ProgressCircle", "RadarChart", "SelectionBox", - "ScatterChart", "SegmentedBar", "Sparkline", "Spinner", "Stat", "TimeSeriesChart", "Timeline", + "ScatterChart", "SegmentedBar", "Sparkline", "Spinner", "Stat", "StackedBarChart", "TimeSeriesChart", "Timeline", "Tooltip", "XYPlot", }, exemptLayout: { diff --git a/graphview.go b/graphview.go index 3eacf73..7a6980c 100644 --- a/graphview.go +++ b/graphview.go @@ -200,17 +200,25 @@ func (g *GraphView) strokeBox(p painter.Painter, r Rect, radius int, c RGBA) { // nodeW is the width of a node box. func (g *GraphView) nodeW() int { if g.NodeWidth > 0 { - return g.NodeWidth + return scaled(g.NodeWidth) } - return graphNodeW + return scaled(graphNodeW) } +// The layout metrics, scaled by the global metric scale ([SetMetricScale]) so a +// graph drawn on a HiDPI surface grows with its text. +func gGap() int { return scaled(graphGap) } +func gNodeH() int { return scaled(graphNodeH) } +func gTitleH() int { return scaled(graphTitleH) } + // layout places clusters on a grid filling the bounds and nodes on a sub-grid // inside each cluster. Deterministic: the same lists and bounds give the // same boxes. func (g *GraphView) layout() { g.bind() nw := g.nodeW() + // A change of node width (NodeWidth set late, or the metric scale changed) + // lays out again; an edge update never does. if g.layoutValid && g.laidNodeW == nw { return } @@ -243,7 +251,7 @@ func (g *GraphView) layout() { // what is left of the width. // A cluster is at least as wide as its title, so a long label never // spills over the next cluster. - titleW := func(c GraphCluster) int { return g.textWidth(c.Label) + 2*graphGap } + titleW := func(c GraphCluster) int { return g.textWidth(c.Label) + 2*gGap() } boxes, perRows, h := flowClusters(clusters, members, area.W, nw, titleW) if h > area.H { g.hasBar = true @@ -257,8 +265,8 @@ func (g *GraphView) layout() { g.clusterBox[c.ID] = box for j, n := range members[c.ID] { nc, nr := j%perRows[i], j/perRows[i] - g.nodeBox[n.ID] = Rect{X: box.X + graphGap + nc*(nw+graphGap), - Y: box.Y + graphTitleH + graphGap + nr*(graphNodeH+graphGap), W: nw, H: graphNodeH} + g.nodeBox[n.ID] = Rect{X: box.X + gGap() + nc*(nw+gGap()), + Y: box.Y + gTitleH() + gGap() + nr*(gNodeH()+gGap()), W: nw, H: gNodeH()} g.order = append(g.order, n.ID) } } @@ -269,26 +277,27 @@ func (g *GraphView) layout() { // the boxes relative to the content origin, each cluster's nodes per row, and // the content height. func flowClusters(clusters []GraphCluster, members map[string][]GraphNode, width, nodeW int, titleW func(GraphCluster) int) (boxes []Rect, perRows []int, height int) { - x, y, rowH := graphGap, graphGap, 0 + gap := gGap() + x, y, rowH := gap, gap, 0 for _, c := range clusters { n := maxInt(1, len(members[c.ID])) perRow := int(math.Ceil(math.Sqrt(float64(n)))) rowsIn := (n + perRow - 1) / perRow - cw := maxInt(perRow*(nodeW+graphGap)+graphGap, titleW(c)) - ch := graphTitleH + rowsIn*(graphNodeH+graphGap) + graphGap - if x > graphGap && x+cw+graphGap > width { - x, y, rowH = graphGap, y+rowH+graphGap, 0 + cw := maxInt(perRow*(nodeW+gap)+gap, titleW(c)) + ch := gTitleH() + rowsIn*(gNodeH()+gap) + gap + if x > gap && x+cw+gap > width { + x, y, rowH = gap, y+rowH+gap, 0 } boxes = append(boxes, Rect{X: x, Y: y, W: cw, H: ch}) perRows = append(perRows, perRow) - x += cw + graphGap + x += cw + gap rowH = maxInt(rowH, ch) } - return boxes, perRows, y + rowH + graphGap + return boxes, perRows, y + rowH + gap } // graphScrollStep is the pixels one wheel row moves the content. -const graphScrollStep = graphNodeH + graphGap +func graphScrollStep() int { return gNodeH() + gGap() } // graphThumbMin is the smallest scrollbar thumb, in pixels. const graphThumbMin = 12 @@ -343,9 +352,9 @@ func (g *GraphView) revealNode(id string) { top := g.Bounds().Y switch { case b.Y < top: - g.ScrollBy(b.Y - top - graphGap) + g.ScrollBy(b.Y - top - gGap()) case b.Y+b.H > top+g.viewH: - g.ScrollBy(b.Y + b.H - (top + g.viewH) + graphGap) + g.ScrollBy(b.Y + b.H - (top + g.viewH) + gGap()) } } @@ -431,7 +440,7 @@ func (g *GraphView) Draw(p painter.Painter, theme *Theme) { for id, box := range g.clusterBox { g.fillBox(p, box, g.clusterRadius(), theme.Surface) g.strokeBox(p, box, g.clusterRadius(), theme.Border) - g.drawText(p, box.X+graphGap, box.Y+2, labels[id], theme.OnSurface) + g.drawText(p, box.X+gGap(), box.Y+scaled(2), labels[id], theme.OnSurface) } nodes := g.Model.Nodes.Slice() for _, n := range nodes { @@ -609,7 +618,7 @@ func (g *GraphView) drawLegend(p painter.Painter, theme *Theme) { top := r.Y + r.H - h + graphLegendPad ty := top + (line-g.glyphHeight())/2 // text sy := top + (line-graphSwatch)/2 // swatch - x := r.X + graphGap + x := r.X + gGap() names := make([]string, len(g.categories)) for cat, i := range g.categories { names[i] = cat @@ -675,7 +684,7 @@ func (g *GraphView) OnEvent(ev Event) { r := g.Bounds() switch ev.Kind { case EventScroll: - g.ScrollBy(ev.Delta * graphScrollStep) + g.ScrollBy(ev.Delta * graphScrollStep()) case EventMouseDrag: sg, ok := g.scrollbarGeom() g.sbDrag.drag(sg, ok, ev, g.ScrollTo) diff --git a/graphview_scale_test.go b/graphview_scale_test.go new file mode 100644 index 0000000..d714b62 --- /dev/null +++ b/graphview_scale_test.go @@ -0,0 +1,40 @@ +// Copyright (c) 2026 the go-widgets/toolkit authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause license that can be +// found in the LICENSE file at the root of this repository. + +package toolkit + +import "testing" + +// A graph drawn on a HiDPI surface grows with the metric scale: nodes, gaps and +// the scroll step double at scale 2, and more clusters fit per row as the width +// grows (the layout is a flow). +func TestGraphViewHonoursTheMetricScale(t *testing.T) { + defer SetMetricScale(MetricScale()) + laid := func(scale float64, w int) (*GraphView, Rect) { + SetMetricScale(scale) + g := NewGraphView(manyClusters(6, 4)) + g.SetBounds(Rect{W: w, H: 2000}) + g.layout() + return g, g.nodeBox["n0_0"] + } + _, one := laid(1, 800) + g2, two := laid(2, 1600) + if two.W != 2*one.W || two.H != 2*one.H { + t.Fatalf("node %v at scale 2 is not twice %v", two, one) + } + if got, want := graphScrollStep(), 2*(graphNodeH+graphGap); got != want { + t.Fatalf("scroll step %d, want %d", got, want) + } + if g2.clusterBox["c1"].Y != g2.clusterBox["c0"].Y { + t.Fatal("two clusters should share a row at this width") + } + narrow, _ := laid(2, 400) + if narrow.clusterBox["c1"].Y == narrow.clusterBox["c0"].Y { + t.Fatal("a narrow surface should wrap clusters onto more rows") + } + wide, _ := laid(2, 3000) + if wide.clusterBox["c5"].Y != wide.clusterBox["c0"].Y { + t.Fatal("a wide surface should hold more cluster columns") + } +} diff --git a/graphview_scroll_test.go b/graphview_scroll_test.go index 7a28104..8fce9a4 100644 --- a/graphview_scroll_test.go +++ b/graphview_scroll_test.go @@ -80,7 +80,7 @@ func TestGraphViewScrollsWhenItOverflows(t *testing.T) { } // The wheel moves it, in rows. g.OnEvent(Event{Kind: EventScroll, Delta: 3}) - if g.ScrollY() != 3*graphScrollStep { + if g.ScrollY() != 3*graphScrollStep() { t.Fatalf("wheel: scroll %d", g.ScrollY()) } // Scrolling past the end clamps, and then the last node is reachable. diff --git a/stackedbarchart.go b/stackedbarchart.go new file mode 100644 index 0000000..29aacf5 --- /dev/null +++ b/stackedbarchart.go @@ -0,0 +1,181 @@ +// Copyright (c) 2026 the go-widgets/toolkit authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause license that can be +// found in the LICENSE file at the root of this repository. + +package toolkit + +import ( + "fmt" + "time" + + "github.com/go-widgets/painter" +) + +// StackedBarChart plots a quantity over time as one bar per time bucket, each +// bar made of stacked layers (a token count split by model, a request count by +// status). It is the labelled, stacked companion to BarChart: a legend names +// every layer, the value axis shows 0, the middle and the top, and the time axis +// shows the first and last instant of TimeMin..TimeMax. +// +// Layers[l][b] is layer l's value in bucket b; buckets are equal slices of the +// time span, oldest on the left. Negative values count as zero. Display-only. +type StackedBarChart struct { + Base + Layers [][]float64 + // Names label the layers in the legend, in Layers order; a layer without a + // name is left out of the legend. + Names []string + // Colors overrides the categorical palette, cycled by layer index. + Colors []RGBA + // TimeMin, TimeMax are the instants (Unix seconds) the first bucket starts + // at and the last ends at. Zero values draw no time labels. + TimeMin, TimeMax int64 + // Max is the top of the value axis; when <= 0 it is [NiceCeiling] of the + // tallest stack. + Max float64 + // FormatValue renders one value-axis label; nil uses "%.0f". + FormatValue func(float64) string + // FormatTime renders one time-axis label; nil uses "Jan 2 15:04". + FormatTime func(int64) string +} + +// NewStackedBarChart builds a StackedBarChart over the given layers. +func NewStackedBarChart(layers [][]float64, names []string) *StackedBarChart { + return &StackedBarChart{Layers: layers, Names: names} +} + +func (c *StackedBarChart) layerColor(i int) RGBA { + if len(c.Colors) > 0 { + return c.Colors[i%len(c.Colors)] + } + return piePalette[i%len(piePalette)] +} + +// buckets is the number of bars: the longest layer. +func (c *StackedBarChart) buckets() int { + n := 0 + for _, l := range c.Layers { + n = max(n, len(l)) + } + return n +} + +// top is the value axis maximum. +func (c *StackedBarChart) top() float64 { + if c.Max > 0 { + return c.Max + } + most := 0.0 + for b := 0; b < c.buckets(); b++ { + most = max(most, c.stackTotal(b)) + } + return NiceCeiling(most) +} + +// stackTotal is the height of bucket b's whole stack. +func (c *StackedBarChart) stackTotal(b int) float64 { + sum := 0.0 + for _, l := range c.Layers { + if b < len(l) && l[b] > 0 { + sum += l[b] + } + } + return sum +} + +func (c *StackedBarChart) formatValue(v float64) string { + if c.FormatValue != nil { + return c.FormatValue(v) + } + return fmt.Sprintf("%.0f", v) +} + +func (c *StackedBarChart) formatTime(at int64) string { + if c.FormatTime != nil { + return c.FormatTime(at) + } + return time.Unix(at, 0).Format("Jan 2 15:04") +} + +// legendHeight is the legend strip's height: one text line plus padding. +func (c *StackedBarChart) legendHeight() int { + return c.glyphHeight() + 2*scaled(TimeSeriesChartPad) +} + +// plot is the bar area, inside the legend, the value labels and the time labels. +func (c *StackedBarChart) plot() Rect { + r := c.Bounds() + yAxisW := 0 + for _, v := range [3]float64{0, c.top() / 2, c.top()} { + yAxisW = max(yAxisW, c.textWidth(c.formatValue(v))) + } + yAxisW += scaled(TimeSeriesChartPad) + top := c.legendHeight() + return Rect{X: r.X + yAxisW, Y: r.Y + top, W: r.W - yAxisW, + H: r.H - top - c.glyphHeight() - scaled(TimeSeriesChartPad)} +} + +// Draw paints the legend, the gridlines with their value labels, the stacked +// bars, and the time labels. +func (c *StackedBarChart) Draw(p painter.Painter, theme *Theme) { + r := c.Bounds() + pl := c.plot() + if r.W <= 0 || r.H <= 0 || pl.W <= 0 || pl.H <= 0 { + return + } + label := dimInk(theme) + gh := c.glyphHeight() + pad := scaled(TimeSeriesChartPad) + + x := r.X + pad + for i, name := range c.Names { + if name == "" { + continue + } + fillRect(p, x, r.Y+pad, gh, gh, c.layerColor(i)) + c.drawText(p, x+gh+pad, r.Y+pad, name, theme.OnSurface) + x += gh + 2*pad + c.textWidth(name) + 2*pad + } + + top := c.top() + for _, frac := range [3]float64{0, 0.5, 1} { + y := pl.Y + int((1-frac)*float64(pl.H-1)) + drawLine(p, pl.X, y, pl.X+pl.W-1, y, theme.Border) + text := c.formatValue(frac * top) + c.drawText(p, pl.X-pad-c.textWidth(text), y-gh/2, text, label) + } + + n := c.buckets() + for b := 0; b < n; b++ { + x0 := pl.X + b*pl.W/n + x1 := pl.X + (b+1)*pl.W/n + w := max(1, x1-x0-1) + base := pl.Y + pl.H - 1 + acc := 0.0 + for l, layer := range c.Layers { + if b >= len(layer) || layer[b] <= 0 { + continue + } + acc += layer[b] + y := pl.Y + int((1-min(1, acc/top))*float64(pl.H-1)) + if base > y { + fillRect(p, x0, y, w, base-y, c.layerColor(l)) + } + base = min(base, y) + } + } + + if c.TimeMax > c.TimeMin { + ty := pl.Y + pl.H - 1 + pad + endText := c.formatTime(c.TimeMax) + c.drawText(p, pl.X, ty, c.formatTime(c.TimeMin), label) + c.drawText(p, pl.X+pl.W-c.textWidth(endText), ty, endText, label) + } +} + +// A11y describes the chart as an image with its layer and bucket counts. +func (c *StackedBarChart) A11y() A11yInfo { + return A11yInfo{Role: RoleImg, Value: fmt.Sprintf("%d layers, %d buckets", len(c.Layers), c.buckets())} +} + +var _ Accessible = (*StackedBarChart)(nil) diff --git a/stackedbarchart_test.go b/stackedbarchart_test.go new file mode 100644 index 0000000..43638ec --- /dev/null +++ b/stackedbarchart_test.go @@ -0,0 +1,67 @@ +// Copyright (c) 2026 the go-widgets/toolkit authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause license that can be +// found in the LICENSE file at the root of this repository. + +package toolkit + +import "testing" + +func TestStackedBarChartStacksLayersBottomUp(t *testing.T) { + red, blue := RGBA{R: 255, A: 255}, RGBA{B: 255, A: 255} + c := NewStackedBarChart([][]float64{{10, 0}, {10, 20}, {}}, []string{"a", "", "c"}) + c.Colors = []RGBA{red, blue} + c.Max = 20 + c.TimeMin, c.TimeMax = 1000, 2000 + c.SetBounds(Rect{W: 200, H: 120}) + surf := makeSurface(200, 120) + c.Draw(newP(surf, 200), DefaultLight()) + pl := c.plot() + bottom := pl.Y + pl.H - 2 + topY := pl.Y + 1 + if got := pixelAt(surf, 200, pl.X+1, bottom); got != red { + t.Fatalf("lowest layer of bucket 0 = %v, want red", got) + } + if got := pixelAt(surf, 200, pl.X+1, topY); got != blue { + t.Fatalf("top of the full stack = %v, want blue", got) + } + // Bucket 1 has only the blue layer, starting at the baseline. + if got := pixelAt(surf, 200, pl.X+pl.W-3, bottom); got != blue { + t.Fatalf("bucket 1 base = %v, want blue", got) + } + if countInk(surf, 200, 120, red) == 0 || countPainted(surf, 200, 120) == 0 { + t.Fatal("nothing drawn") + } +} + +func TestStackedBarChartAutoMaxFormatsAndEmpty(t *testing.T) { + c := NewStackedBarChart([][]float64{{3, -4}, {1}}, nil) + if c.top() != NiceCeiling(4) { + t.Fatalf("top %v", c.top()) + } + c.FormatValue = func(v float64) string { return "v" } + c.FormatTime = func(int64) string { return "t" } + if c.formatValue(1) != "v" || c.formatTime(1) != "t" { + t.Fatal("custom formatters ignored") + } + c.FormatValue, c.FormatTime = nil, nil + if c.formatValue(2) != "2" || c.formatTime(0) == "" { + t.Fatal("default formatters") + } + c.SetBounds(Rect{W: 0, H: 0}) + c.Draw(newP(makeSurface(10, 10), 10), DefaultLight()) // no panic + e := NewStackedBarChart(nil, nil) + if e.buckets() != 0 || e.top() != 1 { + t.Fatal("empty chart scale") + } + e.SetBounds(Rect{W: 100, H: 80}) + e.Draw(newP(makeSurface(100, 80), 100), DefaultDark()) // axes only, no bars + if e.layerColor(0) == (RGBA{}) { + t.Fatal("default palette") + } +} + +func TestStackedBarChartA11y(t *testing.T) { + if v := NewStackedBarChart([][]float64{{1, 2}}, nil).A11y().Value; v != "1 layers, 2 buckets" { + t.Fatal(v) + } +} diff --git a/timeserieschart.go b/timeserieschart.go index 14f9875..ac29637 100644 --- a/timeserieschart.go +++ b/timeserieschart.go @@ -109,6 +109,15 @@ type TimeSeriesChart struct { // exactly as before this field existed. TimeMin, TimeMax int64 + // Markers are vertical reference lines at given instants; see [TimeMarker]. + Markers []TimeMarker + + // Overlays are further lines drawn on the same axes and scale as Points, + // each with its own colour and a legend entry (swatch and name) at the top + // left of the plot. Comparing four weeks day by day is four overlays whose + // instants have been shifted onto one common week. + Overlays []TimeLine + // series is the bindable form of Points, created by Series(). series *mvvm.ObservableList[TimePoint] // ceiling is where FollowPeak has the scale now. @@ -302,6 +311,25 @@ func (c *TimeSeriesChart) Draw(p painter.Painter, theme *Theme) { } } + c.drawMarkers(p, theme, pl, rangeStart, span) + + lx := pl.X + scaled(TimeSeriesChartPad) + for _, ov := range c.Overlays { + if len(ov.Points) >= 2 { + px, py := pointAt(ov.Points[0]) + for _, pt := range ov.Points[1:] { + x, y := pointAt(pt) + drawCurveLine(p, px, py, x, y, ov.Ink) + px, py = x, y + } + } + if ov.Name != "" { + fillRect(p, lx, pl.Y+scaled(TimeSeriesChartPad), gh, gh, ov.Ink) + c.drawText(p, lx+gh+scaled(TimeSeriesChartPad), pl.Y+scaled(TimeSeriesChartPad), ov.Name, theme.OnSurface) + lx += gh + 3*scaled(TimeSeriesChartPad) + c.textWidth(ov.Name) + } + } + if pts := c.points(); len(pts) >= 2 { px, py := pointAt(pts[0]) for _, pt := range pts[1:] { @@ -318,6 +346,49 @@ func (c *TimeSeriesChart) Draw(p painter.Painter, theme *Theme) { c.drawText(p, pl.X+pl.W-c.textWidth(endText), ty, endText, label) } +// TimeLine is a named, coloured series drawn over a TimeSeriesChart; see +// [TimeSeriesChart.Overlays]. +type TimeLine struct { + Name string + Ink RGBA + Points []TimePoint +} + +// TimeMarker is a vertical reference line at one instant on a TimeSeriesChart's +// time axis -- a window reset, a deploy, an incident. Label, when set, is drawn +// at the top of the line, on its left when the line is in the right half of the +// plot so the text stays inside it. +type TimeMarker struct { + At int64 + Label string + // Ink is the line's color; the zero value uses theme.OnSurface. + Ink RGBA +} + +// drawMarkers paints the Markers that fall inside the time axis span as dashed +// vertical lines; one outside the span is not drawn. +func (c *TimeSeriesChart) drawMarkers(p painter.Painter, theme *Theme, pl Rect, start, span int64) { + for _, m := range c.Markers { + if m.At < start || m.At > start+span { + continue + } + ink := m.Ink + if ink == (RGBA{}) { + ink = theme.OnSurface + } + x := pl.X + int(float64(m.At-start)/float64(span)*float64(pl.W-1)) + drawDashedLine(p, x, pl.Y, x, pl.Y+pl.H-1, ink) + if m.Label == "" { + continue + } + tx := x + scaled(TimeSeriesChartPad) + if w := c.textWidth(m.Label); x > pl.X+pl.W/2 { + tx = x - scaled(TimeSeriesChartPad) - w + } + c.drawText(p, tx, pl.Y+scaled(TimeSeriesChartPad), m.Label, ink) + } +} + // timeRange is the time axis span Draw plots against: the explicit // TimeMin..TimeMax when TimeMax > TimeMin, so a caller can show a full // window (a week, say) from the start even when only a few hours of diff --git a/timeserieschart_test.go b/timeserieschart_test.go index ec631c8..63a014e 100644 --- a/timeserieschart_test.go +++ b/timeserieschart_test.go @@ -742,3 +742,40 @@ func TestTimeSeriesChartPinnedRangeWithNoPointsStillDrawsScaffolding(t *testing. t.Errorf("a pinned range with zero points painted %d Border pixels, want more than the truly-empty baseline (%d) — vertical gridlines should still show the full window", got, base) } } + +func TestTimeSeriesChartDrawsMarkersInsideTheSpanOnly(t *testing.T) { + ink := RGBA{R: 1, G: 2, B: 3, A: 255} + c := NewTimeSeriesChart(nil, 0, 100) + c.TimeMin, c.TimeMax = 0, 1000 + c.Markers = []TimeMarker{{At: 250, Ink: ink}, {At: 5000, Ink: ink}, {At: 900, Label: "reset"}, {At: 100, Label: "early"}, {At: -5, Ink: ink}} + c.SetBounds(Rect{W: 240, H: 100}) + surf := makeSurface(240, 100) + th := DefaultLight() + c.Draw(newP(surf, 240), th) + bare := NewTimeSeriesChart(nil, 0, 100) + bare.TimeMin, bare.TimeMax = 0, 1000 + bare.SetBounds(Rect{W: 240, H: 100}) + surf2 := makeSurface(240, 100) + bare.Draw(newP(surf2, 240), th) + if countPainted(surf, 240, 100) <= countPainted(surf2, 240, 100) { + t.Fatal("markers inside the span not drawn") + } +} + +func TestTimeSeriesChartDrawsOverlayLinesWithALegend(t *testing.T) { + th := DefaultLight() + c := NewTimeSeriesChart(nil, 0, 100) + c.TimeMin, c.TimeMax = 0, 700 + c.SetBounds(Rect{W: 240, H: 100}) + bare := makeSurface(240, 100) + c.Draw(newP(bare, 240), th) + c.Overlays = []TimeLine{ + {Name: "w1", Ink: RGBA{R: 200, A: 255}, Points: []TimePoint{{At: 0, Value: 0}, {At: 700, Value: 90}}}, + {Ink: RGBA{B: 200, A: 255}, Points: []TimePoint{{At: 0, Value: 10}}}, + } + surf := makeSurface(240, 100) + c.Draw(newP(surf, 240), th) + if countPainted(surf, 240, 100) <= countPainted(bare, 240, 100) { + t.Fatal("overlay not drawn") + } +}