Skip to content

Commit c07b0a5

Browse files
committed
add-cmpimg-approx
Signed-off-by: Sebastien Binet <binet@cern.ch>
1 parent c406cd7 commit c07b0a5

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎vg/vg_test.go‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ import (
1919
"gonum.org/v1/plot/vg"
2020
)
2121

22+
const (
23+
cmpDelta = 0.1
24+
)
25+
2226
// TestLineWidth tests output against test images generated by
2327
// running tests with -tag good.
2428
func TestLineWidth(t *testing.T) {
@@ -68,7 +72,7 @@ func TestLineWidth(t *testing.T) {
6872
t.Fatalf("failed to read test image [%s]: %v\n", name, err)
6973
}
7074

71-
ok, err := cmpimg.EqualApprox(typ, buf.Bytes(), want, 0.1)
75+
ok, err := cmpimg.EqualApprox(typ, buf.Bytes(), want, cmpDelta)
7276
if err != nil {
7377
t.Fatalf("failed to run cmpimg test [%s]: %v\n", name, err)
7478
}

‎vg/vgimg/vgimg_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func TestIssue687(t *testing.T) {
154154
fname = "testdata/issue687.png"
155155
size = 500
156156
)
157-
cmpimg.CheckPlot(func() {
157+
cmpimg.CheckPlotApprox(func() {
158158
p := plot.New()
159159
p.Title.Text = "Issue 687"
160160
p.X.Label.Text = "X"
@@ -175,5 +175,5 @@ func TestIssue687(t *testing.T) {
175175
t.Fatal(err)
176176
}
177177

178-
}, t, filepath.Base(fname))
178+
}, t, filepath.Base(fname), 0.1)
179179
}

0 commit comments

Comments
 (0)