From 106815621579556cc0b3d783425be0d0c82c76ab Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 1 Mar 2018 02:43:59 +0900 Subject: [PATCH] restorable: Add restoring case to TestReplacePixels --- internal/restorable/images_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/internal/restorable/images_test.go b/internal/restorable/images_test.go index 324906a26..aa9f33ef9 100644 --- a/internal/restorable/images_test.go +++ b/internal/restorable/images_test.go @@ -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?