graphics: Improve TestImageTooManyFill

This commit is contained in:
Hajime Hoshi 2018-02-03 17:26:44 +09:00
parent a99c632cb7
commit 331e46a6ce

View File

@ -561,7 +561,7 @@ func TestImageEdge(t *testing.T) {
} }
func indexToColor(index int) uint8 { func indexToColor(index int) uint8 {
return uint8((17 * index) % 256) return uint8((17 * index + 0x40) % 256)
} }
// Issue #419 // Issue #419
@ -580,10 +580,10 @@ func TestImageTooManyFill(t *testing.T) {
for i := 0; i < width; i++ { for i := 0; i < width; i++ {
c := indexToColor(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} want := color.RGBA{c, c, c, 0xff}
if got != want { if !sameColors(got, want, 1) {
t.Errorf("src At(%d, %d): got %#v, want: %#v", i, 0, got, want) t.Errorf("dst.At(%d, %d): got %#v, want: %#v", i, 0, got, want)
} }
} }
} }