mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-10-30 03:12:53 +08:00
Bug fix: image can't draw itself (#45)
This commit is contained in:
@@ -49,7 +49,7 @@ func diff(x, y uint8) uint8 {
|
||||
return x - y
|
||||
}
|
||||
|
||||
func TestPixels(t *testing.T) {
|
||||
func TestImagePixels(t *testing.T) {
|
||||
eimg, img, err := openImage("testdata/ebiten.png")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -71,7 +71,7 @@ func TestPixels(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestComposition(t *testing.T) {
|
||||
func TestImageComposition(t *testing.T) {
|
||||
img2Color := color.NRGBA{0x24, 0x3f, 0x6a, 0x88}
|
||||
img3Color := color.NRGBA{0x85, 0xa3, 0x08, 0xd3}
|
||||
|
||||
@@ -134,4 +134,15 @@ func TestComposition(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestImageSelf(t *testing.T) {
|
||||
img, _, err := openImage("testdata/ebiten.png")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
return
|
||||
}
|
||||
if err := img.DrawImage(img, nil); err == nil {
|
||||
t.Fatalf("img.DrawImage(img, nil) doesn't return error; an error should be return")
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Add more tests (e.g. DrawImage with color matrix)
|
||||
|
||||
Reference in New Issue
Block a user