From 331e46a6cea11b54ba24952e1995e9dd9f2d4a29 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 3 Feb 2018 17:26:44 +0900 Subject: [PATCH] graphics: Improve TestImageTooManyFill --- image_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/image_test.go b/image_test.go index c232135d3..61e9e18ad 100644 --- a/image_test.go +++ b/image_test.go @@ -561,7 +561,7 @@ func TestImageEdge(t *testing.T) { } func indexToColor(index int) uint8 { - return uint8((17 * index) % 256) + return uint8((17 * index + 0x40) % 256) } // Issue #419 @@ -580,10 +580,10 @@ func TestImageTooManyFill(t *testing.T) { for i := 0; i < width; i++ { c := indexToColor(i) - got := color.RGBAModel.Convert(dst.At(i, 0)) + got := color.RGBAModel.Convert(dst.At(i, 0)).(color.RGBA) want := color.RGBA{c, c, c, 0xff} - if got != want { - t.Errorf("src At(%d, %d): got %#v, want: %#v", i, 0, got, want) + if !sameColors(got, want, 1) { + t.Errorf("dst.At(%d, %d): got %#v, want: %#v", i, 0, got, want) } } }