Skip to content

Commit

Permalink
(agrf) New test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyangyi committed Jan 3, 2025
1 parent 330e4c7 commit d7d8fd6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion agrf/lib/building/layout_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import grf
import numpy as np
from PIL import Image
from agrf.lib.building.layout import AGroundSprite, ADefaultGroundSprite, ALayout
from agrf.lib.building.layout import AGroundSprite, ADefaultGroundSprite, AParentSprite, ALayout
from agrf.lib.building.symmetry import BuildingSymmetrical
from agrf.lib.building.image_sprite import image_sprite
from agrf.graphics.misc import SCALE_TO_ZOOM
Expand All @@ -12,6 +12,7 @@

dgs1012 = ADefaultGroundSprite(1012)
gs1012 = AGroundSprite(image_sprite("agrf/third_party/opengfx2/temperate/1012.png"))
ps1012 = AParentSprite(image_sprite("agrf/third_party/opengfx2/temperate/1012.png"), (16, 16, 1), (0, 0, 0))
l1012 = ALayout(dgs1012, [], True)


Expand All @@ -35,6 +36,10 @@ def test_groundsprite():
assert (temperate_1012 == gs1012.graphics(4, 32).to_image()).all()


def test_parentsprite():
assert (temperate_1012 == ps1012.graphics(4, 32).to_image()).all()


def test_layout():
assert (temperate_1012 == l1012.graphics(4, 32).to_image()).all()

Expand All @@ -61,6 +66,11 @@ def test_ground_sprite_to_parentsprite():
gs1012.to_parentsprite()


def test_pushdown():
# FIXME also examine the offsets
assert (temperate_1012 == ps1012.pushdown(1).graphics(4, 32).to_image()).all()


def test_symmetry():
gs1012 = ADefaultGroundSprite(1012)
gs1011 = ADefaultGroundSprite(1011)
Expand Down

0 comments on commit d7d8fd6

Please sign in to comment.