This commit is contained in:
blueloveTH 2023-09-18 21:53:45 +08:00
parent 60e666c12e
commit e9b4734004
3 changed files with 5576 additions and 0 deletions

2
.gitignore vendored
View File

@ -36,3 +36,5 @@ pypi/
libpocketpy.dylib
.xmake/
tests/res/WorldMap_Free_layout.ldtk
tests/res/WorldMap_GridVania_layout.ldtk

21
tests/82_ldtk.py Normal file
View File

@ -0,0 +1,21 @@
import json
_2489KB = 'WorldMap_GridVania_layout.ldtk'
_1093KB = 'WorldMap_Free_layout.ldtk'
_339KB = 'Typical_2D_platformer_example.ldtk'
with open(f'res/{_339KB}', 'r') as f:
json_content = f.read()
data: dict = json.loads(json_content)
assert isinstance(data, dict)
dumped: str = json.dumps(data)
loaded: dict = json.loads(dumped)
assert data == loaded
# import pickle
##### very very slow!! DO NOT RUN IT
# data_pickled: bytes = pickle.dumps(data)
# assert isinstance(data_pickled, bytes)
# assert pickle.loads(data_pickled) == data

File diff suppressed because one or more lines are too long