From bf67998fc56c519a4b78b157541bad29fd02dcfe Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 23 Dec 2018 01:18:05 +0900 Subject: [PATCH] graphicscommand: Bug fix: Do not assure the initial state of the image --- internal/graphicscommand/image_test.go | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/internal/graphicscommand/image_test.go b/internal/graphicscommand/image_test.go index 4dfa85a7e..1c345bbc4 100644 --- a/internal/graphicscommand/image_test.go +++ b/internal/graphicscommand/image_test.go @@ -46,34 +46,12 @@ func TestClear(t *testing.T) { const w, h = 1024, 1024 src := NewImage(w/2, h/2) dst := NewImage(w, h) - pix := dst.Pixels() - for j := 0; j < h/2; j++ { - for i := 0; i < w/2; i++ { - idx := 4 * (i + w*j) - got := color.RGBA{pix[idx], pix[idx+1], pix[idx+2], pix[idx+3]} - want := color.RGBA{} - if got != want { - t.Errorf("dst.At(%d, %d): got %v, want: %v", i, j, got, want) - } - } - } - pix = src.Pixels() - for j := 0; j < h/2; j++ { - for i := 0; i < w/2; i++ { - idx := 4 * (i + (w/2)*j) - got := color.RGBA{pix[idx], pix[idx+1], pix[idx+2], pix[idx+3]} - want := color.RGBA{} - if got != want { - t.Errorf("src.At(%d, %d): got %v, want: %v", i, j, got, want) - } - } - } vs := graphics.QuadVertices(w/2, h/2, 0, 0, w/2, h/2, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1) is := graphics.QuadIndices() dst.DrawImage(src, vs, is, nil, graphics.CompositeModeClear, graphics.FilterNearest) - pix = dst.Pixels() + pix := dst.Pixels() for j := 0; j < h/2; j++ { for i := 0; i < w/2; i++ { idx := 4 * (i + w*j)