ebiten: add TestImageSetAndSubImage

Updates #2428
This commit is contained in:
Hajime Hoshi 2022-11-02 12:35:19 +09:00
parent 0660c4ea8a
commit 4c5f019db3

View File

@ -3966,3 +3966,15 @@ func TestImageColorMScale(t *testing.T) {
t.Errorf("got: %v, want: %v", got, want) 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)
}
}