image: Add ReplacePixels test

This commit is contained in:
Hajime Hoshi 2016-08-23 00:13:44 +09:00
parent 3dad97af8a
commit 0f19f67fc9

View File

@ -273,15 +273,20 @@ func TestReplacePixels(t *testing.T) {
t.Fatal(err)
return
}
// Even if p is changed after calling ReplacePixel, img0 uses the original values.
for i := range p {
p[i] = 0
}
for j := 0; j < img0.Bounds().Size().Y; j++ {
for i := 0; i < img0.Bounds().Size().X; i++ {
got := img0.At(i, j)
want := color.RGBA{p[4*i], p[4*i+1], p[4*i+2], p[4*i+3]}
want := color.RGBA{0x80, 0x80, 0x80, 0x80}
if got != want {
t.Errorf("img0 At(%d, %d): got %#v; want %#v", i, j, got, want)
}
}
}
}
func TestImageDispose(t *testing.T) {