Skip to content

Commit 77631ab

Browse files
committed
add tests checking if SprSize properly calc region
For example SprSize can be run with w=1.1. Then w*8=8.8. This number should be floored to calculate number of pixels to draw.
1 parent abfce34 commit 77631ab

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

screen_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ func testSprSize(t *testing.T, sprSize func(spriteNo int, x, y int, w, h float64
506506
"sprite at (0,0,1.0,2.5)": {w: 1.0, h: 2.5, expectedScreenFile: "spr_0_0_1.0_2.0.png"},
507507
"sprite at (8,0,2.0,1.0)": {x: 8, w: 2.0, h: 1.0, expectedScreenFile: "spr_8_0_2.0_1.0.png"},
508508
"sprite at (0,8,1.0,2.0)": {y: 8, w: 1.0, h: 2.0, expectedScreenFile: "spr_0_8_1.0_2.0.png"},
509+
"sprite at (0,0,1.1,0.5)": {w: 1.1, h: 0.5, expectedScreenFile: "spr_0_0_1.0_0.5.png"}, // should floor(w*8)
510+
"sprite at (0,0,0.5,1.1)": {w: 0.5, h: 1.1, expectedScreenFile: "spr_0_0_0.5_1.0.png"}, // should floor(h*8)
509511
}
510512
for name, test := range tests {
511513
t.Run(name, func(t *testing.T) {

0 commit comments

Comments
 (0)