From 26e2748732251b267e9a4a93147cb672ed3555ca Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 16 Jan 2024 13:26:31 +0900 Subject: [PATCH] internal/buffered: bug fix: check errors from ReadPixels --- internal/buffered/image_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/buffered/image_test.go b/internal/buffered/image_test.go index a55402678..f815c5c33 100644 --- a/internal/buffered/image_test.go +++ b/internal/buffered/image_test.go @@ -38,7 +38,9 @@ func TestUnsyncedPixels(t *testing.T) { // Merge the entry into the cached pixels. // The entry for dotsBuffer is now gone in the current implementation. - dst.ReadPixels(ui.Get().GraphicsDriverForTesting(), make([]byte, 4*16*16), image.Rect(0, 0, 16, 16)) + if err := dst.ReadPixels(ui.Get().GraphicsDriverForTesting(), make([]byte, 4*16*16), image.Rect(0, 0, 16, 16)); err != nil { + t.Fatal(err) + } // Call WritePixels with the outside region of (0, 0). dst.WritePixels(make([]byte, 4*2*2), image.Rect(1, 1, 3, 3)) @@ -54,7 +56,9 @@ func TestUnsyncedPixels(t *testing.T) { // Check the result is correct. var got [4]byte - dst.ReadPixels(ui.Get().GraphicsDriverForTesting(), got[:], image.Rect(0, 0, 1, 1)) + if err := dst.ReadPixels(ui.Get().GraphicsDriverForTesting(), got[:], image.Rect(0, 0, 1, 1)); err != nil { + t.Fatal(err) + } want := [4]byte{0xff, 0xff, 0xff, 0xff} if got != want { t.Errorf("got: %v, want: %v", got, want)