mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/buffered: bug fix: check errors from ReadPixels
This commit is contained in:
parent
2f894cb311
commit
26e2748732
@ -38,7 +38,9 @@ func TestUnsyncedPixels(t *testing.T) {
|
|||||||
|
|
||||||
// Merge the entry into the cached pixels.
|
// Merge the entry into the cached pixels.
|
||||||
// The entry for dotsBuffer is now gone in the current implementation.
|
// 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).
|
// Call WritePixels with the outside region of (0, 0).
|
||||||
dst.WritePixels(make([]byte, 4*2*2), image.Rect(1, 1, 3, 3))
|
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.
|
// Check the result is correct.
|
||||||
var got [4]byte
|
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}
|
want := [4]byte{0xff, 0xff, 0xff, 0xff}
|
||||||
if got != want {
|
if got != want {
|
||||||
t.Errorf("got: %v, want: %v", got, want)
|
t.Errorf("got: %v, want: %v", got, want)
|
||||||
|
Loading…
Reference in New Issue
Block a user