(t *testing.T)
| 19 | ) |
| 20 | |
| 21 | func TestMultiCanvas(t *testing.T) { |
| 22 | p := plot.New() |
| 23 | p.Title.Text = "Title" |
| 24 | p.X.Label.Text = "x" |
| 25 | p.Y.Label.Text = "y" |
| 26 | p.X.Min = -2 * math.Pi |
| 27 | p.X.Max = +2 * math.Pi |
| 28 | |
| 29 | sin := plotter.NewFunction(math.Sin) |
| 30 | sin.LineStyle.Color = color.RGBA{R: 255, A: 255} |
| 31 | sin.LineStyle.Dashes = plotutil.Dashes(1) |
| 32 | |
| 33 | cos := plotter.NewFunction(math.Cos) |
| 34 | cos.LineStyle.Color = color.RGBA{B: 255, A: 255} |
| 35 | cos.LineStyle.Dashes = plotutil.Dashes(2) |
| 36 | |
| 37 | p.Add(sin, cos, plotter.NewGrid()) |
| 38 | |
| 39 | c1 := new(recorder.Canvas) |
| 40 | c2 := new(recorder.Canvas) |
| 41 | |
| 42 | const ( |
| 43 | width = 10 * vg.Centimeter |
| 44 | height = 10 * vg.Centimeter |
| 45 | ) |
| 46 | |
| 47 | p.Draw(draw.NewCanvas( |
| 48 | vg.MultiCanvas(c1, c2, vg.MultiCanvas()), |
| 49 | width, height, |
| 50 | )) |
| 51 | |
| 52 | if !reflect.DeepEqual(c1, c2) { |
| 53 | t.Fatalf("tee canvas failed to replicate drawing calls") |
| 54 | } |
| 55 | } |
nothing calls this directly
no test coverage detected