diff --git a/pytiled_parser/map.py b/pytiled_parser/map.py index a232081..2187b10 100644 --- a/pytiled_parser/map.py +++ b/pytiled_parser/map.py @@ -153,12 +153,12 @@ def cast(raw_tiled_map: _RawTiledMap) -> Map: if raw_tiled_map.get("backgroundcolor") is not None: map_.background_color = raw_tiled_map["backgroundcolor"] - if raw_tiled_map.get("properties") is not None: - map_.properties = properties.cast(raw_tiled_map["properties"]) - if raw_tiled_map.get("hexsidelength") is not None: map_.hex_side_length = raw_tiled_map["hexsidelength"] + if raw_tiled_map.get("properties") is not None: + map_.properties = properties.cast(raw_tiled_map["properties"]) + if raw_tiled_map.get("staggeraxis") is not None: map_.stagger_axis = raw_tiled_map["staggeraxis"] diff --git a/tests/test_data/maps/all_objects/all_objects.json b/tests/test_data/example_maps/all_objects/all_objects.json similarity index 100% rename from tests/test_data/maps/all_objects/all_objects.json rename to tests/test_data/example_maps/all_objects/all_objects.json diff --git a/tests/test_data/maps/all_objects/tileset_image.json b/tests/test_data/example_maps/all_objects/tileset_image.json similarity index 100% rename from tests/test_data/maps/all_objects/tileset_image.json rename to tests/test_data/example_maps/all_objects/tileset_image.json diff --git a/tests/test_data/maps/all_objects/tileset_image_objects.json b/tests/test_data/example_maps/all_objects/tileset_image_objects.json similarity index 100% rename from tests/test_data/maps/all_objects/tileset_image_objects.json rename to tests/test_data/example_maps/all_objects/tileset_image_objects.json diff --git a/tests/test_data/maps/simple_external_tileset/map_simple_external_tileset.json b/tests/test_data/example_maps/simple_external_tileset/map_simple_external_tileset.json similarity index 100% rename from tests/test_data/maps/simple_external_tileset/map_simple_external_tileset.json rename to tests/test_data/example_maps/simple_external_tileset/map_simple_external_tileset.json diff --git a/tests/test_data/maps/simple_external_tileset/tileset_image.json b/tests/test_data/example_maps/simple_external_tileset/tileset_image.json similarity index 100% rename from tests/test_data/maps/simple_external_tileset/tileset_image.json rename to tests/test_data/example_maps/simple_external_tileset/tileset_image.json diff --git a/tests/test_data/maps/simple_infinite/map_infinite.json b/tests/test_data/example_maps/simple_infinite/map_infinite.json similarity index 100% rename from tests/test_data/maps/simple_infinite/map_infinite.json rename to tests/test_data/example_maps/simple_infinite/map_infinite.json diff --git a/tests/test_data/maps/simple_infinite/tileset_image.json b/tests/test_data/example_maps/simple_infinite/tileset_image.json similarity index 100% rename from tests/test_data/maps/simple_infinite/tileset_image.json rename to tests/test_data/example_maps/simple_infinite/tileset_image.json diff --git a/tests/test_data/maps/simple_offset/map_simple_offset.json b/tests/test_data/example_maps/simple_offset/map_simple_offset.json similarity index 100% rename from tests/test_data/maps/simple_offset/map_simple_offset.json rename to tests/test_data/example_maps/simple_offset/map_simple_offset.json diff --git a/tests/test_data/maps/simple_offset/tileset_image.json b/tests/test_data/example_maps/simple_offset/tileset_image.json similarity index 100% rename from tests/test_data/maps/simple_offset/tileset_image.json rename to tests/test_data/example_maps/simple_offset/tileset_image.json diff --git a/tests/test_data/map_tests/no_layers/expected.py b/tests/test_data/map_tests/no_layers/expected.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_data/map_tests/no_layers/map_no_layers.json b/tests/test_data/map_tests/no_layers/map_no_layers.json new file mode 100644 index 0000000..ac423c0 --- /dev/null +++ b/tests/test_data/map_tests/no_layers/map_no_layers.json @@ -0,0 +1,63 @@ +{ "compressionlevel":0, + "editorsettings": + { + "export": + { + "target":"." + } + }, + "height":6, + "infinite":false, + "layers":[], + "nextlayerid":2, + "nextobjectid":1, + "orientation":"orthogonal", + "properties":[ + { + "name":"bool property - false", + "type":"bool", + "value":false + }, + { + "name":"bool property - true", + "type":"bool", + "value":true + }, + { + "name":"color property", + "type":"color", + "value":"#ff49fcff" + }, + { + "name":"file property", + "type":"file", + "value":"..\/..\/..\/..\/..\/..\/var\/log\/syslog" + }, + { + "name":"float property", + "type":"float", + "value":1.23456789 + }, + { + "name":"int property", + "type":"int", + "value":13 + }, + { + "name":"string property", + "type":"string", + "value":"Hello, World!!" + }], + "renderorder":"right-down", + "tiledversion":"1.4.1", + "tileheight":32, + "tilesets":[ + { + "firstgid":1, + "source":"tileset_image.json" + }], + "tilewidth":32, + "type":"map", + "version":1.4, + "width":8 +} \ No newline at end of file diff --git a/tests/test_data/map_tests/no_layers/tileset_image.json b/tests/test_data/map_tests/no_layers/tileset_image.json new file mode 100644 index 0000000..e88a3f1 --- /dev/null +++ b/tests/test_data/map_tests/no_layers/tileset_image.json @@ -0,0 +1,14 @@ +{ "columns":8, + "image":"..\/..\/images\/tmw_desert_spacing.png", + "imageheight":199, + "imagewidth":265, + "margin":1, + "name":"tile_set_image", + "spacing":1, + "tilecount":48, + "tiledversion":"1.3.1", + "tileheight":32, + "tilewidth":32, + "type":"tileset", + "version":1.2 +}