From 4c5f019db33cd99d9c7be9587e2049be0ddf903c Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 2 Nov 2022 12:35:19 +0900 Subject: [PATCH] ebiten: add TestImageSetAndSubImage Updates #2428 --- image_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/image_test.go b/image_test.go index 5299cca9c..bb617b461 100644 --- a/image_test.go +++ b/image_test.go @@ -3966,3 +3966,15 @@ func TestImageColorMScale(t *testing.T) { t.Errorf("got: %v, want: %v", got, want) } } + +// Issue #2428 +func TestImageSetAndSubImage(t *testing.T) { + const w, h = 16, 16 + img := ebiten.NewImage(w, h) + img.Set(1, 1, color.RGBA{0xff, 0, 0, 0xff}) + got := img.SubImage(image.Rect(0, 0, w, h)).At(1, 1).(color.RGBA) + want := color.RGBA{0xff, 0, 0, 0xff} + if got != want { + t.Errorf("got: %v, want: %v", got, want) + } +}