From 82b352d85eaef109ab4efa435eaa0c3b704c31bd Mon Sep 17 00:00:00 2001 From: Benjamin Kirkbride Date: Mon, 27 Jul 2020 19:57:27 -0400 Subject: [PATCH 1/3] mv(test_data): maps -> example_maps --- .../test_data/{maps => example_maps}/all_objects/all_objects.json | 0 .../{maps => example_maps}/all_objects/tileset_image.json | 0 .../{maps => example_maps}/all_objects/tileset_image_objects.json | 0 .../simple_external_tileset/map_simple_external_tileset.json | 0 .../simple_external_tileset/tileset_image.json | 0 .../{maps => example_maps}/simple_infinite/map_infinite.json | 0 .../{maps => example_maps}/simple_infinite/tileset_image.json | 0 .../{maps => example_maps}/simple_offset/map_simple_offset.json | 0 .../{maps => example_maps}/simple_offset/tileset_image.json | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename tests/test_data/{maps => example_maps}/all_objects/all_objects.json (100%) rename tests/test_data/{maps => example_maps}/all_objects/tileset_image.json (100%) rename tests/test_data/{maps => example_maps}/all_objects/tileset_image_objects.json (100%) rename tests/test_data/{maps => example_maps}/simple_external_tileset/map_simple_external_tileset.json (100%) rename tests/test_data/{maps => example_maps}/simple_external_tileset/tileset_image.json (100%) rename tests/test_data/{maps => example_maps}/simple_infinite/map_infinite.json (100%) rename tests/test_data/{maps => example_maps}/simple_infinite/tileset_image.json (100%) rename tests/test_data/{maps => example_maps}/simple_offset/map_simple_offset.json (100%) rename tests/test_data/{maps => example_maps}/simple_offset/tileset_image.json (100%) 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 From 45aae7e8edb330fca6e28e2b1f31000b9a056011 Mon Sep 17 00:00:00 2001 From: Benjamin Kirkbride Date: Mon, 27 Jul 2020 20:08:51 -0400 Subject: [PATCH 2/3] rf(map): alphabetize branches --- pytiled_parser/map.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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"] From 72cfff01d1322252813296e025cb2ec7d0ccb995 Mon Sep 17 00:00:00 2001 From: Benjamin Kirkbride Date: Mon, 27 Jul 2020 20:09:28 -0400 Subject: [PATCH 3/3] tests(test_data): add no_layers map --- .../test_data/map_tests/no_layers/expected.py | 0 .../map_tests/no_layers/map_no_layers.json | 63 +++++++++++++++++++ .../map_tests/no_layers/tileset_image.json | 14 +++++ 3 files changed, 77 insertions(+) create mode 100644 tests/test_data/map_tests/no_layers/expected.py create mode 100644 tests/test_data/map_tests/no_layers/map_no_layers.json create mode 100644 tests/test_data/map_tests/no_layers/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 +}