Skip to content

Commit

Permalink
(agrf) ground sprite test
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyangyi committed Dec 5, 2024
1 parent 3572936 commit 59b8ce7
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion agrf/lib/building/layout_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from agrf.lib.building.layout import ADefaultGroundSprite, ALayout
import grf
from agrf.lib.building.layout import AGroundSprite, ADefaultGroundSprite, ALayout
from agrf.lib.building.symmetry import BuildingSymmetrical
from agrf.pkg import load_third_party_image
from agrf.graphics.misc import SCALE_TO_ZOOM


def test_default_groundsprite():
Expand All @@ -22,6 +25,28 @@ def test_default_groundsprite():
assert t_graphics[64, 128, 1] == 67


def test_groundsprite():
gs1012 = AGroundSprite(
grf.AlternativeSprites(
grf.FileSprite(
grf.ImageFile("agrf/third_party/opengfx2/temperate/1012.png"),
0,
0,
256,
127,
xofs=124,
yofs=0,
bpp=32,
zoom=SCALE_TO_ZOOM[4],
)
)
)

graphics = gs1012.graphics(4, 32).to_image()
assert graphics.shape == (127, 256, 4)
assert graphics[64, 128, 1] == 67


def test_layout():
gs1012 = ADefaultGroundSprite(1012)
l = ALayout(gs1012, [], True)
Expand Down

0 comments on commit 59b8ce7

Please sign in to comment.