restorable: Add restoring case to TestReplacePixels

This commit is contained in:
Hajime Hoshi 2018-03-01 02:43:59 +09:00
parent 127f6c09c8
commit 1068156215

View File

@ -407,6 +407,27 @@ func TestReplacePixels(t *testing.T) {
}
}
}
if err := ResolveStaleImages(); err != nil {
t.Fatal(err)
}
if err := Restore(); err != nil {
t.Fatal(err)
}
for j := 0; j < h; j++ {
for i := 0; i < w; i++ {
got, err := img.At(i, j)
if err != nil {
t.Fatal(err)
}
want := color.RGBA{}
if 5 <= i && i < 9 && 7 <= j && j < 11 {
want = color.RGBA{0xff, 0xff, 0xff, 0xff}
}
if got != want {
t.Errorf("img.At(%d, %d): got: %v, want: %v", i, j, got, want)
}
}
}
}
// TODO: How about volatile/screen images?