Skip to content

Commit d164eca

Browse files
committed
all: split golden images based on GOARCH
1 parent 30c70fd commit d164eca

26 files changed

+23
-14
lines changed

plot_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"image/color"
1111
"math"
1212
"os"
13+
"runtime"
1314
"testing"
1415
"time"
1516

@@ -182,9 +183,9 @@ func TestDrawGlyphBoxes(t *testing.T) {
182183
t.Fatalf("error: %+v", err)
183184
}
184185

185-
err = os.WriteFile("testdata/glyphbox.png", buf.Bytes(), 0644)
186+
err = os.WriteFile("testdata/glyphbox_"+runtime.GOARCH+".png", buf.Bytes(), 0644)
186187
if err != nil {
187188
t.Fatalf("could not save plot: %+v", err)
188189
}
189-
}, t, "glyphbox.png")
190+
}, t, "glyphbox_"+runtime.GOARCH+".png")
190191
}

plotter/contour_example_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package plotter_test
77
import (
88
"log"
99
"math"
10+
"runtime"
1011
"testing"
1112

1213
"golang.org/x/exp/rand"
@@ -51,7 +52,7 @@ func ExampleContour() {
5152

5253
p.Add(c)
5354

54-
err := p.Save(10*vg.Centimeter, 10*vg.Centimeter, "testdata/contour.png")
55+
err := p.Save(10*vg.Centimeter, 10*vg.Centimeter, "testdata/contour_"+runtime.GOARCH+".png")
5556
if err != nil {
5657
log.Fatalf("could not save plot: %+v", err)
5758
}
@@ -77,5 +78,5 @@ func (g unitGrid) Y(r int) float64 {
7778
}
7879

7980
func TestContour(t *testing.T) {
80-
cmpimg.CheckPlotApprox(ExampleContour, t, 0.01, "contour.png")
81+
cmpimg.CheckPlotApprox(ExampleContour, t, 0.01, "contour_"+runtime.GOARCH+".png")
8182
}

plotter/labels_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package plotter_test
66

77
import (
88
"image/color"
9+
"runtime"
910
"testing"
1011

1112
"gonum.org/v1/plot"
@@ -145,11 +146,11 @@ func TestLabelsWithGlyphBoxes(t *testing.T) {
145146
p.Add(plotter.NewGrid())
146147
p.Add(plotter.NewGlyphBoxes())
147148

148-
err = p.Save(10*vg.Centimeter, 10*vg.Centimeter, "testdata/labels_glyphboxes.png")
149+
err = p.Save(10*vg.Centimeter, 10*vg.Centimeter, "testdata/labels_glyphboxes_"+runtime.GOARCH+".png")
149150
if err != nil {
150-
t.Fatalf("could save plot: %+v", err)
151+
t.Fatalf("could not save plot: %+v", err)
151152
}
152153
},
153-
t, "labels_glyphboxes.png",
154+
t, "labels_glyphboxes_"+runtime.GOARCH+".png",
154155
)
155156
}

plotter/precision_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package plotter_test
66

77
import (
88
"log"
9+
"runtime"
910
"testing"
1011

1112
"gonum.org/v1/plot"
@@ -14,7 +15,7 @@ import (
1415
)
1516

1617
func TestFloatPrecision(t *testing.T) {
17-
const fname = "precision.png"
18+
const fname = "precision_" + runtime.GOARCH + ".png"
1819

1920
cmpimg.CheckPlot(func() {
2021
p := plot.New()

plotter/rotation_example_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"image/color"
99
"log"
1010
"math"
11+
"runtime"
1112

1213
"gonum.org/v1/plot"
1314
"gonum.org/v1/plot/plotter"
@@ -92,7 +93,7 @@ func Example_rotation() {
9293
p.Y.Tick.Label.XAlign = draw.XCenter
9394
p.Y.Tick.Label.YAlign = draw.YBottom
9495

95-
err = p.Save(200, 150, "testdata/rotation.png")
96+
err = p.Save(200, 150, "testdata/rotation_"+runtime.GOARCH+".png")
9697
if err != nil {
9798
log.Panic(err)
9899
}

plotter/rotation_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
package plotter_test
66

77
import (
8+
"runtime"
89
"testing"
910

1011
"gonum.org/v1/plot/cmpimg"
1112
)
1213

1314
func TestRotation(t *testing.T) {
14-
cmpimg.CheckPlot(Example_rotation, t, "rotation.png")
15+
cmpimg.CheckPlot(Example_rotation, t, "rotation_"+runtime.GOARCH+".png")
1516
}

plotter/sankey_example_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"image/color"
1010
"log"
1111
"os"
12+
"runtime"
1213

1314
"gonum.org/v1/plot"
1415
"gonum.org/v1/plot/plotter"
@@ -396,7 +397,7 @@ func ExampleSankey_grouped() {
396397

397398
p.Draw(dc)
398399
pngimg := vgimg.PngCanvas{Canvas: c}
399-
f, err := os.Create("testdata/sankeyGrouped.png")
400+
f, err := os.Create("testdata/sankeyGrouped_" + runtime.GOARCH + ".png")
400401
if err != nil {
401402
log.Panic(err)
402403
}

plotter/sankey_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package plotter_test
66

77
import (
8+
"runtime"
89
"testing"
910

1011
"gonum.org/v1/plot"
@@ -20,7 +21,7 @@ func TestSankey_simple(t *testing.T) {
2021
}
2122

2223
func TestSankey_grouped(t *testing.T) {
23-
cmpimg.CheckPlot(ExampleSankey_grouped, t, "sankeyGrouped.png")
24+
cmpimg.CheckPlot(ExampleSankey_grouped, t, "sankeyGrouped_"+runtime.GOARCH+".png")
2425
}
2526

2627
// This test checks whether the Sankey plotter makes any changes to
85.9 KB
Loading
87.3 KB
Loading

plotter/testdata/contour_golden.png

-86 KB
Binary file not shown.
Loading
-4.51 KB
Binary file not shown.
Loading
6.93 KB
Loading
23.4 KB
Loading
Loading
File renamed without changes.

testdata/glyphbox_arm64_golden.png

15.7 KB
Loading

text/latex_example_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"image/color"
99
"log"
1010
"math"
11+
"runtime"
1112
"testing"
1213

1314
"gonum.org/v1/plot"
@@ -74,12 +75,12 @@ func ExampleLatex() {
7475
p.Add(plotter.NewGlyphBoxes())
7576
p.Add(plotter.NewGrid())
7677

77-
err = p.Save(10*vg.Centimeter, 5*vg.Centimeter, "testdata/latex.png")
78+
err = p.Save(10*vg.Centimeter, 5*vg.Centimeter, "testdata/latex_"+runtime.GOARCH+".png")
7879
if err != nil {
7980
log.Fatalf("could not save plot: %+v", err)
8081
}
8182
}
8283

8384
func TestLatex(t *testing.T) {
84-
cmpimg.CheckPlot(ExampleLatex, t, "latex.png")
85+
cmpimg.CheckPlot(ExampleLatex, t, "latex_"+runtime.GOARCH+".png")
8586
}
File renamed without changes.

text/testdata/latex_arm64_golden.png

13.5 KB
Loading

0 commit comments

Comments
 (0)