From 59b8ce720995a13f50072b4c4972fefa1632a069 Mon Sep 17 00:00:00 2001 From: "Yi Yang @ Aquamarine" Date: Thu, 5 Dec 2024 23:44:00 +0800 Subject: [PATCH] (agrf) ground sprite test --- agrf/lib/building/layout_test.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/agrf/lib/building/layout_test.py b/agrf/lib/building/layout_test.py index 91b09b09..4a3e0930 100644 --- a/agrf/lib/building/layout_test.py +++ b/agrf/lib/building/layout_test.py @@ -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(): @@ -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)