diff --git a/.gitignore b/.gitignore index 12002988..1f9df506 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Tiled Session file from using a project file +*.tiled-session + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b31d2b2..6ce43330 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +## [1.5.0] - 2021-05-16 + +This release contains several new features. As of this release pytiled-parser supports 100% of Tiled's feature-set as of Tiled 1.6. + +As of version 1.5.0 of pytiled-parser, we are supporting a minimum version of Tiled 1.5. Many features will still work with older versions, but we cannot guarantee functionality with those versions. + +### Additions + +- Added support for object template files +- Added `World` object to support loading Tiled `.world` files. +- Full support for Wang Sets/Terrains + +### Changes + +- The `version` attribute of `TiledMap` and `TileSet` is now a string with Tiled major/minor version. For example `"1.6"`. It used to be a float like `1.6`. This is due to Tiled changing that on their side. pytiled-parser will still load in the value regardless if it is a number or string in the JSON, but it will be converted to a string within pytiled-parser if it comes in as a float. + ## [1.4.0] - 2021-04-25 - Fixes issues with image loading for external tilesets. Previously, if an external tileset was in a different directory than the map file, image paths for the tileset would be incorrect. This was due to all images being given relative paths to the map file, regardless of if they were for an external tileset. This has been solved by giving absolute paths for images from external tilesets. Relative paths for embedded tilesets is still fine as the tileset is part of the map file. diff --git a/pytiled_parser/layer.py b/pytiled_parser/layer.py index 58bcc98f..ede3375a 100644 --- a/pytiled_parser/layer.py +++ b/pytiled_parser/layer.py @@ -402,7 +402,9 @@ def _cast_tile_layer(raw_layer: RawLayer) -> TileLayer: return tile_layer -def _cast_object_layer(raw_layer: RawLayer) -> ObjectLayer: +def _cast_object_layer( + raw_layer: RawLayer, parent_dir: Optional[Path] = None +) -> ObjectLayer: """Cast the raw_layer to an ObjectLayer. Args: @@ -413,7 +415,7 @@ def _cast_object_layer(raw_layer: RawLayer) -> ObjectLayer: tiled_objects = [] for tiled_object_ in raw_layer["objects"]: - tiled_objects.append(tiled_object.cast(tiled_object_)) + tiled_objects.append(tiled_object.cast(tiled_object_, parent_dir)) return ObjectLayer( tiled_objects=tiled_objects, @@ -441,7 +443,9 @@ def _cast_image_layer(raw_layer: RawLayer) -> ImageLayer: return image_layer -def _cast_group_layer(raw_layer: RawLayer) -> LayerGroup: +def _cast_group_layer( + raw_layer: RawLayer, parent_dir: Optional[Path] = None +) -> LayerGroup: """Cast the raw_layer to a LayerGroup. Args: @@ -454,7 +458,7 @@ def _cast_group_layer(raw_layer: RawLayer) -> LayerGroup: layers = [] for layer in raw_layer["layers"]: - layers.append(cast(layer)) + layers.append(cast(layer, parent_dir)) return LayerGroup(layers=layers, **_get_common_attributes(raw_layer).__dict__) @@ -477,7 +481,7 @@ def _get_caster(type_: str) -> Callable[[RawLayer], Layer]: return casters[type_] -def cast(raw_layer: RawLayer) -> Layer: +def cast(raw_layer: RawLayer, parent_dir: Optional[Path] = None) -> Layer: """Cast a raw Tiled layer into a pytiled_parser type. This function will determine the type of layer and cast accordingly. @@ -490,4 +494,10 @@ def cast(raw_layer: RawLayer) -> Layer: """ caster = _get_caster(raw_layer["type"]) - return caster(raw_layer) + if ( + caster.__name__ == "_cast_object_layer" + or caster.__name__ == "_cast_group_layer" + ): + return caster(raw_layer, parent_dir) + else: + return caster(raw_layer) diff --git a/pytiled_parser/template.py b/pytiled_parser/template.py deleted file mode 100644 index c6d58d82..00000000 --- a/pytiled_parser/template.py +++ /dev/null @@ -1,8 +0,0 @@ -# pylint: disable=too-few-public-methods - -import attr - - -@attr.s(auto_attribs=True) -class Template: - """FIXME TODO""" diff --git a/pytiled_parser/tiled_map.py b/pytiled_parser/tiled_map.py index 3ef206ce..ce8975a5 100644 --- a/pytiled_parser/tiled_map.py +++ b/pytiled_parser/tiled_map.py @@ -60,7 +60,7 @@ class TiledMap: tiled_version: str tile_size: Size tilesets: TilesetDict - version: float + version: str map_file: Optional[Path] = None background_color: Optional[Color] = None @@ -102,7 +102,7 @@ class _RawTiledMap(TypedDict): tilesets: List[_RawTilesetMapping] tilewidth: int type: str - version: float + version: Union[str, float] width: int @@ -139,11 +139,16 @@ def parse_map(file: Path) -> TiledMap: raw_tileset = typing_cast(RawTileSet, raw_tileset) tilesets[raw_tileset["firstgid"]] = tileset.cast(raw_tileset) + if isinstance(raw_tiled_map["version"], float): + version = str(raw_tiled_map["version"]) + else: + version = raw_tiled_map["version"] + # `map` is a built-in function map_ = TiledMap( map_file=file, infinite=raw_tiled_map["infinite"], - layers=[layer.cast(layer_) for layer_ in raw_tiled_map["layers"]], + layers=[layer.cast(layer_, parent_dir) for layer_ in raw_tiled_map["layers"]], map_size=Size(raw_tiled_map["width"], raw_tiled_map["height"]), next_layer_id=raw_tiled_map["nextlayerid"], next_object_id=raw_tiled_map["nextobjectid"], @@ -152,7 +157,7 @@ def parse_map(file: Path) -> TiledMap: tiled_version=raw_tiled_map["tiledversion"], tile_size=Size(raw_tiled_map["tilewidth"], raw_tiled_map["tileheight"]), tilesets=tilesets, - version=raw_tiled_map["version"], + version=version, ) if raw_tiled_map.get("backgroundcolor") is not None: diff --git a/pytiled_parser/tiled_object.py b/pytiled_parser/tiled_object.py index f4d95f49..4c4c6497 100644 --- a/pytiled_parser/tiled_object.py +++ b/pytiled_parser/tiled_object.py @@ -1,5 +1,6 @@ # pylint: disable=too-few-public-methods - +import json +from pathlib import Path from typing import Callable, Dict, List, Optional, Union import attr @@ -174,6 +175,7 @@ class RawTiledObject(TypedDict): id: int gid: int + template: str x: float y: float width: float @@ -390,7 +392,9 @@ def _get_caster( return _cast_rectangle -def cast(raw_tiled_object: RawTiledObject) -> TiledObject: +def cast( + raw_tiled_object: RawTiledObject, parent_dir: Optional[Path] = None +) -> TiledObject: """Cast the raw tiled object into a pytiled_parser type Args: @@ -399,6 +403,18 @@ def cast(raw_tiled_object: RawTiledObject) -> TiledObject: Returns: TiledObject: a properly typed Tiled object. """ + if raw_tiled_object.get("template"): + if not parent_dir: + raise RuntimeError( + "A parent directory must be specified when using object templates" + ) + template_path = Path(parent_dir / raw_tiled_object["template"]) + with open(template_path) as raw_template_file: + loaded_template = json.load(raw_template_file)["object"] + for key in loaded_template: + if key != "id": + raw_tiled_object[key] = loaded_template[key] # type: ignore + caster = _get_caster(raw_tiled_object) tiled_object = caster(raw_tiled_object) diff --git a/pytiled_parser/tileset.py b/pytiled_parser/tileset.py index 516d4c69..68fb8bc0 100644 --- a/pytiled_parser/tileset.py +++ b/pytiled_parser/tileset.py @@ -1,6 +1,6 @@ # pylint: disable=too-few-public-methods from pathlib import Path -from typing import Dict, List, NamedTuple, Optional +from typing import Dict, List, NamedTuple, Optional, Union import attr from typing_extensions import TypedDict @@ -9,6 +9,8 @@ from . import properties as properties_ from .common_types import Color, OrderedPair from .util import parse_color +from .wang_set import RawWangSet, WangSet +from .wang_set import cast as cast_wangset class Grid(NamedTuple): @@ -29,39 +31,6 @@ class Grid(NamedTuple): height: int -class Terrain(NamedTuple): - """Terrain object. - - Args: - name: The name of the terrain type. - tile: The local tile-id of the tile that represents the terrain visually. - """ - - name: str - tile: int - properties: Optional[properties_.Properties] = None - - -@attr.s(auto_attribs=True) -class TileTerrain: - """Defines each corner of a tile by Terrain index in - 'TileSet.terrain_types'. - - Defaults to 'None'. 'None' means that corner has no terrain. - - Attributes: - top_left: Top left terrain type. - top_right: Top right terrain type. - bottom_left: Bottom left terrain type. - bottom_right: Bottom right terrain type. - """ - - top_left: Optional[int] = None - top_right: Optional[int] = None - bottom_left: Optional[int] = None - bottom_right: Optional[int] = None - - class Frame(NamedTuple): """Animation Frame object. @@ -77,6 +46,27 @@ class Frame(NamedTuple): duration: int +@attr.s(auto_attribs=True, kw_only=True) +class Transformations: + """Transformations Object. + + This is used to store what transformations may be performed on Tiles + within a tileset. (This is primarily used with wang sets, however could + be used for any means a game wants really.) + + Args: + hflip: Allow horizontal flip? + vflip: Allow vertical flip? + rotate: Allow rotation? + prefer_untransformed: Should untransformed tiles be preferred? + """ + + hflip: Optional[bool] = None + vflip: Optional[bool] = None + rotate: Optional[bool] = None + prefer_untransformed: Optional[bool] = None + + @attr.s(auto_attribs=True, kw_only=True) class Tile: # FIXME: args @@ -95,7 +85,6 @@ class Tile: id: int opacity: int = 1 type: Optional[str] = None - terrain: Optional[TileTerrain] = None animation: Optional[List[Frame]] = None objects: Optional[layer.Layer] = None image: Optional[Path] = None @@ -127,9 +116,6 @@ class Tileset: tileoffset: Used to specify an offset in pixels when drawing a tile from the tileset. When not present, no offset is applied. image: Used for spritesheet tile sets. - terrain_types: List of of terrain types which can be referenced from the - terrain attribute of the tile object. Ordered according to the terrain - element's appearance in the TSX file. tiles: Dict of Tile objects by Tile.id. tsx_file: Path of the file containing the tileset, None if loaded internally from a map @@ -144,26 +130,28 @@ class Tileset: tile_count: int columns: int + type: str = "tileset" + spacing: int = 0 margin: int = 0 - type: Optional[str] = None - tiled_version: Optional[str] = None - version: Optional[float] = None + version: Optional[str] = None image: Optional[Path] = None image_width: Optional[int] = None image_height: Optional[int] = None + transformations: Optional[Transformations] = None + firstgid: Optional[int] = None background_color: Optional[Color] = None tile_offset: Optional[OrderedPair] = None transparent_color: Optional[Color] = None grid: Optional[Grid] = None properties: Optional[properties_.Properties] = None - terrain_types: Optional[List[Terrain]] = None tiles: Optional[Dict[int, Tile]] = None + wang_sets: Optional[List[WangSet]] = None class RawFrame(TypedDict): @@ -180,12 +168,13 @@ class RawTileOffset(TypedDict): y: int -class RawTerrain(TypedDict): - """ The keys and their types that appear in a Terrain JSON Object.""" +class RawTransformations(TypedDict): + """ The keys and their types that appear in a Transformations JSON Object.""" - name: str - properties: List[properties_.RawProperty] - tile: int + hflip: bool + vflip: bool + rotate: bool + preferuntransformed: bool class RawTile(TypedDict): @@ -199,7 +188,6 @@ class RawTile(TypedDict): opacity: float properties: List[properties_.RawProperty] objectgroup: layer.RawLayer - terrain: List[int] type: str @@ -226,7 +214,6 @@ class RawTileSet(TypedDict): properties: List[properties_.RawProperty] source: str spacing: int - terrains: List[RawTerrain] tilecount: int tiledversion: str tileheight: int @@ -234,8 +221,9 @@ class RawTileSet(TypedDict): tiles: List[RawTile] tilewidth: int transparentcolor: str - type: str - version: float + transformations: RawTransformations + version: Union[str, float] + wangsets: List[RawWangSet] def _cast_frame(raw_frame: RawFrame) -> Frame: @@ -264,29 +252,6 @@ def _cast_tile_offset(raw_tile_offset: RawTileOffset) -> OrderedPair: return OrderedPair(raw_tile_offset["x"], raw_tile_offset["y"]) -def _cast_terrain(raw_terrain: RawTerrain) -> Terrain: - """Cast the raw_terrain to a Terrain object. - - Args: - raw_terrain: RawTerrain to be casted to a Terrain - - Returns: - Terrain: The Terrain created from the raw_terrain - """ - - if raw_terrain.get("properties") is not None: - return Terrain( - name=raw_terrain["name"], - tile=raw_terrain["tile"], - properties=properties_.cast(raw_terrain["properties"]), - ) - else: - return Terrain( - name=raw_terrain["name"], - tile=raw_terrain["tile"], - ) - - def _cast_tile(raw_tile: RawTile, external_path: Optional[Path] = None) -> Tile: """Cast the raw_tile to a Tile object. @@ -323,22 +288,30 @@ def _cast_tile(raw_tile: RawTile, external_path: Optional[Path] = None) -> Tile: if raw_tile.get("imageheight") is not None: tile.image_height = raw_tile["imageheight"] - if raw_tile.get("terrain") is not None: - raw_terrain = raw_tile["terrain"] - terrain = TileTerrain( - top_left=raw_terrain[0], - top_right=raw_terrain[1], - bottom_left=raw_terrain[2], - bottom_right=raw_terrain[3], - ) - tile.terrain = terrain - if raw_tile.get("type") is not None: tile.type = raw_tile["type"] return tile +def _cast_transformations(raw_transformations: RawTransformations) -> Transformations: + """Cast the raw_transformations to a Transformations object. + + Args: + raw_transformations: RawTransformations to be casted to a Transformations + + Returns: + Transformations: The Transformations created from the raw_transformations + """ + + return Transformations( + hflip=raw_transformations["hflip"], + vflip=raw_transformations["vflip"], + rotate=raw_transformations["rotate"], + prefer_untransformed=raw_transformations["preferuntransformed"], + ) + + def _cast_grid(raw_grid: RawGrid) -> Grid: """Cast the raw_grid to a Grid object. @@ -361,6 +334,7 @@ def cast(raw_tileset: RawTileSet, external_path: Optional[Path] = None) -> Tiles Args: raw_tileset: Raw Tileset to be cast. + external_path: The path to the tileset if it is not an embedded one. Returns: TileSet: a properly typed TileSet. @@ -376,11 +350,11 @@ def cast(raw_tileset: RawTileSet, external_path: Optional[Path] = None) -> Tiles margin=raw_tileset["margin"], ) - if raw_tileset.get("type") is not None: - tileset.type = raw_tileset["type"] - if raw_tileset.get("version") is not None: - tileset.version = raw_tileset["version"] + if isinstance(raw_tileset["version"], float): + tileset.version = str(raw_tileset["version"]) + else: + tileset.version = raw_tileset["version"] if raw_tileset.get("tiledversion") is not None: tileset.tiled_version = raw_tileset["tiledversion"] @@ -417,16 +391,19 @@ def cast(raw_tileset: RawTileSet, external_path: Optional[Path] = None) -> Tiles if raw_tileset.get("properties") is not None: tileset.properties = properties_.cast(raw_tileset["properties"]) - if raw_tileset.get("terrains") is not None: - terrains = [] - for raw_terrain in raw_tileset["terrains"]: - terrains.append(_cast_terrain(raw_terrain)) - tileset.terrain_types = terrains - if raw_tileset.get("tiles") is not None: tiles = {} for raw_tile in raw_tileset["tiles"]: tiles[raw_tile["id"]] = _cast_tile(raw_tile, external_path=external_path) tileset.tiles = tiles + if raw_tileset.get("wangsets") is not None: + wangsets = [] + for raw_wangset in raw_tileset["wangsets"]: + wangsets.append(cast_wangset(raw_wangset)) + tileset.wang_sets = wangsets + + if raw_tileset.get("transformations") is not None: + tileset.transformations = _cast_transformations(raw_tileset["transformations"]) + return tileset diff --git a/pytiled_parser/version.py b/pytiled_parser/version.py index fc98b8c6..b16a143e 100644 --- a/pytiled_parser/version.py +++ b/pytiled_parser/version.py @@ -1,3 +1,3 @@ """pytiled_parser version""" -__version__ = "1.4.0" +__version__ = "1.5.0" diff --git a/pytiled_parser/wang_set.py b/pytiled_parser/wang_set.py index 04ef5596..011410fe 100644 --- a/pytiled_parser/wang_set.py +++ b/pytiled_parser/wang_set.py @@ -1,36 +1,38 @@ -from typing import List, NamedTuple, Optional +from typing import Dict, List, Optional import attr from typing_extensions import TypedDict from . import properties as properties_ -from .common_types import Color, OrderedPair +from .common_types import Color +from .util import parse_color -class WangTile(NamedTuple): +@attr.s(auto_attribs=True) +class WangTile: - id: int - dflip: bool = False - hflip: bool = False - vflip: bool = False - wang_ids: List[int] = [] + tile_id: int + wang_id: List[int] -class WangColor(NamedTuple): +@attr.s(auto_attribs=True) +class WangColor: color: Color name: str probability: float tile: int + properties: Optional[properties_.Properties] = None -class WangSet(NamedTuple): +@attr.s(auto_attribs=True) +class WangSet: - cornercolors: List[WangColor] - edgecolors: List[WangColor] name: str tile: int - wang_tiles: List[WangTile] + wang_type: str + wang_tiles: Dict[int, WangTile] + wang_colors: List[WangColor] properties: Optional[properties_.Properties] = None @@ -38,9 +40,8 @@ class RawWangTile(TypedDict): """ The keys and their types that appear in a Wang Tile JSON Object.""" tileid: int - dflip: bool - hflip: bool - vflip: bool + # Tiled stores these IDs as a list represented like so: + # [top, top_right, right, bottom_right, bottom, bottom_left, left, top_left] wangid: List[int] @@ -51,7 +52,81 @@ class RawWangColor(TypedDict): name: str probability: float tile: int + properties: List[properties_.RawProperty] class RawWangSet(TypedDict): """ The keys and their types that appear in a Wang Set JSON Object.""" + + colors: List[RawWangColor] + name: str + properties: List[properties_.RawProperty] + tile: int + type: str + wangtiles: List[RawWangTile] + + +def _cast_wang_tile(raw_wang_tile: RawWangTile) -> WangTile: + """Cast the raw wang tile into a pytiled_parser type + + Args: + raw_wang_tile: RawWangTile to be cast. + + Returns: + WangTile: A properly typed WangTile. + """ + return WangTile(tile_id=raw_wang_tile["tileid"], wang_id=raw_wang_tile["wangid"]) + + +def _cast_wang_color(raw_wang_color: RawWangColor) -> WangColor: + """Cast the raw wang color into a pytiled_parser type + + Args: + raw_wang_color: RawWangColor to be cast. + + Returns: + WangColor: A properly typed WangColor. + """ + wang_color = WangColor( + name=raw_wang_color["name"], + color=parse_color(raw_wang_color["color"]), + tile=raw_wang_color["tile"], + probability=raw_wang_color["probability"], + ) + + if raw_wang_color.get("properties") is not None: + wang_color.properties = properties_.cast(raw_wang_color["properties"]) + + return wang_color + + +def cast(raw_wangset: RawWangSet) -> WangSet: + """Cast the raw wangset into a pytiled_parser type + + Args: + raw_wangset: Raw Wangset to be cast. + + Returns: + WangSet: A properly typed WangSet. + """ + + colors = [] + for raw_wang_color in raw_wangset["colors"]: + colors.append(_cast_wang_color(raw_wang_color)) + + tiles = {} + for raw_wang_tile in raw_wangset["wangtiles"]: + tiles[raw_wang_tile["tileid"]] = _cast_wang_tile(raw_wang_tile) + + wangset = WangSet( + name=raw_wangset["name"], + tile=raw_wangset["tile"], + wang_type=raw_wangset["type"], + wang_colors=colors, + wang_tiles=tiles, + ) + + if raw_wangset.get("properties") is not None: + wangset.properties = properties_.cast(raw_wangset["properties"]) + + return wangset diff --git a/pytiled_parser/world.py b/pytiled_parser/world.py new file mode 100644 index 00000000..5d35322f --- /dev/null +++ b/pytiled_parser/world.py @@ -0,0 +1,141 @@ +import json +import re +from os import listdir +from os.path import isfile, join +from pathlib import Path +from typing import List + +import attr +from typing_extensions import TypedDict + +from .common_types import OrderedPair, Size +from .tiled_map import TiledMap, parse_map + + +@attr.s(auto_attribs=True) +class WorldMap: + + tiled_map: TiledMap + size: Size + coordinates: OrderedPair + + +@attr.s(auto_attribs=True) +class World: + + maps: List[WorldMap] + only_show_adjacent: bool = False + + +class RawPattern(TypedDict): + """The keys and their types that appear in a Pattern JSON Object.""" + + regexp: str + multiplierX: float + multiplierY: float + offsetX: float + offsetY: float + + +class RawWorldMap(TypedDict): + """The keys and their types that appear in a WorldMap JSON Object.""" + + fileName: str + height: float + width: float + x: float + y: float + + +class RawWorld(TypedDict): + """The keys and their types that appear in a World JSON Object.""" + + maps: List[RawWorldMap] + patterns: List[RawPattern] + onlyShowAdjacentMaps: bool + + +def _cast_world_map(raw_world_map: RawWorldMap, map_file: Path) -> WorldMap: + """Parse the RawWorldMap into a WorldMap. + + Args: + raw_world_map: The RawWorldMap to parse + map_file: The file of tiled_map to parse + + Returns: + WorldMap: The parsed WorldMap object + """ + tiled_map = parse_map(map_file) + + return WorldMap( + tiled_map=tiled_map, + size=Size(raw_world_map["width"], raw_world_map["height"]), + coordinates=OrderedPair(raw_world_map["x"], raw_world_map["y"]), + ) + + +def parse_world(file: Path) -> World: + """Parse the raw world into a pytiled_parser type + + Args: + file: Path to the world's file + + Returns: + World: A properly parsed World + """ + + with open(file) as world_file: + raw_world = json.load(world_file) + + parent_dir = file.parent + + maps: List[WorldMap] = [] + + if raw_world.get("maps"): + for raw_map in raw_world["maps"]: + map_path = Path(parent_dir / raw_map["fileName"]) + maps.append(_cast_world_map(raw_map, map_path)) + + if raw_world.get("patterns"): + for raw_pattern in raw_world["patterns"]: + regex = re.compile(raw_pattern["regexp"]) + map_files = [ + f + for f in listdir(parent_dir) + if isfile(join(parent_dir, f)) and regex.match(f) + ] + for map_file in map_files: + search = regex.search(map_file) + if search: + width = raw_pattern["multiplierX"] + height = raw_pattern["multiplierY"] + + offset_x = 0 + offset_y = 0 + + if raw_pattern.get("offsetX"): + offset_x = raw_pattern["offsetX"] + + if raw_pattern.get("offsetY"): + offset_y = raw_pattern["offsetY"] + + x = (float(search.group(1)) * width) + offset_x + y = (float(search.group(2)) * height) + offset_y + + raw_world_map: RawWorldMap = { + "fileName": map_file, + "width": width, + "height": height, + "x": x, + "y": y, + } + + map_path = Path(parent_dir / map_file) + maps.append(_cast_world_map(raw_world_map, map_path)) + + world = World(maps=maps) + + if raw_world.get("onlyShowAdjacentMaps"): + world.only_show_adjacent = raw_world["onlyShowAdjacentMaps"] + + return world diff --git a/tests/test_data/example_maps/all_objects/all_objects.json b/tests/test_data/example_maps/all_objects/all_objects.json deleted file mode 100644 index c75c2eaa..00000000 --- a/tests/test_data/example_maps/all_objects/all_objects.json +++ /dev/null @@ -1,649 +0,0 @@ -{ - "compressionlevel": 0, - "editorsettings": { - "export": { - "target": "." - } - }, - "height": 6, - "infinite": false, - "layers": [ - { - "data": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48 - ], - "height": 6, - "id": 1, - "name": "Tile Layer 1", - "opacity": 1, - "type": "tilelayer", - "visible": true, - "width": 8, - "x": 0, - "y": 0 - }, - { - "draworder": "topdown", - "id": 2, - "name": "Object Layer 1", - "objects": [ - { - "height": 41.4686825053996, - "id": 1, - "name": "name: rectangle", - "rotation": 0, - "type": "rectangle", - "visible": true, - "width": 45.3972945322269, - "x": 27.7185404115039, - "y": 23.571672160964 - }, - { - "height": 0, - "id": 2, - "name": "name: point", - "point": true, - "rotation": 0, - "type": "point", - "visible": true, - "width": 0, - "x": 159.981811981357, - "y": 82.9373650107991 - }, - { - "height": 0, - "id": 3, - "name": "name: point invisible", - "point": true, - "rotation": 0, - "type": "point", - "visible": false, - "width": 0, - "x": 109.346368080027, - "y": 95.8144822098443 - }, - { - "height": 32.7384335568944, - "id": 4, - "name": "name: rectangle - invisible", - "rotation": 0, - "type": "rectangle", - "visible": false, - "width": 30.9923837671934, - "x": 163.910424008185, - "y": 91.0128452881664 - }, - { - "height": 22, - "id": 5, - "name": "name: rectangle - rotated", - "rotation": 10, - "type": "rectangle", - "visible": true, - "width": 10, - "x": 183.335227918609, - "y": 23.3534159372513 - }, - { - "ellipse": true, - "height": 18.5517790155735, - "id": 6, - "name": "name: ellipse", - "rotation": 0, - "type": "ellipse", - "visible": true, - "width": 57.4013868364215, - "x": 37.5400704785722, - "y": 81.1913152210981 - }, - { - "ellipse": true, - "height": 31.4288962146186, - "id": 7, - "name": "name: ellipse - invisible", - "rotation": 0, - "type": "ellipse", - "visible": false, - "width": 6.32943048766625, - "x": 22.6986472661134, - "y": 53.9092872570194 - }, - { - "ellipse": true, - "height": 24.2264408321018, - "id": 8, - "name": "name: ellipse - rotated", - "rotation": 111, - "type": "ellipse", - "visible": true, - "width": 29.6828464249176, - "x": 35.7940206888712, - "y": 120.040923041946 - }, - { - "height": 0, - "id": 9, - "name": "name: polygon", - "polygon": [ - { - "x": 0, - "y": 0 - }, - { - "x": 19.424803910424, - "y": 27.063771740366 - }, - { - "x": 19.6430601341366, - "y": 3.05558713197681 - }, - { - "x": -2.61907468455156, - "y": 15.9327043310219 - }, - { - "x": 25.317721950665, - "y": 16.3692167784472 - } - ], - "rotation": 0, - "type": "polygon", - "visible": true, - "width": 0, - "x": 89.485051722178, - "y": 38.6313515971354 - }, - { - "height": 0, - "id": 10, - "name": "name: polygon - invisible", - "polygon": [ - { - "x": 0, - "y": 0 - }, - { - "x": -12.8771171990451, - "y": 7.63896782994203 - }, - { - "x": -14.8414232124588, - "y": -10.2580425144936 - } - ], - "rotation": 0, - "type": "polygon", - "visible": false, - "width": 0, - "x": 133.791065135842, - "y": 24.4446970558145 - }, - { - "height": 0, - "id": 11, - "name": "name: polygon - rotated", - "polygon": [ - { - "x": 0, - "y": 0 - }, - { - "x": -12.8771171990451, - "y": 0 - }, - { - "x": -6.98419915880413, - "y": 7.63896782994203 - }, - { - "x": -13.9683983176083, - "y": 16.8057292258725 - }, - { - "x": 3.71035580311468, - "y": 15.277935659884 - }, - { - "x": -3.71035580311471, - "y": 8.29373650107991 - } - ], - "rotation": 123, - "type": "polygon", - "visible": true, - "width": 0, - "x": 152.779356598841, - "y": 19.8613163578493 - }, - { - "height": 0, - "id": 12, - "name": "name: polyline", - "polyline": [ - { - "x": 0, - "y": 0 - }, - { - "x": -13.3136296464704, - "y": 41.0321700579743 - }, - { - "x": 21.3891099238377, - "y": 16.8057292258725 - } - ], - "rotation": 0, - "type": "polyline", - "visible": true, - "width": 0, - "x": 124.187791292486, - "y": 90.1398203933159 - }, - { - "height": 0, - "id": 31, - "name": "name: polyline - invisible", - "polyline": [ - { - "x": 0, - "y": 0 - }, - { - "x": -9, - "y": 20.3333333333333 - }, - { - "x": 5, - "y": 23.6666666666667 - } - ], - "rotation": 0, - "type": "polyline", - "visible": false, - "width": 0, - "x": 140, - "y": 163.333333333333 - }, - { - "height": 0, - "id": 32, - "name": "name: polyline - rotated", - "polyline": [ - { - "x": 0, - "y": 0 - }, - { - "x": 10.3333333333333, - "y": 13 - }, - { - "x": -5.33333333333331, - "y": 19.6666666666667 - } - ], - "rotation": 0, - "type": "polyline", - "visible": true, - "width": 0, - "x": 192.333333333333, - "y": 128.666666666667 - }, - { - "gid": 79, - "height": 32, - "id": 13, - "name": "name: tile", - "rotation": 0, - "type": "tile", - "visible": true, - "width": 32, - "x": 111.898147095601, - "y": 48.3019211094691 - }, - { - "gid": 80, - "height": 32, - "id": 14, - "name": "name: tile - invisible", - "rotation": 0, - "type": "tile", - "visible": false, - "width": 32, - "x": 41.1831306127089, - "y": 168.779356598841 - }, - { - "gid": 2147483742, - "height": 32, - "id": 15, - "name": "name: tile - horizontal flipped", - "rotation": 0, - "type": "tile", - "visible": true, - "width": 32, - "x": 197.236330567239, - "y": 59.8695009662385 - }, - { - "gid": 1073741918, - "height": 32, - "id": 16, - "name": "name: tile - vertical flipped", - "rotation": 0, - "type": "tile", - "visible": true, - "width": 32, - "x": 32.4528816642037, - "y": 60.742525861089 - }, - { - "gid": 3221225558, - "height": 32, - "id": 17, - "name": "name: tile - both flipped", - "rotation": 0, - "type": "tile", - "visible": true, - "width": 32, - "x": 167.553484142321, - "y": 95.6635216551097 - }, - { - "gid": 86, - "height": 32, - "id": 18, - "name": "name: tile - rotated", - "rotation": 89, - "type": "tile", - "visible": true, - "width": 32, - "x": 85.65, - "y": 142.62 - }, - { - "height": 19, - "id": 19, - "name": "name: text", - "rotation": 0, - "text": { - "text": "Hello World", - "wrap": true - }, - "type": "text", - "visible": true, - "width": 92.375, - "x": 81.7106470956008, - "y": 93.2986813686484 - }, - { - "height": 19, - "id": 20, - "name": "name: text - invisible", - "rotation": 0, - "text": { - "text": "Hello World", - "wrap": true - }, - "type": "text", - "visible": false, - "width": 92.375, - "x": 8.37655592815732, - "y": 112.068716607935 - }, - { - "height": 19, - "id": 21, - "name": "name: text - rotated", - "rotation": 19, - "text": { - "text": "Hello World", - "wrap": true - }, - "type": "text", - "visible": true, - "width": 92.375, - "x": 157.882069171308, - "y": 78.4572581561896 - }, - { - "height": 19, - "id": 22, - "name": "name: text - different font", - "rotation": 0, - "text": { - "bold": true, - "fontfamily": "DejaVu Sans", - "pixelsize": 19, - "text": "Hello World", - "wrap": true - }, - "type": "text", - "visible": true, - "width": 92.375, - "x": 2.70189411162896, - "y": 101.592417869728 - }, - { - "height": 19, - "id": 23, - "name": "name: text - no word wrap", - "rotation": 0, - "text": { - "text": "Hello World" - }, - "type": "text", - "visible": true, - "width": 92.375, - "x": 9.90434949414573, - "y": 154.192167784472 - }, - { - "height": 19, - "id": 24, - "name": "name: text - right bottom align", - "rotation": 0, - "text": { - "halign": "right", - "text": "Hello World", - "valign": "bottom", - "wrap": true - }, - "type": "text", - "visible": true, - "width": 92.375, - "x": 151.989151131067, - "y": 1.19455496191883 - }, - { - "height": 19, - "id": 25, - "name": "text: center center align", - "rotation": 0, - "text": { - "halign": "center", - "text": "Hello World", - "valign": "center", - "wrap": true - }, - "type": "text", - "visible": true, - "width": 92.375, - "x": 4.22968767761736, - "y": 3.81362964647039 - }, - { - "height": 19, - "id": 26, - "name": "name: text - justified", - "rotation": 0, - "text": { - "halign": "justify", - "text": "Hello World", - "wrap": true - }, - "type": "text", - "visible": true, - "width": 92.375, - "x": 13.8329615209731, - "y": 60.7785040354666 - }, - { - "height": 19, - "id": 27, - "name": "name: text - red", - "rotation": 0, - "text": { - "color": "#aa0000", - "text": "Hello World", - "wrap": true - }, - "type": "text", - "visible": true, - "width": 92.375, - "x": 96.3338140843469, - "y": 130.620495623508 - }, - { - "height": 0, - "id": 28, - "name": "name: rectangle - no width or height", - "rotation": 0, - "type": "rectangle", - "visible": true, - "width": 0, - "x": 131.17199045129, - "y": 53.4727748095942 - }, - { - "ellipse": true, - "height": 0, - "id": 29, - "name": "name: ellipse - no width or height", - "rotation": 0, - "type": "ellipse", - "visible": true, - "width": 0, - "x": 72.4610662725929, - "y": 127.679890871888 - }, - { - "height": 13.7501420938956, - "id": 30, - "name": "name: rectangle - properties", - "properties": [ - { - "name": "bool property", - "type": "bool", - "value": false - }, - { - "name": "color property", - "type": "color", - "value": "#ffaa0000" - }, - { - "name": "file property", - "type": "file", - "value": "../../../../../../dev/null" - }, - { - "name": "float property", - "type": "float", - "value": 42.1 - }, - { - "name": "int property", - "type": "int", - "value": 8675309 - }, - { - "name": "string property", - "type": "string", - "value": "pytiled_parser rulez!1!!" - } - ], - "rotation": 0, - "type": "rectangle", - "visible": true, - "width": 21.170853700125, - "x": 39.0678640445606, - "y": 131.826759122428 - } - ], - "opacity": 1, - "type": "objectgroup", - "visible": true, - "x": 0, - "y": 0 - } - ], - "nextlayerid": 3, - "nextobjectid": 33, - "orientation": "orthogonal", - "renderorder": "right-down", - "tiledversion": "1.3.5", - "tileheight": 32, - "tilesets": [ - { - "firstgid": 1, - "source": "tileset_image_objects.json" - }, - { - "firstgid": 49, - "source": "tileset_image.json" - } - ], - "tilewidth": 32, - "type": "map", - "version": 1.2, - "width": 8 -} diff --git a/tests/test_data/example_maps/all_objects/tileset_image_objects.json b/tests/test_data/example_maps/all_objects/tileset_image_objects.json deleted file mode 100644 index 6ed02876..00000000 --- a/tests/test_data/example_maps/all_objects/tileset_image_objects.json +++ /dev/null @@ -1,192 +0,0 @@ -{ "columns":8, - "image":"..\/..\/images\/tmw_desert_spacing.png", - "imageheight":199, - "imagewidth":265, - "margin":1, - "name":"tile_set_image", - "spacing":1, - "tilecount":5, - "tiledversion":"1.3.1", - "tileheight":32, - "tiles":[ - { - "id":9, - "objectgroup": - { - "draworder":"index", - "name":"", - "objects":[ - { - "height":32, - "id":2, - "name":"wall", - "rotation":1, - "type":"rectangle type", - "visible":true, - "width":32, - "x":1, - "y":1 - }], - "opacity":1, - "type":"objectgroup", - "visible":true, - "x":0, - "y":0 - } - }, - { - "id":19, - "objectgroup": - { - "draworder":"index", - "name":"", - "objects":[ - { - "height":0, - "id":1, - "name":"wall corner", - "polygon":[ - { - "x":0, - "y":0 - }, - { - "x":-32, - "y":0 - }, - { - "x":-32, - "y":32 - }, - { - "x":-16, - "y":32.1818 - }, - { - "x":-15.8182, - "y":16.9091 - }, - { - "x":0.181818, - "y":17.0909 - }], - "rotation":1, - "type":"polygon type", - "visible":true, - "width":0, - "x":32, - "y":1 - }], - "opacity":1, - "type":"objectgroup", - "visible":true, - "x":0, - "y":0 - } - }, - { - "id":20, - "objectgroup": - { - "draworder":"index", - "name":"", - "objects":[ - { - "height":0, - "id":1, - "name":"polyline", - "polyline":[ - { - "x":0, - "y":0 - }, - { - "x":25.0909, - "y":21.2727 - }, - { - "x":9.63636, - "y":28.3636 - }], - "rotation":1, - "type":"polyline type", - "visible":true, - "width":0, - "x":1.45455, - "y":1.45455 - }], - "opacity":1, - "type":"objectgroup", - "visible":true, - "x":0, - "y":0 - } - }, - { - "id":31, - "objectgroup": - { - "draworder":"index", - "name":"", - "objects":[ - { - "ellipse":true, - "height":19.2727, - "id":1, - "name":"rock 1", - "rotation":1, - "type":"elipse type", - "visible":true, - "width":19.6364, - "x":5.09091, - "y":2.54545 - }, - { - "ellipse":true, - "height":8.36364, - "id":2, - "name":"rock 2", - "rotation":-1, - "type":"elipse type", - "visible":true, - "width":8.54545, - "x":16.1818, - "y":22 - }], - "opacity":1, - "type":"objectgroup", - "visible":true, - "x":0, - "y":0 - } - }, - { - "id":45, - "objectgroup": - { - "draworder":"index", - "name":"", - "objects":[ - { - "height":0, - "id":1, - "name":"sign", - "point":true, - "rotation":0, - "type":"point type", - "visible":true, - "width":0, - "x":14.7273, - "y":26.3636 - }], - "opacity":1, - "type":"objectgroup", - "visible":true, - "x":0, - "y":0 - } - }], - "tilewidth":32, - "type":"tileset", - "version":1.2 -} diff --git a/tests/test_data/example_maps/simple_infinite/map_infinite.json b/tests/test_data/example_maps/simple_infinite/map_infinite.json deleted file mode 100644 index 2543f7b2..00000000 --- a/tests/test_data/example_maps/simple_infinite/map_infinite.json +++ /dev/null @@ -1,195 +0,0 @@ -{ "compressionlevel":0, - "height":6, - "infinite":true, - "layers":[ - { - "chunks":[ - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":-32, - "y":-32 - }, - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":-16, - "y":-32 - }, - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":0, - "y":-32 - }, - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":16, - "y":-32 - }, - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":-32, - "y":-16 - }, - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 1, 2, 3, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 9, 10, 11, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 17, 18, 19], - "height":16, - "width":16, - "x":-16, - "y":-16 - }, - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 4, 5, 6, 7, 8, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 12, 13, 14, 15, 16, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 20, 21, 22, 23, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":0, - "y":-16 - }, - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":16, - "y":-16 - }, - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":-32, - "y":0 - }, - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 25, 26, 27, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 33, 34, 35, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 41, 42, 43, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":-16, - "y":0 - }, - { - "data":[28, 29, 30, 31, 32, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 36, 37, 38, 39, 40, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 44, 45, 46, 47, 48, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":0, - "y":0 - }, - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":16, - "y":0 - }, - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":-32, - "y":16 - }, - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":-16, - "y":16 - }, - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":0, - "y":16 - }, - { - "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - "height":16, - "width":16, - "x":16, - "y":16 - }], - "height":64, - "id":1, - "name":"Tile Layer 1", - "opacity":1, - "startx":-32, - "starty":-32, - "type":"tilelayer", - "visible":true, - "width":64, - "x":0, - "y":0 - }, - { - "chunks":[ - { - "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - "height":16, - "width":16, - "x":-32, - "y":-16 - }, - { - "data":[0, 0, 20, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - "height":16, - "width":16, - "x":16, - "y":-16 - }, - { - "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - "height":16, - "width":16, - "x":-16, - "y":0 - }, - { - "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - "height":16, - "width":16, - "x":16, - "y":0 - }, - { - "data":[28, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - "height":16, - "width":16, - "x":-16, - "y":16 - }], - "height":48, - "id":2, - "name":"Tile Layer 2", - "opacity":1, - "startx":-32, - "starty":-16, - "type":"tilelayer", - "visible":true, - "width":64, - "x":0, - "y":0 - }], - "nextlayerid":3, - "nextobjectid":1, - "orientation":"orthogonal", - "renderorder":"right-down", - "tiledversion":"1.3.1", - "tileheight":32, - "tilesets":[ - { - "firstgid":1, - "source":"tileset_image.json" - }], - "tilewidth":32, - "type":"map", - "version":1.2, - "width":8 -} diff --git a/tests/test_data/example_maps/simple_offset/map_simple_offset.json b/tests/test_data/example_maps/simple_offset/map_simple_offset.json deleted file mode 100644 index bea06b94..00000000 --- a/tests/test_data/example_maps/simple_offset/map_simple_offset.json +++ /dev/null @@ -1,80 +0,0 @@ -{ "compressionlevel":0, - "height":6, - "infinite":false, - "layers":[ - { - "data":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48], - "height":6, - "id":1, - "name":"Tile Layer 1", - "offsetx":16, - "offsety":-16.42, - "opacity":1, - "type":"tilelayer", - "visible":true, - "width":8, - "x":0, - "y":0 - }], - "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":"empty file", - "type":"file", - "value":"" - }, - { - "name":"empty string", - "type":"string", - "value":"" - }, - { - "name":"file_property", - "type":"file", - "value":"test_map_simple_offset.json" - }, - { - "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.3.1", - "tileheight":32, - "tilesets":[ - { - "firstgid":1, - "source":"tileset_image.json" - }], - "tilewidth":32, - "type":"map", - "version":1.2, - "width":8 -} diff --git a/tests/test_data/layer_tests/all_layer_types/map.json b/tests/test_data/layer_tests/all_layer_types/map.json index 8d082511..7229b3a6 100644 --- a/tests/test_data/layer_tests/all_layer_types/map.json +++ b/tests/test_data/layer_tests/all_layer_types/map.json @@ -88,7 +88,7 @@ "nextobjectid":3, "orientation":"orthogonal", "renderorder":"right-down", - "tiledversion":"1.5.0", + "tiledversion":"1.6.0", "tileheight":32, "tilesets":[ { @@ -97,6 +97,6 @@ }], "tilewidth":32, "type":"map", - "version":1.5, + "version":"1.6", "width":8 } \ No newline at end of file diff --git a/tests/test_data/layer_tests/all_layer_types/tileset.json b/tests/test_data/layer_tests/all_layer_types/tileset.json index 8df9f187..1a074512 100644 --- a/tests/test_data/layer_tests/all_layer_types/tileset.json +++ b/tests/test_data/layer_tests/all_layer_types/tileset.json @@ -1,12 +1,4 @@ { "columns":8, - "editorsettings": - { - "export": - { - "format":"", - "target":"." - } - }, "image":"..\/..\/images\/tmw_desert_spacing.png", "imageheight":199, "imagewidth":265, @@ -14,9 +6,9 @@ "name":"tile_set_image", "spacing":1, "tilecount":48, - "tiledversion":"1.3.5", + "tiledversion":"1.6.0", "tileheight":32, "tilewidth":32, "type":"tileset", - "version":1.2 + "version":"1.6" } \ No newline at end of file diff --git a/tests/test_data/layer_tests/b64/map.json b/tests/test_data/layer_tests/b64/map.json index cdc7cd40..e9f6eb07 100644 --- a/tests/test_data/layer_tests/b64/map.json +++ b/tests/test_data/layer_tests/b64/map.json @@ -63,7 +63,7 @@ "nextobjectid":3, "orientation":"orthogonal", "renderorder":"right-down", - "tiledversion":"1.4.1", + "tiledversion":"1.6.0", "tileheight":32, "tilesets":[ { @@ -72,6 +72,6 @@ }], "tilewidth":32, "type":"map", - "version":1.4, + "version":"1.6", "width":8 } \ No newline at end of file diff --git a/tests/test_data/layer_tests/b64/tileset.json b/tests/test_data/layer_tests/b64/tileset.json index 8df9f187..1a074512 100644 --- a/tests/test_data/layer_tests/b64/tileset.json +++ b/tests/test_data/layer_tests/b64/tileset.json @@ -1,12 +1,4 @@ { "columns":8, - "editorsettings": - { - "export": - { - "format":"", - "target":"." - } - }, "image":"..\/..\/images\/tmw_desert_spacing.png", "imageheight":199, "imagewidth":265, @@ -14,9 +6,9 @@ "name":"tile_set_image", "spacing":1, "tilecount":48, - "tiledversion":"1.3.5", + "tiledversion":"1.6.0", "tileheight":32, "tilewidth":32, "type":"tileset", - "version":1.2 + "version":"1.6" } \ No newline at end of file diff --git a/tests/test_data/layer_tests/b64_gzip/map.json b/tests/test_data/layer_tests/b64_gzip/map.json index eda44d86..6fbde619 100644 --- a/tests/test_data/layer_tests/b64_gzip/map.json +++ b/tests/test_data/layer_tests/b64_gzip/map.json @@ -63,7 +63,7 @@ "nextobjectid":3, "orientation":"orthogonal", "renderorder":"right-down", - "tiledversion":"1.4.1", + "tiledversion":"1.6.0", "tileheight":32, "tilesets":[ { @@ -72,6 +72,6 @@ }], "tilewidth":32, "type":"map", - "version":1.4, + "version":"1.6", "width":8 } \ No newline at end of file diff --git a/tests/test_data/layer_tests/b64_gzip/tileset.json b/tests/test_data/layer_tests/b64_gzip/tileset.json index 8df9f187..1a074512 100644 --- a/tests/test_data/layer_tests/b64_gzip/tileset.json +++ b/tests/test_data/layer_tests/b64_gzip/tileset.json @@ -1,12 +1,4 @@ { "columns":8, - "editorsettings": - { - "export": - { - "format":"", - "target":"." - } - }, "image":"..\/..\/images\/tmw_desert_spacing.png", "imageheight":199, "imagewidth":265, @@ -14,9 +6,9 @@ "name":"tile_set_image", "spacing":1, "tilecount":48, - "tiledversion":"1.3.5", + "tiledversion":"1.6.0", "tileheight":32, "tilewidth":32, "type":"tileset", - "version":1.2 + "version":"1.6" } \ No newline at end of file diff --git a/tests/test_data/layer_tests/b64_zlib/map.json b/tests/test_data/layer_tests/b64_zlib/map.json index 5809c610..ad9aa141 100644 --- a/tests/test_data/layer_tests/b64_zlib/map.json +++ b/tests/test_data/layer_tests/b64_zlib/map.json @@ -63,7 +63,7 @@ "nextobjectid":3, "orientation":"orthogonal", "renderorder":"right-down", - "tiledversion":"1.4.1", + "tiledversion":"1.6.0", "tileheight":32, "tilesets":[ { @@ -72,6 +72,6 @@ }], "tilewidth":32, "type":"map", - "version":1.4, + "version":"1.6", "width":8 } \ No newline at end of file diff --git a/tests/test_data/layer_tests/b64_zlib/tileset.json b/tests/test_data/layer_tests/b64_zlib/tileset.json index 8df9f187..1a074512 100644 --- a/tests/test_data/layer_tests/b64_zlib/tileset.json +++ b/tests/test_data/layer_tests/b64_zlib/tileset.json @@ -1,12 +1,4 @@ { "columns":8, - "editorsettings": - { - "export": - { - "format":"", - "target":"." - } - }, "image":"..\/..\/images\/tmw_desert_spacing.png", "imageheight":199, "imagewidth":265, @@ -14,9 +6,9 @@ "name":"tile_set_image", "spacing":1, "tilecount":48, - "tiledversion":"1.3.5", + "tiledversion":"1.6.0", "tileheight":32, "tilewidth":32, "type":"tileset", - "version":1.2 + "version":"1.6" } \ No newline at end of file diff --git a/tests/test_data/layer_tests/b64_zstd/expected.py b/tests/test_data/layer_tests/b64_zstd/expected.py index 178924bb..e69de29b 100644 --- a/tests/test_data/layer_tests/b64_zstd/expected.py +++ b/tests/test_data/layer_tests/b64_zstd/expected.py @@ -1,109 +0,0 @@ -from pathlib import Path - -from pytiled_parser import common_types, layer, tiled_object - -EXPECTED = [ - layer.TileLayer( - name="Tile Layer 1", - opacity=1, - visible=True, - id=1, - size=common_types.Size(8, 6), - data=[ - [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - ], - [ - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - ], - [ - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - ], - [ - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - ], - [ - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - ], - [ - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - ], - ], - ), - layer.LayerGroup( - name="Group 1", - opacity=1, - visible=True, - id=4, - layers=[ - layer.ObjectLayer( - name="Object Layer 1", - opacity=1, - visible=True, - id=2, - draw_order="topdown", - tiled_objects=[ - tiled_object.Rectangle( - id=1, - name="", - rotation=0, - size=common_types.Size(69.3333333333333, 52.6666666666667), - coordinates=common_types.OrderedPair(46.3333333333333, 39), - visible=True, - type="", - ) - ], - ), - ], - ), - layer.ImageLayer( - name="Image Layer 1", - opacity=1, - visible=True, - id=3, - image=Path("../../images/tile_04.png"), - transparent_color=common_types.Color(0, 0, 0, 255), - ), -] diff --git a/tests/test_data/layer_tests/b64_zstd/map.json b/tests/test_data/layer_tests/b64_zstd/map.json index db069f7d..f8e714d0 100644 --- a/tests/test_data/layer_tests/b64_zstd/map.json +++ b/tests/test_data/layer_tests/b64_zstd/map.json @@ -1,11 +1,4 @@ { "compressionlevel":-1, - "editorsettings": - { - "export": - { - "target":"." - } - }, "height":6, "infinite":false, "layers":[ @@ -57,7 +50,7 @@ }, { "id":3, - "image":"..\/..\/images\/tile_04.png", + "image":"..\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/images\/tile_04.png", "name":"Image Layer 1", "opacity":1, "transparentcolor":"#000000", @@ -70,7 +63,7 @@ "nextobjectid":3, "orientation":"orthogonal", "renderorder":"right-down", - "tiledversion":"1.4.3", + "tiledversion":"1.6.0", "tileheight":32, "tilesets":[ { @@ -79,6 +72,6 @@ }], "tilewidth":32, "type":"map", - "version":1.4, + "version":"1.6", "width":8 } \ No newline at end of file diff --git a/tests/test_data/layer_tests/b64_zstd/tileset.json b/tests/test_data/layer_tests/b64_zstd/tileset.json index d6531d4d..1a074512 100644 --- a/tests/test_data/layer_tests/b64_zstd/tileset.json +++ b/tests/test_data/layer_tests/b64_zstd/tileset.json @@ -1,22 +1,14 @@ { "columns":8, - "editorsettings": - { - "export": - { - "format":"", - "target":"." - } - }, - "image":"..\/..\/images\/tmw_desert_spacing.png", - "imageheight":199, - "imagewidth":265, - "margin":1, - "name":"tile_set_image", - "spacing":1, - "tilecount":48, - "tiledversion":"1.3.5", - "tileheight":32, - "tilewidth":32, - "type":"tileset", - "version":1.2 - } \ No newline at end of file + "image":"..\/..\/images\/tmw_desert_spacing.png", + "imageheight":199, + "imagewidth":265, + "margin":1, + "name":"tile_set_image", + "spacing":1, + "tilecount":48, + "tiledversion":"1.6.0", + "tileheight":32, + "tilewidth":32, + "type":"tileset", + "version":"1.6" +} \ No newline at end of file diff --git a/tests/test_data/layer_tests/infinite_map/map.json b/tests/test_data/layer_tests/infinite_map/map.json index f506453c..b6c2aca0 100644 --- a/tests/test_data/layer_tests/infinite_map/map.json +++ b/tests/test_data/layer_tests/infinite_map/map.json @@ -8,7 +8,7 @@ }, "export": { - "target":"..\/all_layer_types" + "target":"..\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/all_layer_types" } }, "height":6, @@ -54,7 +54,7 @@ "nextobjectid":3, "orientation":"orthogonal", "renderorder":"right-down", - "tiledversion":"1.4.1", + "tiledversion":"1.6.0", "tileheight":32, "tilesets":[ { @@ -63,6 +63,6 @@ }], "tilewidth":32, "type":"map", - "version":1.4, + "version":"1.6", "width":8 } \ No newline at end of file diff --git a/tests/test_data/layer_tests/infinite_map_b64/map.json b/tests/test_data/layer_tests/infinite_map_b64/map.json index 54c38524..8c3f26fc 100644 --- a/tests/test_data/layer_tests/infinite_map_b64/map.json +++ b/tests/test_data/layer_tests/infinite_map_b64/map.json @@ -37,7 +37,7 @@ "nextobjectid":3, "orientation":"orthogonal", "renderorder":"right-down", - "tiledversion":"1.4.1", + "tiledversion":"1.6.0", "tileheight":32, "tilesets":[ { @@ -46,6 +46,6 @@ }], "tilewidth":32, "type":"map", - "version":1.4, + "version":"1.6", "width":8 } \ No newline at end of file diff --git a/tests/test_data/layer_tests/no_layers/map.json b/tests/test_data/layer_tests/no_layers/map.json index ac423c0f..2fa7062a 100644 --- a/tests/test_data/layer_tests/no_layers/map.json +++ b/tests/test_data/layer_tests/no_layers/map.json @@ -1,11 +1,4 @@ { "compressionlevel":0, - "editorsettings": - { - "export": - { - "target":"." - } - }, "height":6, "infinite":false, "layers":[], @@ -31,7 +24,7 @@ { "name":"file property", "type":"file", - "value":"..\/..\/..\/..\/..\/..\/var\/log\/syslog" + "value":"..\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/test_data\/layer_tests\/tests\/var\/log\/syslog" }, { "name":"float property", @@ -49,15 +42,15 @@ "value":"Hello, World!!" }], "renderorder":"right-down", - "tiledversion":"1.4.1", + "tiledversion":"1.6.0", "tileheight":32, "tilesets":[ { "firstgid":1, - "source":"tileset_image.json" + "source":"tileset.json" }], "tilewidth":32, "type":"map", - "version":1.4, + "version":"1.6", "width":8 } \ No newline at end of file diff --git a/tests/test_data/example_maps/simple_external_tileset/tileset_image.json b/tests/test_data/layer_tests/no_layers/tileset.json similarity index 84% rename from tests/test_data/example_maps/simple_external_tileset/tileset_image.json rename to tests/test_data/layer_tests/no_layers/tileset.json index e88a3f16..1a074512 100644 --- a/tests/test_data/example_maps/simple_external_tileset/tileset_image.json +++ b/tests/test_data/layer_tests/no_layers/tileset.json @@ -6,9 +6,9 @@ "name":"tile_set_image", "spacing":1, "tilecount":48, - "tiledversion":"1.3.1", + "tiledversion":"1.6.0", "tileheight":32, "tilewidth":32, "type":"tileset", - "version":1.2 -} + "version":"1.6" +} \ No newline at end of file diff --git a/tests/test_data/layer_tests/no_layers/tileset_image.json b/tests/test_data/layer_tests/no_layers/tileset_image.json deleted file mode 100644 index e88a3f16..00000000 --- a/tests/test_data/layer_tests/no_layers/tileset_image.json +++ /dev/null @@ -1,14 +0,0 @@ -{ "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 -} diff --git a/tests/test_data/map_tests/embedded_tileset/expected.py b/tests/test_data/map_tests/embedded_tileset/expected.py index cbabb9c7..d8988d95 100644 --- a/tests/test_data/map_tests/embedded_tileset/expected.py +++ b/tests/test_data/map_tests/embedded_tileset/expected.py @@ -10,9 +10,9 @@ next_object_id=1, orientation="orthogonal", render_order="right-down", - tiled_version="1.4.1", + tiled_version="1.6.0", tile_size=common_types.Size(32, 32), - version=1.4, + version="1.6", tilesets={ 1: tileset.Tileset( columns=8, diff --git a/tests/test_data/map_tests/embedded_tileset/map.json b/tests/test_data/map_tests/embedded_tileset/map.json index 7d247c18..a3643099 100644 --- a/tests/test_data/map_tests/embedded_tileset/map.json +++ b/tests/test_data/map_tests/embedded_tileset/map.json @@ -1,11 +1,4 @@ { "compressionlevel":0, - "editorsettings": - { - "export": - { - "target":"." - } - }, "height":6, "infinite":false, "layers":[], @@ -13,7 +6,7 @@ "nextobjectid":1, "orientation":"orthogonal", "renderorder":"right-down", - "tiledversion":"1.4.1", + "tiledversion":"1.6.0", "tileheight":32, "tilesets":[ { @@ -31,6 +24,6 @@ }], "tilewidth":32, "type":"map", - "version":1.4, + "version":"1.6", "width":8 } \ No newline at end of file diff --git a/tests/test_data/map_tests/external_tileset_dif_dir/expected.py b/tests/test_data/map_tests/external_tileset_dif_dir/expected.py index 98f15a3f..1e866299 100644 --- a/tests/test_data/map_tests/external_tileset_dif_dir/expected.py +++ b/tests/test_data/map_tests/external_tileset_dif_dir/expected.py @@ -9,9 +9,9 @@ next_object_id=1, orientation="orthogonal", render_order="right-down", - tiled_version="1.5.0", + tiled_version="1.6.0", tile_size=common_types.Size(32, 32), - version=1.5, + version="1.6", background_color=common_types.Color(255, 0, 4, 255), layers=[ layer.TileLayer( @@ -82,10 +82,10 @@ spacing=0, name="tileset", tile_count=4, - tiled_version="1.3.5", + tiled_version="1.6.0", tile_height=32, tile_width=32, - version=1.2, + version="1.6", type="tileset", grid=tileset.Grid(orientation="orthogonal", width=1, height=1), tiles={ diff --git a/tests/test_data/map_tests/external_tileset_dif_dir/map.json b/tests/test_data/map_tests/external_tileset_dif_dir/map.json index 3a4be3c8..f64010f3 100644 --- a/tests/test_data/map_tests/external_tileset_dif_dir/map.json +++ b/tests/test_data/map_tests/external_tileset_dif_dir/map.json @@ -52,7 +52,7 @@ "value":"Hello, World!!" }], "renderorder":"right-down", - "tiledversion":"1.5.0", + "tiledversion":"1.6.0", "tileheight":32, "tilesets":[ { @@ -61,6 +61,6 @@ }], "tilewidth":32, "type":"map", - "version":1.5, + "version":"1.6", "width":8 } \ No newline at end of file diff --git a/tests/test_data/map_tests/external_tileset_dif_dir/tileset/tileset.json b/tests/test_data/map_tests/external_tileset_dif_dir/tileset/tileset.json index 323dca41..dd51f38c 100644 --- a/tests/test_data/map_tests/external_tileset_dif_dir/tileset/tileset.json +++ b/tests/test_data/map_tests/external_tileset_dif_dir/tileset/tileset.json @@ -1,124 +1,115 @@ { "columns":0, - "editorsettings": - { - "export": - { - "format":"", - "target":"." - } - }, - "grid": - { - "height":1, - "orientation":"orthogonal", - "width":1 - }, - "margin":0, - "name":"tileset", - "spacing":0, - "tilecount":4, - "tiledversion":"1.3.5", - "tileheight":32, - "tiles":[ - { - "animation":[ - { - "duration":100, - "tileid":0 - }, - { - "duration":100, - "tileid":1 - }, - { - "duration":100, - "tileid":2 - }, - { - "duration":100, - "tileid":3 - }], - "id":0, - "image":"..\/..\/..\/images\/tile_01.png", - "imageheight":32, - "imagewidth":32, - "properties":[ - { - "name":"float property", - "type":"float", - "value":2.2 - }], - "type":"tile" - }, - { - "id":1, - "image":"..\/..\/..\/images\/tile_02.png", - "imageheight":32, - "imagewidth":32, - "objectgroup": - { - "draworder":"index", - "name":"", - "objects":[ - { - "height":13.7196924896511, - "id":2, - "name":"", - "rotation":0, - "type":"", - "visible":true, - "width":14.4766410408043, - "x":13.4358367829687, - "y":13.5304553518628 - }, - { - "ellipse":true, - "height":11.070372560615, - "id":3, - "name":"", - "rotation":0, - "type":"", - "visible":true, - "width":14.287403903016, - "x":13.8143110585452, - "y":1.98698994677705 - }], - "opacity":1, - "type":"objectgroup", - "visible":true, - "x":0, - "y":0 - }, - "properties":[ - { - "name":"string property", - "type":"string", - "value":"testing" - }], - "type":"tile" - }, - { - "id":2, - "image":"..\/..\/..\/images\/tile_03.png", - "imageheight":32, - "imagewidth":32, - "properties":[ - { - "name":"bool property", - "type":"bool", - "value":true - }], - "type":"tile" - }, - { - "id":3, - "image":"..\/..\/..\/images\/tile_04.png", - "imageheight":32, - "imagewidth":32, - "type":"tile" - }], - "tilewidth":32, - "type":"tileset", - "version":1.2 - } - \ No newline at end of file + "grid": + { + "height":1, + "orientation":"orthogonal", + "width":1 + }, + "margin":0, + "name":"tileset", + "spacing":0, + "tilecount":4, + "tiledversion":"1.6.0", + "tileheight":32, + "tiles":[ + { + "animation":[ + { + "duration":100, + "tileid":0 + }, + { + "duration":100, + "tileid":1 + }, + { + "duration":100, + "tileid":2 + }, + { + "duration":100, + "tileid":3 + }], + "id":0, + "image":"..\/..\/..\/images\/tile_01.png", + "imageheight":32, + "imagewidth":32, + "properties":[ + { + "name":"float property", + "type":"float", + "value":2.2 + }], + "type":"tile" + }, + { + "id":1, + "image":"..\/..\/..\/images\/tile_02.png", + "imageheight":32, + "imagewidth":32, + "objectgroup": + { + "draworder":"index", + "name":"", + "objects":[ + { + "height":13.7196924896511, + "id":2, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":14.4766410408043, + "x":13.4358367829687, + "y":13.5304553518628 + }, + { + "ellipse":true, + "height":11.070372560615, + "id":3, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":14.287403903016, + "x":13.8143110585452, + "y":1.98698994677705 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "x":0, + "y":0 + }, + "properties":[ + { + "name":"string property", + "type":"string", + "value":"testing" + }], + "type":"tile" + }, + { + "id":2, + "image":"..\/..\/..\/images\/tile_03.png", + "imageheight":32, + "imagewidth":32, + "properties":[ + { + "name":"bool property", + "type":"bool", + "value":true + }], + "type":"tile" + }, + { + "id":3, + "image":"..\/..\/..\/images\/tile_04.png", + "imageheight":32, + "imagewidth":32, + "type":"tile" + }], + "tilewidth":32, + "type":"tileset", + "version":"1.6" +} \ No newline at end of file diff --git a/tests/test_data/map_tests/hexagonal/expected.py b/tests/test_data/map_tests/hexagonal/expected.py index 38fdcb9b..10b873c3 100644 --- a/tests/test_data/map_tests/hexagonal/expected.py +++ b/tests/test_data/map_tests/hexagonal/expected.py @@ -132,9 +132,9 @@ next_object_id=1, orientation="hexagonal", render_order="right-down", - tiled_version="1.4.1", + tiled_version="1.6.0", tile_size=common_types.Size(14, 12), - version=1.4, + version="1.6", tilesets={ 1: tileset.Tileset( columns=5, @@ -147,10 +147,10 @@ spacing=0, name="tileset", tile_count=20, - tiled_version="1.4.1", + tiled_version="1.6.0", tile_height=18, tile_width=18, - version=1.4, + version="1.6", type="tileset", tile_offset=common_types.OrderedPair(0, 1), ) diff --git a/tests/test_data/map_tests/hexagonal/map.json b/tests/test_data/map_tests/hexagonal/map.json index 847f3827..17f63527 100644 --- a/tests/test_data/map_tests/hexagonal/map.json +++ b/tests/test_data/map_tests/hexagonal/map.json @@ -21,7 +21,7 @@ "renderorder":"right-down", "staggeraxis":"y", "staggerindex":"odd", - "tiledversion":"1.4.1", + "tiledversion":"1.6.0", "tileheight":12, "tilesets":[ { @@ -30,6 +30,6 @@ }], "tilewidth":14, "type":"map", - "version":1.4, + "version":"1.6", "width":10 } \ No newline at end of file diff --git a/tests/test_data/map_tests/hexagonal/tileset.json b/tests/test_data/map_tests/hexagonal/tileset.json index be8e7b47..b6bec3cd 100644 --- a/tests/test_data/map_tests/hexagonal/tileset.json +++ b/tests/test_data/map_tests/hexagonal/tileset.json @@ -6,7 +6,7 @@ "name":"tileset", "spacing":0, "tilecount":20, - "tiledversion":"1.4.1", + "tiledversion":"1.6.0", "tileheight":18, "tileoffset": { @@ -15,5 +15,5 @@ }, "tilewidth":18, "type":"tileset", - "version":1.4 + "version":"1.6" } \ No newline at end of file diff --git a/tests/test_data/map_tests/no_background_color/expected.py b/tests/test_data/map_tests/no_background_color/expected.py index 4c34f58a..483539b5 100644 --- a/tests/test_data/map_tests/no_background_color/expected.py +++ b/tests/test_data/map_tests/no_background_color/expected.py @@ -10,9 +10,9 @@ next_object_id=1, orientation="orthogonal", render_order="right-down", - tiled_version="1.4.1", + tiled_version="1.6.0", tile_size=common_types.Size(32, 32), - version=1.4, + version="1.6", tilesets={ 1: tileset.Tileset( columns=8, @@ -25,10 +25,10 @@ spacing=1, name="tile_set_image", tile_count=48, - tiled_version="1.3.1", + tiled_version="1.6.0", tile_height=32, tile_width=32, - version=1.2, + version="1.6", type="tileset", ) }, diff --git a/tests/test_data/map_tests/no_background_color/map.json b/tests/test_data/map_tests/no_background_color/map.json index 124e37e9..8e2a2d65 100644 --- a/tests/test_data/map_tests/no_background_color/map.json +++ b/tests/test_data/map_tests/no_background_color/map.json @@ -1,11 +1,4 @@ { "compressionlevel":0, - "editorsettings": - { - "export": - { - "target":"." - } - }, "height":6, "infinite":false, "layers":[], @@ -13,15 +6,15 @@ "nextobjectid":1, "orientation":"orthogonal", "renderorder":"right-down", - "tiledversion":"1.4.1", + "tiledversion":"1.6.0", "tileheight":32, "tilesets":[ { "firstgid":1, - "source":"tileset_image.json" + "source":"tileset.json" }], "tilewidth":32, "type":"map", - "version":1.4, + "version":"1.6", "width":8 } \ No newline at end of file diff --git a/tests/test_data/example_maps/simple_infinite/tileset_image.json b/tests/test_data/map_tests/no_background_color/tileset.json similarity index 84% rename from tests/test_data/example_maps/simple_infinite/tileset_image.json rename to tests/test_data/map_tests/no_background_color/tileset.json index e88a3f16..1a074512 100644 --- a/tests/test_data/example_maps/simple_infinite/tileset_image.json +++ b/tests/test_data/map_tests/no_background_color/tileset.json @@ -6,9 +6,9 @@ "name":"tile_set_image", "spacing":1, "tilecount":48, - "tiledversion":"1.3.1", + "tiledversion":"1.6.0", "tileheight":32, "tilewidth":32, "type":"tileset", - "version":1.2 -} + "version":"1.6" +} \ No newline at end of file diff --git a/tests/test_data/map_tests/no_background_color/tileset_image.json b/tests/test_data/map_tests/no_background_color/tileset_image.json deleted file mode 100644 index e88a3f16..00000000 --- a/tests/test_data/map_tests/no_background_color/tileset_image.json +++ /dev/null @@ -1,14 +0,0 @@ -{ "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 -} diff --git a/tests/test_data/map_tests/no_layers/expected.py b/tests/test_data/map_tests/no_layers/expected.py index 1324cab3..7bc5ca2d 100644 --- a/tests/test_data/map_tests/no_layers/expected.py +++ b/tests/test_data/map_tests/no_layers/expected.py @@ -10,9 +10,9 @@ next_object_id=1, orientation="orthogonal", render_order="right-down", - tiled_version="1.4.1", + tiled_version="1.6.0", tile_size=common_types.Size(32, 32), - version=1.4, + version="1.6", background_color=common_types.Color(255, 0, 4, 255), tilesets={ 1: tileset.Tileset( @@ -26,10 +26,10 @@ spacing=1, name="tile_set_image", tile_count=48, - tiled_version="1.3.1", + tiled_version="1.6.0", tile_height=32, tile_width=32, - version=1.2, + version="1.6", type="tileset", ) }, diff --git a/tests/test_data/map_tests/no_layers/map.json b/tests/test_data/map_tests/no_layers/map.json index 0c351337..99c24bcc 100644 --- a/tests/test_data/map_tests/no_layers/map.json +++ b/tests/test_data/map_tests/no_layers/map.json @@ -1,12 +1,5 @@ { "backgroundcolor":"#ff0004", "compressionlevel":0, - "editorsettings": - { - "export": - { - "target":"." - } - }, "height":6, "infinite":false, "layers":[], @@ -45,15 +38,15 @@ "value":"Hello, World!!" }], "renderorder":"right-down", - "tiledversion":"1.4.1", + "tiledversion":"1.6.0", "tileheight":32, "tilesets":[ { "firstgid":1, - "source":"tileset_image.json" + "source":"tileset.json" }], "tilewidth":32, "type":"map", - "version":1.4, + "version":"1.6", "width":8 } \ No newline at end of file diff --git a/tests/test_data/example_maps/all_objects/tileset_image.json b/tests/test_data/map_tests/no_layers/tileset.json similarity index 84% rename from tests/test_data/example_maps/all_objects/tileset_image.json rename to tests/test_data/map_tests/no_layers/tileset.json index e88a3f16..1a074512 100644 --- a/tests/test_data/example_maps/all_objects/tileset_image.json +++ b/tests/test_data/map_tests/no_layers/tileset.json @@ -6,9 +6,9 @@ "name":"tile_set_image", "spacing":1, "tilecount":48, - "tiledversion":"1.3.1", + "tiledversion":"1.6.0", "tileheight":32, "tilewidth":32, "type":"tileset", - "version":1.2 -} + "version":"1.6" +} \ 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 deleted file mode 100644 index e88a3f16..00000000 --- a/tests/test_data/map_tests/no_layers/tileset_image.json +++ /dev/null @@ -1,14 +0,0 @@ -{ "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 -} diff --git a/tests/test_data/map_tests/template/expected.py b/tests/test_data/map_tests/template/expected.py new file mode 100644 index 00000000..ae8f84a5 --- /dev/null +++ b/tests/test_data/map_tests/template/expected.py @@ -0,0 +1,77 @@ +from pathlib import Path + +from pytiled_parser import common_types, layer, tiled_map, tiled_object, tileset + +EXPECTED = tiled_map.TiledMap( + infinite=False, + layers=[ + layer.ObjectLayer( + name="Object Layer 1", + opacity=1, + visible=True, + id=2, + draw_order="topdown", + tiled_objects=[ + tiled_object.Rectangle( + id=2, + name="", + rotation=0, + size=common_types.Size(63.6585878103079, 38.2811778048473), + coordinates=common_types.OrderedPair( + 98.4987608686521, 46.2385012811358 + ), + visible=True, + type="", + ), + tiled_object.Tile( + id=3, + coordinates=common_types.OrderedPair( + 46.3682110303692, 112.993321292057 + ), + name="", + rotation=0, + type="", + visible=True, + size=common_types.Size(32, 32), + gid=30, + ), + ], + ) + ], + map_size=common_types.Size(8, 6), + next_layer_id=3, + next_object_id=4, + orientation="orthogonal", + render_order="right-down", + tiled_version="1.6.0", + tile_size=common_types.Size(32, 32), + version="1.6", + background_color=common_types.Color(255, 0, 4, 255), + tilesets={ + 1: tileset.Tileset( + columns=8, + image=Path(Path(__file__).parent / "../../images/tmw_desert_spacing.png") + .absolute() + .resolve(), + image_width=265, + image_height=199, + margin=1, + spacing=1, + name="tile_set_image", + tile_count=48, + tiled_version="1.6.0", + tile_height=32, + tile_width=32, + version="1.6", + type="tileset", + ) + }, + properties={ + "bool property - true": True, + "color property": common_types.Color(255, 73, 252, 255), + "file property": Path("../../../../../../var/log/syslog"), + "float property": 1.23456789, + "int property": 13, + "string property": "Hello, World!!", + }, +) diff --git a/tests/test_data/example_maps/simple_external_tileset/map_simple_external_tileset.json b/tests/test_data/map_tests/template/map.json similarity index 60% rename from tests/test_data/example_maps/simple_external_tileset/map_simple_external_tileset.json rename to tests/test_data/map_tests/template/map.json index e68a7f71..c0b1b406 100644 --- a/tests/test_data/example_maps/simple_external_tileset/map_simple_external_tileset.json +++ b/tests/test_data/map_tests/template/map.json @@ -1,28 +1,35 @@ -{ "compressionlevel":0, +{ "backgroundcolor":"#ff0004", + "compressionlevel":0, "height":6, "infinite":false, "layers":[ { - "data":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48], - "height":6, - "id":1, - "name":"Tile Layer 1", + "draworder":"topdown", + "id":2, + "name":"Object Layer 1", + "objects":[ + { + "id":2, + "template":"template.json", + "x":98.4987608686521, + "y":46.2385012811358 + }, + { + "id":3, + "template":"template_tile.json", + "x":46.3682110303692, + "y":112.993321292057 + }], "opacity":1, - "type":"tilelayer", + "type":"objectgroup", "visible":true, - "width":8, "x":0, "y":0 }], - "nextlayerid":2, - "nextobjectid":1, + "nextlayerid":3, + "nextobjectid":4, "orientation":"orthogonal", "properties":[ - { - "name":"bool property - false", - "type":"bool", - "value":false - }, { "name":"bool property - true", "type":"bool", @@ -54,15 +61,15 @@ "value":"Hello, World!!" }], "renderorder":"right-down", - "tiledversion":"1.3.1", + "tiledversion":"1.6.0", "tileheight":32, "tilesets":[ { "firstgid":1, - "source":"tileset_image.json" + "source":"tileset.json" }], "tilewidth":32, "type":"map", - "version":1.2, + "version":"1.6", "width":8 -} +} \ No newline at end of file diff --git a/tests/test_data/map_tests/template/template.json b/tests/test_data/map_tests/template/template.json new file mode 100644 index 00000000..fc392298 --- /dev/null +++ b/tests/test_data/map_tests/template/template.json @@ -0,0 +1,12 @@ +{ "object": + { + "height":38.2811778048473, + "id":1, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":63.6585878103079 + }, + "type":"template" +} \ No newline at end of file diff --git a/tests/test_data/map_tests/template/template_tile.json b/tests/test_data/map_tests/template/template_tile.json new file mode 100644 index 00000000..e215e238 --- /dev/null +++ b/tests/test_data/map_tests/template/template_tile.json @@ -0,0 +1,18 @@ +{ "object": + { + "gid":30, + "height":32, + "id":3, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":32 + }, + "tileset": + { + "firstgid":1, + "source":"tileset.json" + }, + "type":"template" +} \ No newline at end of file diff --git a/tests/test_data/example_maps/simple_offset/tileset_image.json b/tests/test_data/map_tests/template/tileset.json similarity index 84% rename from tests/test_data/example_maps/simple_offset/tileset_image.json rename to tests/test_data/map_tests/template/tileset.json index e88a3f16..1a074512 100644 --- a/tests/test_data/example_maps/simple_offset/tileset_image.json +++ b/tests/test_data/map_tests/template/tileset.json @@ -6,9 +6,9 @@ "name":"tile_set_image", "spacing":1, "tilecount":48, - "tiledversion":"1.3.1", + "tiledversion":"1.6.0", "tileheight":32, "tilewidth":32, "type":"tileset", - "version":1.2 -} + "version":"1.6" +} \ No newline at end of file diff --git a/tests/test_data/tests.tiled-project b/tests/test_data/tests.tiled-project new file mode 100644 index 00000000..7e507025 --- /dev/null +++ b/tests/test_data/tests.tiled-project @@ -0,0 +1,10 @@ +{ + "automappingRulesFile": "", + "commands": [ + ], + "extensionsPath": "extensions", + "folders": [ + "." + ], + "objectTypesFile": "" +} diff --git a/tests/test_data/tilesets/image/expected.py b/tests/test_data/tilesets/image/expected.py index 62577e5a..8f5b730c 100644 --- a/tests/test_data/tilesets/image/expected.py +++ b/tests/test_data/tilesets/image/expected.py @@ -11,9 +11,9 @@ spacing=1, name="tile_set_image", tile_count=48, - tiled_version="1.3.5", + tiled_version="1.6.0", tile_height=32, tile_width=32, - version=1.2, + version="1.6", type="tileset", ) diff --git a/tests/test_data/tilesets/image/tileset.json b/tests/test_data/tilesets/image/tileset.json index 8df9f187..1a074512 100644 --- a/tests/test_data/tilesets/image/tileset.json +++ b/tests/test_data/tilesets/image/tileset.json @@ -1,12 +1,4 @@ { "columns":8, - "editorsettings": - { - "export": - { - "format":"", - "target":"." - } - }, "image":"..\/..\/images\/tmw_desert_spacing.png", "imageheight":199, "imagewidth":265, @@ -14,9 +6,9 @@ "name":"tile_set_image", "spacing":1, "tilecount":48, - "tiledversion":"1.3.5", + "tiledversion":"1.6.0", "tileheight":32, "tilewidth":32, "type":"tileset", - "version":1.2 + "version":"1.6" } \ No newline at end of file diff --git a/tests/test_data/tilesets/image_background_color/expected.py b/tests/test_data/tilesets/image_background_color/expected.py index 3316c75a..7b322ade 100644 --- a/tests/test_data/tilesets/image_background_color/expected.py +++ b/tests/test_data/tilesets/image_background_color/expected.py @@ -12,10 +12,10 @@ spacing=1, name="tile_set_image", tile_count=48, - tiled_version="1.3.5", + tiled_version="1.6.0", tile_height=32, tile_width=32, - version=1.2, + version="1.6", background_color=Color(85, 0, 255, 255), type="tileset", ) diff --git a/tests/test_data/tilesets/image_background_color/tileset.json b/tests/test_data/tilesets/image_background_color/tileset.json index 83ae8dde..db8b40f8 100644 --- a/tests/test_data/tilesets/image_background_color/tileset.json +++ b/tests/test_data/tilesets/image_background_color/tileset.json @@ -1,13 +1,5 @@ { "backgroundcolor":"#5500ff", "columns":8, - "editorsettings": - { - "export": - { - "format":"", - "target":"." - } - }, "image":"..\/..\/images\/tmw_desert_spacing.png", "imageheight":199, "imagewidth":265, @@ -15,9 +7,9 @@ "name":"tile_set_image", "spacing":1, "tilecount":48, - "tiledversion":"1.3.5", + "tiledversion":"1.6.0", "tileheight":32, "tilewidth":32, "type":"tileset", - "version":1.2 + "version":"1.6" } \ No newline at end of file diff --git a/tests/test_data/tilesets/image_grid/expected.py b/tests/test_data/tilesets/image_grid/expected.py index 1d58174f..03691122 100644 --- a/tests/test_data/tilesets/image_grid/expected.py +++ b/tests/test_data/tilesets/image_grid/expected.py @@ -11,10 +11,10 @@ spacing=1, name="tile_set_image", tile_count=48, - tiled_version="1.3.5", + tiled_version="1.6.0", tile_height=32, tile_width=32, - version=1.2, + version="1.6", grid=tileset.Grid(orientation="isometric", width=32, height=32), type="tileset", ) diff --git a/tests/test_data/tilesets/image_grid/tileset.json b/tests/test_data/tilesets/image_grid/tileset.json index 4afdde13..7bcbf1ef 100644 --- a/tests/test_data/tilesets/image_grid/tileset.json +++ b/tests/test_data/tilesets/image_grid/tileset.json @@ -1,26 +1,28 @@ -{ - "columns": 8, - "editorsettings": { - "export": { - "format": "", - "target": "../image" - } - }, - "grid": { - "height": 32, - "orientation": "isometric", - "width": 32 - }, - "image": "../../images/tmw_desert_spacing.png", - "imageheight": 199, - "imagewidth": 265, - "margin": 1, - "name": "tile_set_image", - "spacing": 1, - "tilecount": 48, - "tiledversion": "1.3.5", - "tileheight": 32, - "tilewidth": 32, - "type": "tileset", - "version": 1.2 -} +{ "columns":8, + "editorsettings": + { + "export": + { + "format":"", + "target":"..\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/image" + } + }, + "grid": + { + "height":32, + "orientation":"isometric", + "width":32 + }, + "image":"..\/..\/images\/tmw_desert_spacing.png", + "imageheight":199, + "imagewidth":265, + "margin":1, + "name":"tile_set_image", + "spacing":1, + "tilecount":48, + "tiledversion":"1.6.0", + "tileheight":32, + "tilewidth":32, + "type":"tileset", + "version":"1.6" +} \ No newline at end of file diff --git a/tests/test_data/tilesets/image_properties/expected.py b/tests/test_data/tilesets/image_properties/expected.py index 6c34158d..d756b2b3 100644 --- a/tests/test_data/tilesets/image_properties/expected.py +++ b/tests/test_data/tilesets/image_properties/expected.py @@ -12,10 +12,10 @@ spacing=1, name="tile_set_image", tile_count=48, - tiled_version="1.3.5", + tiled_version="1.6.0", tile_height=32, tile_width=32, - version=1.2, + version="1.6", properties={ "bool property": True, "color property": Color(255, 0, 0, 255), diff --git a/tests/test_data/tilesets/image_properties/tileset.json b/tests/test_data/tilesets/image_properties/tileset.json index a5aa95b4..3a698fa6 100644 --- a/tests/test_data/tilesets/image_properties/tileset.json +++ b/tests/test_data/tilesets/image_properties/tileset.json @@ -4,7 +4,7 @@ "export": { "format":"", - "target":"..\/image" + "target":"..\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/image" } }, "image":"..\/..\/images\/tmw_desert_spacing.png", @@ -40,9 +40,9 @@ }], "spacing":1, "tilecount":48, - "tiledversion":"1.3.5", + "tiledversion":"1.6.0", "tileheight":32, "tilewidth":32, "type":"tileset", - "version":1.2 + "version":"1.6" } \ No newline at end of file diff --git a/tests/test_data/tilesets/image_tile_offset/expected.py b/tests/test_data/tilesets/image_tile_offset/expected.py index 97e2777f..b67716ee 100644 --- a/tests/test_data/tilesets/image_tile_offset/expected.py +++ b/tests/test_data/tilesets/image_tile_offset/expected.py @@ -12,10 +12,10 @@ spacing=1, name="tile_set_image", tile_count=48, - tiled_version="1.3.5", + tiled_version="1.6.0", tile_height=32, tile_width=32, - version=1.2, + version="1.6", tile_offset=OrderedPair(3, 5), type="tileset", ) diff --git a/tests/test_data/tilesets/image_tile_offset/tileset.json b/tests/test_data/tilesets/image_tile_offset/tileset.json index 61e3017d..5e0e99a9 100644 --- a/tests/test_data/tilesets/image_tile_offset/tileset.json +++ b/tests/test_data/tilesets/image_tile_offset/tileset.json @@ -4,7 +4,7 @@ "export": { "format":"", - "target":"..\/image" + "target":"..\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/tests\/test_data\/tilesets\/image" } }, "image":"..\/..\/images\/tmw_desert_spacing.png", @@ -14,7 +14,7 @@ "name":"tile_set_image", "spacing":1, "tilecount":48, - "tiledversion":"1.3.5", + "tiledversion":"1.6.0", "tileheight":32, "tileoffset": { @@ -23,5 +23,5 @@ }, "tilewidth":32, "type":"tileset", - "version":1.2 + "version":"1.6" } \ No newline at end of file diff --git a/tests/test_data/tilesets/image_transformations/expected.py b/tests/test_data/tilesets/image_transformations/expected.py new file mode 100644 index 00000000..d6839471 --- /dev/null +++ b/tests/test_data/tilesets/image_transformations/expected.py @@ -0,0 +1,25 @@ +from pathlib import Path + +from pytiled_parser import tileset + +EXPECTED = tileset.Tileset( + columns=8, + image=Path("../../images/tmw_desert_spacing.png"), + image_height=199, + image_width=265, + margin=1, + spacing=1, + name="tile_set_image", + tile_count=48, + tiled_version="1.6.0", + tile_height=32, + tile_width=32, + transformations=tileset.Transformations( + hflip=True, + vflip=False, + prefer_untransformed=False, + rotate=False, + ), + version="1.6", + type="tileset", +) diff --git a/tests/test_data/tilesets/image_transformations/tileset.json b/tests/test_data/tilesets/image_transformations/tileset.json new file mode 100644 index 00000000..134873c9 --- /dev/null +++ b/tests/test_data/tilesets/image_transformations/tileset.json @@ -0,0 +1,21 @@ +{ "columns":8, + "image":"..\/..\/images\/tmw_desert_spacing.png", + "imageheight":199, + "imagewidth":265, + "margin":1, + "name":"tile_set_image", + "spacing":1, + "tilecount":48, + "tiledversion":"1.6.0", + "tileheight":32, + "tilewidth":32, + "transformations": + { + "hflip":true, + "preferuntransformed":false, + "rotate":false, + "vflip":false + }, + "type":"tileset", + "version":"1.6" +} \ No newline at end of file diff --git a/tests/test_data/tilesets/image_transparent_color/expected.py b/tests/test_data/tilesets/image_transparent_color/expected.py index 758747f3..7f31fa35 100644 --- a/tests/test_data/tilesets/image_transparent_color/expected.py +++ b/tests/test_data/tilesets/image_transparent_color/expected.py @@ -12,10 +12,10 @@ spacing=1, name="tileset", tile_count=48, - tiled_version="1.3.5", + tiled_version="1.6.0", tile_height=32, tile_width=32, - version=1.2, + version="1.6", transparent_color=Color(255, 0, 255, 255), type="tileset", ) diff --git a/tests/test_data/tilesets/image_transparent_color/tileset.json b/tests/test_data/tilesets/image_transparent_color/tileset.json index fe318c30..a6f17d7d 100644 --- a/tests/test_data/tilesets/image_transparent_color/tileset.json +++ b/tests/test_data/tilesets/image_transparent_color/tileset.json @@ -1,12 +1,4 @@ { "columns":8, - "editorsettings": - { - "export": - { - "format":"", - "target":"." - } - }, "image":"..\/..\/images\/tmw_desert_spacing.png", "imageheight":199, "imagewidth":265, @@ -14,10 +6,10 @@ "name":"tileset", "spacing":1, "tilecount":48, - "tiledversion":"1.3.5", + "tiledversion":"1.6.0", "tileheight":32, "tilewidth":32, "transparentcolor":"#ff00ff", "type":"tileset", - "version":1.2 + "version":"1.6" } \ No newline at end of file diff --git a/tests/test_data/tilesets/individual_images/expected.py b/tests/test_data/tilesets/individual_images/expected.py index 63d766ff..ef987581 100644 --- a/tests/test_data/tilesets/individual_images/expected.py +++ b/tests/test_data/tilesets/individual_images/expected.py @@ -8,10 +8,10 @@ spacing=0, name="tileset", tile_count=4, - tiled_version="1.3.5", + tiled_version="1.6.0", tile_height=32, tile_width=32, - version=1.2, + version="1.6", type="tileset", grid=tileset.Grid(orientation="orthogonal", width=1, height=1), tiles={ diff --git a/tests/test_data/tilesets/individual_images/tileset.json b/tests/test_data/tilesets/individual_images/tileset.json index a22186e5..fdadc850 100644 --- a/tests/test_data/tilesets/individual_images/tileset.json +++ b/tests/test_data/tilesets/individual_images/tileset.json @@ -1,12 +1,4 @@ { "columns":0, - "editorsettings": - { - "export": - { - "format":"", - "target":"." - } - }, "grid": { "height":1, @@ -17,7 +9,7 @@ "name":"tileset", "spacing":0, "tilecount":4, - "tiledversion":"1.3.5", + "tiledversion":"1.6.0", "tileheight":32, "tiles":[ { @@ -119,5 +111,5 @@ }], "tilewidth":32, "type":"tileset", - "version":1.2 -} + "version":"1.6" +} \ No newline at end of file diff --git a/tests/test_data/tilesets/terrain/expected.py b/tests/test_data/tilesets/terrain/expected.py index c5902eb2..ce71f8c2 100644 --- a/tests/test_data/tilesets/terrain/expected.py +++ b/tests/test_data/tilesets/terrain/expected.py @@ -1,6 +1,6 @@ from pathlib import Path -from pytiled_parser import common_types, layer, tileset +from pytiled_parser import common_types, tileset, wang_set EXPECTED = tileset.Tileset( columns=8, @@ -11,261 +11,84 @@ image_height=199, image_width=265, tile_count=48, - tiled_version="1.3.5", + tiled_version="1.6.0", tile_height=32, tile_width=32, - version=1.2, + version="1.6", type="tileset", - terrain_types=[ - tileset.Terrain( - name="Sand", - tile=29, - properties={"terrain property": "test terrain property"}, - ), - tileset.Terrain(name="Cobblestone", tile=29), - tileset.Terrain(name="Pavement", tile=29), - tileset.Terrain(name="Dirt", tile=29), + wang_sets=[ + wang_set.WangSet( + name="Terrains", + tile=-1, + wang_type="mixed", + wang_colors=[ + wang_set.WangColor( + name="Sand", + probability=1, + tile=-1, + color=common_types.Color(255, 0, 0, 255), + ), + wang_set.WangColor( + name="Cobblestone", + probability=1, + tile=-1, + color=common_types.Color(0, 255, 0, 255), + ), + wang_set.WangColor( + name="Pavement", + probability=1, + tile=-1, + color=common_types.Color(0, 0, 255, 255), + ), + wang_set.WangColor( + name="Dirt", + probability=1, + tile=-1, + color=common_types.Color(255, 119, 0, 255), + ), + ], + wang_tiles={ + 0: wang_set.WangTile(tile_id=0, wang_id=[1, 1, 0, 2, 0, 1, 1, 1]), + 1: wang_set.WangTile(tile_id=1, wang_id=[1, 1, 0, 2, 2, 2, 0, 1]), + 2: wang_set.WangTile(tile_id=2, wang_id=[1, 1, 1, 1, 0, 2, 0, 1]), + 3: wang_set.WangTile(tile_id=3, wang_id=[4, 4, 0, 1, 0, 4, 4, 4]), + 4: wang_set.WangTile(tile_id=4, wang_id=[4, 4, 4, 4, 0, 1, 0, 4]), + 5: wang_set.WangTile(tile_id=5, wang_id=[1, 1, 0, 4, 0, 1, 1, 1]), + 6: wang_set.WangTile(tile_id=6, wang_id=[1, 1, 0, 4, 4, 4, 0, 1]), + 7: wang_set.WangTile(tile_id=7, wang_id=[1, 1, 1, 1, 0, 4, 0, 1]), + 8: wang_set.WangTile(tile_id=8, wang_id=[0, 2, 2, 2, 0, 1, 1, 1]), + 9: wang_set.WangTile(tile_id=9, wang_id=[2, 2, 2, 2, 2, 2, 2, 2]), + 10: wang_set.WangTile(tile_id=10, wang_id=[0, 1, 1, 1, 0, 2, 2, 2]), + 11: wang_set.WangTile(tile_id=11, wang_id=[0, 1, 0, 4, 4, 4, 4, 4]), + 12: wang_set.WangTile(tile_id=12, wang_id=[0, 4, 4, 4, 4, 4, 0, 1]), + 13: wang_set.WangTile(tile_id=13, wang_id=[0, 4, 4, 4, 0, 1, 1, 1]), + 14: wang_set.WangTile(tile_id=14, wang_id=[4, 4, 4, 4, 4, 4, 4, 4]), + 15: wang_set.WangTile(tile_id=15, wang_id=[0, 1, 1, 1, 0, 4, 4, 4]), + 16: wang_set.WangTile(tile_id=16, wang_id=[0, 2, 0, 1, 1, 1, 1, 1]), + 17: wang_set.WangTile(tile_id=17, wang_id=[2, 2, 0, 1, 1, 1, 0, 2]), + 18: wang_set.WangTile(tile_id=18, wang_id=[0, 1, 1, 1, 1, 1, 0, 2]), + 19: wang_set.WangTile(tile_id=19, wang_id=[2, 2, 0, 1, 0, 2, 2, 2]), + 20: wang_set.WangTile(tile_id=20, wang_id=[2, 2, 2, 2, 0, 1, 0, 2]), + 21: wang_set.WangTile(tile_id=21, wang_id=[0, 4, 0, 1, 1, 1, 1, 1]), + 22: wang_set.WangTile(tile_id=22, wang_id=[4, 4, 0, 1, 1, 1, 0, 4]), + 23: wang_set.WangTile(tile_id=23, wang_id=[0, 1, 1, 1, 1, 1, 0, 4]), + 24: wang_set.WangTile(tile_id=24, wang_id=[1, 1, 0, 3, 0, 1, 1, 1]), + 25: wang_set.WangTile(tile_id=25, wang_id=[1, 1, 0, 3, 3, 3, 0, 1]), + 26: wang_set.WangTile(tile_id=26, wang_id=[1, 1, 1, 1, 0, 3, 0, 1]), + 27: wang_set.WangTile(tile_id=27, wang_id=[0, 1, 0, 2, 2, 2, 2, 2]), + 28: wang_set.WangTile(tile_id=28, wang_id=[0, 2, 2, 2, 2, 2, 0, 1]), + 29: wang_set.WangTile(tile_id=29, wang_id=[1, 1, 1, 1, 1, 1, 1, 1]), + 32: wang_set.WangTile(tile_id=32, wang_id=[0, 3, 3, 3, 0, 1, 1, 1]), + 33: wang_set.WangTile(tile_id=33, wang_id=[3, 3, 3, 3, 3, 3, 3, 3]), + 34: wang_set.WangTile(tile_id=34, wang_id=[0, 1, 1, 1, 0, 3, 3, 3]), + 35: wang_set.WangTile(tile_id=35, wang_id=[3, 3, 0, 1, 0, 3, 3, 3]), + 36: wang_set.WangTile(tile_id=36, wang_id=[3, 3, 3, 3, 0, 1, 0, 3]), + 40: wang_set.WangTile(tile_id=40, wang_id=[0, 3, 0, 1, 1, 1, 1, 1]), + 41: wang_set.WangTile(tile_id=41, wang_id=[3, 3, 0, 1, 1, 1, 0, 3]), + 42: wang_set.WangTile(tile_id=42, wang_id=[0, 1, 1, 1, 1, 1, 0, 3]), + 43: wang_set.WangTile(tile_id=43, wang_id=[0, 1, 0, 3, 3, 3, 3, 3]), + 44: wang_set.WangTile(tile_id=44, wang_id=[0, 3, 3, 3, 3, 3, 0, 1]), + }, + ) ], - tiles={ - 0: tileset.Tile( - id=0, - terrain=tileset.TileTerrain( - top_left=0, top_right=0, bottom_left=0, bottom_right=1 - ), - ), - 1: tileset.Tile( - id=1, - terrain=tileset.TileTerrain( - top_left=0, top_right=0, bottom_left=1, bottom_right=1 - ), - ), - 2: tileset.Tile( - id=2, - terrain=tileset.TileTerrain( - top_left=0, top_right=0, bottom_left=1, bottom_right=0 - ), - ), - 3: tileset.Tile( - id=3, - terrain=tileset.TileTerrain( - top_left=3, top_right=3, bottom_left=3, bottom_right=0 - ), - ), - 4: tileset.Tile( - id=4, - terrain=tileset.TileTerrain( - top_left=3, top_right=3, bottom_left=0, bottom_right=3 - ), - ), - 5: tileset.Tile( - id=5, - terrain=tileset.TileTerrain( - top_left=0, top_right=0, bottom_left=0, bottom_right=3 - ), - ), - 6: tileset.Tile( - id=6, - terrain=tileset.TileTerrain( - top_left=0, top_right=0, bottom_left=3, bottom_right=3 - ), - ), - 7: tileset.Tile( - id=7, - terrain=tileset.TileTerrain( - top_left=0, top_right=0, bottom_left=3, bottom_right=0 - ), - ), - 8: tileset.Tile( - id=8, - terrain=tileset.TileTerrain( - top_left=0, top_right=1, bottom_left=0, bottom_right=1 - ), - ), - 9: tileset.Tile( - id=9, - terrain=tileset.TileTerrain( - top_left=1, top_right=1, bottom_left=1, bottom_right=1 - ), - ), - 10: tileset.Tile( - id=10, - terrain=tileset.TileTerrain( - top_left=1, top_right=0, bottom_left=1, bottom_right=0 - ), - ), - 11: tileset.Tile( - id=11, - terrain=tileset.TileTerrain( - top_left=3, top_right=0, bottom_left=3, bottom_right=3 - ), - ), - 12: tileset.Tile( - id=12, - terrain=tileset.TileTerrain( - top_left=0, top_right=3, bottom_left=3, bottom_right=3 - ), - ), - 13: tileset.Tile( - id=13, - terrain=tileset.TileTerrain( - top_left=0, top_right=3, bottom_left=0, bottom_right=3 - ), - ), - 14: tileset.Tile( - id=14, - terrain=tileset.TileTerrain( - top_left=3, top_right=3, bottom_left=3, bottom_right=3 - ), - ), - 15: tileset.Tile( - id=15, - terrain=tileset.TileTerrain( - top_left=3, top_right=0, bottom_left=3, bottom_right=0 - ), - ), - 16: tileset.Tile( - id=16, - terrain=tileset.TileTerrain( - top_left=0, top_right=1, bottom_left=0, bottom_right=0 - ), - ), - 17: tileset.Tile( - id=17, - terrain=tileset.TileTerrain( - top_left=1, top_right=1, bottom_left=0, bottom_right=0 - ), - ), - 18: tileset.Tile( - id=18, - terrain=tileset.TileTerrain( - top_left=1, top_right=0, bottom_left=0, bottom_right=0 - ), - ), - 19: tileset.Tile( - id=19, - terrain=tileset.TileTerrain( - top_left=1, top_right=1, bottom_left=1, bottom_right=0 - ), - ), - 20: tileset.Tile( - id=20, - terrain=tileset.TileTerrain( - top_left=1, top_right=1, bottom_left=0, bottom_right=1 - ), - ), - 21: tileset.Tile( - id=21, - terrain=tileset.TileTerrain( - top_left=0, top_right=3, bottom_left=0, bottom_right=0 - ), - ), - 22: tileset.Tile( - id=22, - terrain=tileset.TileTerrain( - top_left=3, top_right=3, bottom_left=0, bottom_right=0 - ), - ), - 23: tileset.Tile( - id=23, - terrain=tileset.TileTerrain( - top_left=3, top_right=0, bottom_left=0, bottom_right=0 - ), - ), - 24: tileset.Tile( - id=24, - terrain=tileset.TileTerrain( - top_left=0, top_right=0, bottom_left=0, bottom_right=2 - ), - ), - 25: tileset.Tile( - id=25, - terrain=tileset.TileTerrain( - top_left=0, top_right=0, bottom_left=2, bottom_right=2 - ), - ), - 26: tileset.Tile( - id=26, - terrain=tileset.TileTerrain( - top_left=0, top_right=0, bottom_left=2, bottom_right=0 - ), - ), - 27: tileset.Tile( - id=27, - terrain=tileset.TileTerrain( - top_left=1, top_right=0, bottom_left=1, bottom_right=1 - ), - ), - 28: tileset.Tile( - id=28, - terrain=tileset.TileTerrain( - top_left=0, top_right=1, bottom_left=1, bottom_right=1 - ), - ), - 29: tileset.Tile( - id=29, - terrain=tileset.TileTerrain( - top_left=0, top_right=0, bottom_left=0, bottom_right=0 - ), - ), - 32: tileset.Tile( - id=32, - terrain=tileset.TileTerrain( - top_left=0, top_right=2, bottom_left=0, bottom_right=2 - ), - ), - 33: tileset.Tile( - id=33, - terrain=tileset.TileTerrain( - top_left=2, top_right=2, bottom_left=2, bottom_right=2 - ), - ), - 34: tileset.Tile( - id=34, - terrain=tileset.TileTerrain( - top_left=2, top_right=0, bottom_left=2, bottom_right=0 - ), - ), - 35: tileset.Tile( - id=35, - terrain=tileset.TileTerrain( - top_left=2, top_right=2, bottom_left=2, bottom_right=0 - ), - ), - 36: tileset.Tile( - id=36, - terrain=tileset.TileTerrain( - top_left=2, top_right=2, bottom_left=0, bottom_right=2 - ), - ), - 40: tileset.Tile( - id=40, - terrain=tileset.TileTerrain( - top_left=0, top_right=2, bottom_left=0, bottom_right=0 - ), - ), - 41: tileset.Tile( - id=41, - terrain=tileset.TileTerrain( - top_left=2, top_right=2, bottom_left=0, bottom_right=0 - ), - ), - 42: tileset.Tile( - id=42, - terrain=tileset.TileTerrain( - top_left=2, top_right=0, bottom_left=0, bottom_right=0 - ), - ), - 43: tileset.Tile( - id=43, - terrain=tileset.TileTerrain( - top_left=2, top_right=0, bottom_left=2, bottom_right=2 - ), - ), - 44: tileset.Tile( - id=44, - terrain=tileset.TileTerrain( - top_left=0, top_right=2, bottom_left=2, bottom_right=2 - ), - ), - }, ) diff --git a/tests/test_data/tilesets/terrain/tileset.json b/tests/test_data/tilesets/terrain/tileset.json index 4bd9d32a..e43b4fb1 100644 --- a/tests/test_data/tilesets/terrain/tileset.json +++ b/tests/test_data/tilesets/terrain/tileset.json @@ -1,206 +1,206 @@ { "columns":8, - "editorsettings": - { - "export": - { - "format":"", - "target":"." - } - }, "image":"..\/..\/images\/tmw_desert_spacing.png", "imageheight":199, "imagewidth":265, "margin":1, "name":"tileset", "spacing":1, - "terrains":[ - { - "name":"Sand", - "properties":[ - { - "name":"terrain property", - "type":"string", - "value":"test terrain property" - }], - "tile":29 - }, - { - "name":"Cobblestone", - "tile":29 - }, - { - "name":"Pavement", - "tile":29 - }, - { - "name":"Dirt", - "tile":29 - }], "tilecount":48, - "tiledversion":"1.3.5", + "tiledversion":"1.6.0", "tileheight":32, - "tiles":[ - { - "id":0, - "terrain":[0, 0, 0, 1] - }, - { - "id":1, - "terrain":[0, 0, 1, 1] - }, - { - "id":2, - "terrain":[0, 0, 1, 0] - }, - { - "id":3, - "terrain":[3, 3, 3, 0] - }, - { - "id":4, - "terrain":[3, 3, 0, 3] - }, - { - "id":5, - "terrain":[0, 0, 0, 3] - }, - { - "id":6, - "terrain":[0, 0, 3, 3] - }, - { - "id":7, - "terrain":[0, 0, 3, 0] - }, - { - "id":8, - "terrain":[0, 1, 0, 1] - }, - { - "id":9, - "terrain":[1, 1, 1, 1] - }, - { - "id":10, - "terrain":[1, 0, 1, 0] - }, - { - "id":11, - "terrain":[3, 0, 3, 3] - }, - { - "id":12, - "terrain":[0, 3, 3, 3] - }, - { - "id":13, - "terrain":[0, 3, 0, 3] - }, - { - "id":14, - "terrain":[3, 3, 3, 3] - }, - { - "id":15, - "terrain":[3, 0, 3, 0] - }, - { - "id":16, - "terrain":[0, 1, 0, 0] - }, - { - "id":17, - "terrain":[1, 1, 0, 0] - }, - { - "id":18, - "terrain":[1, 0, 0, 0] - }, - { - "id":19, - "terrain":[1, 1, 1, 0] - }, - { - "id":20, - "terrain":[1, 1, 0, 1] - }, - { - "id":21, - "terrain":[0, 3, 0, 0] - }, - { - "id":22, - "terrain":[3, 3, 0, 0] - }, - { - "id":23, - "terrain":[3, 0, 0, 0] - }, - { - "id":24, - "terrain":[0, 0, 0, 2] - }, - { - "id":25, - "terrain":[0, 0, 2, 2] - }, - { - "id":26, - "terrain":[0, 0, 2, 0] - }, - { - "id":27, - "terrain":[1, 0, 1, 1] - }, - { - "id":28, - "terrain":[0, 1, 1, 1] - }, - { - "id":29, - "terrain":[0, 0, 0, 0] - }, - { - "id":32, - "terrain":[0, 2, 0, 2] - }, - { - "id":33, - "terrain":[2, 2, 2, 2] - }, - { - "id":34, - "terrain":[2, 0, 2, 0] - }, - { - "id":35, - "terrain":[2, 2, 2, 0] - }, - { - "id":36, - "terrain":[2, 2, 0, 2] - }, - { - "id":40, - "terrain":[0, 2, 0, 0] - }, - { - "id":41, - "terrain":[2, 2, 0, 0] - }, - { - "id":42, - "terrain":[2, 0, 0, 0] - }, - { - "id":43, - "terrain":[2, 0, 2, 2] - }, - { - "id":44, - "terrain":[0, 2, 2, 2] - }], "tilewidth":32, "type":"tileset", - "version":1.2 + "version":"1.6", + "wangsets":[ + { + "colors":[ + { + "color":"#ff0000", + "name":"Sand", + "probability":1, + "tile":-1 + }, + { + "color":"#00ff00", + "name":"Cobblestone", + "probability":1, + "tile":-1 + }, + { + "color":"#0000ff", + "name":"Pavement", + "probability":1, + "tile":-1 + }, + { + "color":"#ff7700", + "name":"Dirt", + "probability":1, + "tile":-1 + }], + "name":"Terrains", + "tile":-1, + "type":"mixed", + "wangtiles":[ + { + "tileid":0, + "wangid":[1, 1, 0, 2, 0, 1, 1, 1] + }, + { + "tileid":1, + "wangid":[1, 1, 0, 2, 2, 2, 0, 1] + }, + { + "tileid":2, + "wangid":[1, 1, 1, 1, 0, 2, 0, 1] + }, + { + "tileid":3, + "wangid":[4, 4, 0, 1, 0, 4, 4, 4] + }, + { + "tileid":4, + "wangid":[4, 4, 4, 4, 0, 1, 0, 4] + }, + { + "tileid":5, + "wangid":[1, 1, 0, 4, 0, 1, 1, 1] + }, + { + "tileid":6, + "wangid":[1, 1, 0, 4, 4, 4, 0, 1] + }, + { + "tileid":7, + "wangid":[1, 1, 1, 1, 0, 4, 0, 1] + }, + { + "tileid":8, + "wangid":[0, 2, 2, 2, 0, 1, 1, 1] + }, + { + "tileid":9, + "wangid":[2, 2, 2, 2, 2, 2, 2, 2] + }, + { + "tileid":10, + "wangid":[0, 1, 1, 1, 0, 2, 2, 2] + }, + { + "tileid":11, + "wangid":[0, 1, 0, 4, 4, 4, 4, 4] + }, + { + "tileid":12, + "wangid":[0, 4, 4, 4, 4, 4, 0, 1] + }, + { + "tileid":13, + "wangid":[0, 4, 4, 4, 0, 1, 1, 1] + }, + { + "tileid":14, + "wangid":[4, 4, 4, 4, 4, 4, 4, 4] + }, + { + "tileid":15, + "wangid":[0, 1, 1, 1, 0, 4, 4, 4] + }, + { + "tileid":16, + "wangid":[0, 2, 0, 1, 1, 1, 1, 1] + }, + { + "tileid":17, + "wangid":[2, 2, 0, 1, 1, 1, 0, 2] + }, + { + "tileid":18, + "wangid":[0, 1, 1, 1, 1, 1, 0, 2] + }, + { + "tileid":19, + "wangid":[2, 2, 0, 1, 0, 2, 2, 2] + }, + { + "tileid":20, + "wangid":[2, 2, 2, 2, 0, 1, 0, 2] + }, + { + "tileid":21, + "wangid":[0, 4, 0, 1, 1, 1, 1, 1] + }, + { + "tileid":22, + "wangid":[4, 4, 0, 1, 1, 1, 0, 4] + }, + { + "tileid":23, + "wangid":[0, 1, 1, 1, 1, 1, 0, 4] + }, + { + "tileid":24, + "wangid":[1, 1, 0, 3, 0, 1, 1, 1] + }, + { + "tileid":25, + "wangid":[1, 1, 0, 3, 3, 3, 0, 1] + }, + { + "tileid":26, + "wangid":[1, 1, 1, 1, 0, 3, 0, 1] + }, + { + "tileid":27, + "wangid":[0, 1, 0, 2, 2, 2, 2, 2] + }, + { + "tileid":28, + "wangid":[0, 2, 2, 2, 2, 2, 0, 1] + }, + { + "tileid":29, + "wangid":[1, 1, 1, 1, 1, 1, 1, 1] + }, + { + "tileid":32, + "wangid":[0, 3, 3, 3, 0, 1, 1, 1] + }, + { + "tileid":33, + "wangid":[3, 3, 3, 3, 3, 3, 3, 3] + }, + { + "tileid":34, + "wangid":[0, 1, 1, 1, 0, 3, 3, 3] + }, + { + "tileid":35, + "wangid":[3, 3, 0, 1, 0, 3, 3, 3] + }, + { + "tileid":36, + "wangid":[3, 3, 3, 3, 0, 1, 0, 3] + }, + { + "tileid":40, + "wangid":[0, 3, 0, 1, 1, 1, 1, 1] + }, + { + "tileid":41, + "wangid":[3, 3, 0, 1, 1, 1, 0, 3] + }, + { + "tileid":42, + "wangid":[0, 1, 1, 1, 1, 1, 0, 3] + }, + { + "tileid":43, + "wangid":[0, 1, 0, 3, 3, 3, 3, 3] + }, + { + "tileid":44, + "wangid":[0, 3, 3, 3, 3, 3, 0, 1] + }] + }] } \ No newline at end of file diff --git a/tests/test_data/tilesets/wangsets/map.json b/tests/test_data/tilesets/wangsets/map.json index d2fe741d..6a7ee271 100644 --- a/tests/test_data/tilesets/wangsets/map.json +++ b/tests/test_data/tilesets/wangsets/map.json @@ -18,7 +18,7 @@ "nextobjectid":1, "orientation":"orthogonal", "renderorder":"right-down", - "tiledversion":"1.3.5", + "tiledversion":"1.6.0", "tileheight":32, "tilesets":[ { @@ -27,6 +27,6 @@ }], "tilewidth":32, "type":"map", - "version":1.2, + "version":"1.6", "width":20 } \ No newline at end of file diff --git a/tests/test_data/tilesets/wangsets/tileset.json b/tests/test_data/tilesets/wangsets/tileset.json index 76ab027a..461197ba 100644 --- a/tests/test_data/tilesets/wangsets/tileset.json +++ b/tests/test_data/tilesets/wangsets/tileset.json @@ -6,15 +6,14 @@ "name":"tileset", "spacing":0, "tilecount":81, - "tiledversion":"1.3.5", + "tiledversion":"1.6.0", "tileheight":32, "tilewidth":32, "type":"tileset", - "version":1.2, + "version":"1.6", "wangsets":[ { - "cornercolors":[], - "edgecolors":[ + "colors":[ { "color":"#ff0000", "name":"Path", @@ -35,572 +34,330 @@ }], "name":"My Wang Set", "tile":-1, + "type":"edge", "wangtiles":[ { - "dflip":false, - "hflip":false, "tileid":0, - "vflip":false, "wangid":[2, 0, 3, 0, 3, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":1, - "vflip":false, "wangid":[2, 0, 3, 0, 3, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":2, - "vflip":false, "wangid":[2, 0, 1, 0, 3, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":3, - "vflip":false, "wangid":[2, 0, 3, 0, 3, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":4, - "vflip":false, "wangid":[2, 0, 2, 0, 3, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":5, - "vflip":false, "wangid":[2, 0, 1, 0, 3, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":6, - "vflip":false, "wangid":[2, 0, 1, 0, 3, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":7, - "vflip":false, "wangid":[2, 0, 2, 0, 3, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":8, - "vflip":false, "wangid":[2, 0, 2, 0, 3, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":9, - "vflip":false, "wangid":[3, 0, 3, 0, 3, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":10, - "vflip":false, "wangid":[3, 0, 3, 0, 3, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":11, - "vflip":false, "wangid":[3, 0, 1, 0, 3, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":12, - "vflip":false, "wangid":[3, 0, 3, 0, 3, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":13, - "vflip":false, "wangid":[3, 0, 2, 0, 3, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":14, - "vflip":false, "wangid":[3, 0, 1, 0, 3, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":15, - "vflip":false, "wangid":[3, 0, 1, 0, 3, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":16, - "vflip":false, "wangid":[3, 0, 2, 0, 3, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":17, - "vflip":false, "wangid":[3, 0, 2, 0, 3, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":18, - "vflip":false, "wangid":[3, 0, 3, 0, 1, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":19, - "vflip":false, "wangid":[3, 0, 3, 0, 1, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":20, - "vflip":false, "wangid":[3, 0, 1, 0, 1, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":21, - "vflip":false, "wangid":[3, 0, 3, 0, 1, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":22, - "vflip":false, "wangid":[3, 0, 2, 0, 1, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":23, - "vflip":false, "wangid":[3, 0, 1, 0, 1, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":24, - "vflip":false, "wangid":[3, 0, 1, 0, 1, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":25, - "vflip":false, "wangid":[3, 0, 2, 0, 1, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":26, - "vflip":false, "wangid":[3, 0, 2, 0, 1, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":27, - "vflip":false, "wangid":[1, 0, 3, 0, 3, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":28, - "vflip":false, "wangid":[1, 0, 3, 0, 3, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":29, - "vflip":false, "wangid":[1, 0, 1, 0, 3, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":30, - "vflip":false, "wangid":[1, 0, 3, 0, 3, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":31, - "vflip":false, "wangid":[1, 0, 2, 0, 3, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":32, - "vflip":false, "wangid":[1, 0, 1, 0, 3, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":33, - "vflip":false, "wangid":[1, 0, 1, 0, 3, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":34, - "vflip":false, "wangid":[1, 0, 2, 0, 3, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":35, - "vflip":false, "wangid":[1, 0, 2, 0, 3, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":36, - "vflip":false, "wangid":[3, 0, 3, 0, 2, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":37, - "vflip":false, "wangid":[3, 0, 3, 0, 2, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":38, - "vflip":false, "wangid":[3, 0, 1, 0, 2, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":39, - "vflip":false, "wangid":[3, 0, 3, 0, 2, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":40, - "vflip":false, "wangid":[3, 0, 2, 0, 2, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":41, - "vflip":false, "wangid":[3, 0, 1, 0, 2, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":42, - "vflip":false, "wangid":[3, 0, 1, 0, 2, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":43, - "vflip":false, "wangid":[3, 0, 2, 0, 2, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":44, - "vflip":false, "wangid":[3, 0, 2, 0, 2, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":45, - "vflip":false, "wangid":[2, 0, 3, 0, 1, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":46, - "vflip":false, "wangid":[2, 0, 3, 0, 1, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":47, - "vflip":false, "wangid":[2, 0, 1, 0, 1, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":48, - "vflip":false, "wangid":[2, 0, 3, 0, 1, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":49, - "vflip":false, "wangid":[2, 0, 2, 0, 1, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":50, - "vflip":false, "wangid":[2, 0, 1, 0, 1, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":51, - "vflip":false, "wangid":[2, 0, 1, 0, 1, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":52, - "vflip":false, "wangid":[2, 0, 2, 0, 1, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":53, - "vflip":false, "wangid":[2, 0, 2, 0, 1, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":54, - "vflip":false, "wangid":[1, 0, 3, 0, 1, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":55, - "vflip":false, "wangid":[1, 0, 3, 0, 1, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":56, - "vflip":false, "wangid":[1, 0, 1, 0, 1, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":57, - "vflip":false, "wangid":[1, 0, 3, 0, 1, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":58, - "vflip":false, "wangid":[1, 0, 2, 0, 1, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":59, - "vflip":false, "wangid":[1, 0, 1, 0, 1, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":60, - "vflip":false, "wangid":[1, 0, 1, 0, 1, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":61, - "vflip":false, "wangid":[1, 0, 2, 0, 1, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":62, - "vflip":false, "wangid":[1, 0, 2, 0, 1, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":63, - "vflip":false, "wangid":[1, 0, 3, 0, 2, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":64, - "vflip":false, "wangid":[1, 0, 3, 0, 2, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":65, - "vflip":false, "wangid":[1, 0, 1, 0, 2, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":66, - "vflip":false, "wangid":[1, 0, 3, 0, 2, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":67, - "vflip":false, "wangid":[1, 0, 2, 0, 2, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":68, - "vflip":false, "wangid":[1, 0, 1, 0, 2, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":69, - "vflip":false, "wangid":[1, 0, 1, 0, 2, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":70, - "vflip":false, "wangid":[1, 0, 2, 0, 2, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":71, - "vflip":false, "wangid":[1, 0, 2, 0, 2, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":72, - "vflip":false, "wangid":[2, 0, 3, 0, 2, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":73, - "vflip":false, "wangid":[2, 0, 3, 0, 2, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":74, - "vflip":false, "wangid":[2, 0, 1, 0, 2, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":75, - "vflip":false, "wangid":[2, 0, 3, 0, 2, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":76, - "vflip":false, "wangid":[2, 0, 2, 0, 2, 0, 3, 0] }, { - "dflip":false, - "hflip":false, "tileid":77, - "vflip":false, "wangid":[2, 0, 1, 0, 2, 0, 2, 0] }, { - "dflip":false, - "hflip":false, "tileid":78, - "vflip":false, "wangid":[2, 0, 1, 0, 2, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":79, - "vflip":false, "wangid":[2, 0, 2, 0, 2, 0, 1, 0] }, { - "dflip":false, - "hflip":false, "tileid":80, - "vflip":false, "wangid":[2, 0, 2, 0, 2, 0, 2, 0] }] }] diff --git a/tests/test_data/world_tests/both/expected.py b/tests/test_data/world_tests/both/expected.py new file mode 100644 index 00000000..2fcf7389 --- /dev/null +++ b/tests/test_data/world_tests/both/expected.py @@ -0,0 +1,177 @@ +from pathlib import Path + +from pytiled_parser import common_types, layer, tiled_map, tileset, world + +EXPECTED = world.World( + only_show_adjacent=False, + maps=[ + world.WorldMap( + size=common_types.Size(160, 160), + coordinates=common_types.OrderedPair(-160, 0), + tiled_map=tiled_map.TiledMap( + map_file=Path(Path(__file__).parent / "map_manual_one.json") + .absolute() + .resolve(), + infinite=False, + map_size=common_types.Size(5, 5), + next_layer_id=2, + next_object_id=1, + orientation="orthogonal", + render_order="right-down", + tiled_version="1.6.0", + tile_size=common_types.Size(32, 32), + version="1.6", + tilesets={ + 1: tileset.Tileset( + columns=8, + image=Path( + Path(__file__).parent + / "../../images/tmw_desert_spacing.png" + ) + .absolute() + .resolve(), + image_width=265, + image_height=199, + margin=1, + spacing=1, + name="tileset", + tile_count=48, + tiled_version="1.6.0", + tile_height=32, + tile_width=32, + version="1.6", + type="tileset", + ) + }, + layers=[ + layer.TileLayer( + name="Tile Layer 1", + opacity=1, + visible=True, + id=1, + size=common_types.Size(5, 5), + data=[ + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + ], + ) + ], + ), + ), + world.WorldMap( + size=common_types.Size(160, 160), + coordinates=common_types.OrderedPair(0, 0), + tiled_map=tiled_map.TiledMap( + map_file=Path(Path(__file__).parent / "map_p0-n0.json") + .absolute() + .resolve(), + infinite=False, + map_size=common_types.Size(5, 5), + next_layer_id=2, + next_object_id=1, + orientation="orthogonal", + render_order="right-down", + tiled_version="1.6.0", + tile_size=common_types.Size(32, 32), + version="1.6", + tilesets={ + 1: tileset.Tileset( + columns=8, + image=Path( + Path(__file__).parent + / "../../images/tmw_desert_spacing.png" + ) + .absolute() + .resolve(), + image_width=265, + image_height=199, + margin=1, + spacing=1, + name="tileset", + tile_count=48, + tiled_version="1.6.0", + tile_height=32, + tile_width=32, + version="1.6", + type="tileset", + ) + }, + layers=[ + layer.TileLayer( + name="Tile Layer 1", + opacity=1, + visible=True, + id=1, + size=common_types.Size(5, 5), + data=[ + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + ], + ) + ], + ), + ), + world.WorldMap( + size=common_types.Size(160, 160), + coordinates=common_types.OrderedPair(0, 160), + tiled_map=tiled_map.TiledMap( + map_file=Path(Path(__file__).parent / "map_p0-n1.json") + .absolute() + .resolve(), + infinite=False, + map_size=common_types.Size(5, 5), + next_layer_id=2, + next_object_id=1, + orientation="orthogonal", + render_order="right-down", + tiled_version="1.6.0", + tile_size=common_types.Size(32, 32), + version="1.6", + tilesets={ + 1: tileset.Tileset( + columns=8, + image=Path( + Path(__file__).parent + / "../../images/tmw_desert_spacing.png" + ) + .absolute() + .resolve(), + image_width=265, + image_height=199, + margin=1, + spacing=1, + name="tileset", + tile_count=48, + tiled_version="1.6.0", + tile_height=32, + tile_width=32, + version="1.6", + type="tileset", + ) + }, + layers=[ + layer.TileLayer( + name="Tile Layer 1", + opacity=1, + visible=True, + id=1, + size=common_types.Size(5, 5), + data=[ + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + ], + ) + ], + ), + ), + ], +) diff --git a/tests/test_data/world_tests/both/map_manual_one.json b/tests/test_data/world_tests/both/map_manual_one.json new file mode 100644 index 00000000..db2e54a9 --- /dev/null +++ b/tests/test_data/world_tests/both/map_manual_one.json @@ -0,0 +1,32 @@ +{ "compressionlevel":-1, + "height":5, + "infinite":false, + "layers":[ + { + "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], + "height":5, + "id":1, + "name":"Tile Layer 1", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":5, + "x":0, + "y":0 + }], + "nextlayerid":2, + "nextobjectid":1, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.6.0", + "tileheight":32, + "tilesets":[ + { + "firstgid":1, + "source":"tileset.json" + }], + "tilewidth":32, + "type":"map", + "version":"1.6", + "width":5 +} \ No newline at end of file diff --git a/tests/test_data/world_tests/both/map_p0-n0.json b/tests/test_data/world_tests/both/map_p0-n0.json new file mode 100644 index 00000000..db2e54a9 --- /dev/null +++ b/tests/test_data/world_tests/both/map_p0-n0.json @@ -0,0 +1,32 @@ +{ "compressionlevel":-1, + "height":5, + "infinite":false, + "layers":[ + { + "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], + "height":5, + "id":1, + "name":"Tile Layer 1", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":5, + "x":0, + "y":0 + }], + "nextlayerid":2, + "nextobjectid":1, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.6.0", + "tileheight":32, + "tilesets":[ + { + "firstgid":1, + "source":"tileset.json" + }], + "tilewidth":32, + "type":"map", + "version":"1.6", + "width":5 +} \ No newline at end of file diff --git a/tests/test_data/world_tests/both/map_p0-n1.json b/tests/test_data/world_tests/both/map_p0-n1.json new file mode 100644 index 00000000..db2e54a9 --- /dev/null +++ b/tests/test_data/world_tests/both/map_p0-n1.json @@ -0,0 +1,32 @@ +{ "compressionlevel":-1, + "height":5, + "infinite":false, + "layers":[ + { + "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], + "height":5, + "id":1, + "name":"Tile Layer 1", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":5, + "x":0, + "y":0 + }], + "nextlayerid":2, + "nextobjectid":1, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.6.0", + "tileheight":32, + "tilesets":[ + { + "firstgid":1, + "source":"tileset.json" + }], + "tilewidth":32, + "type":"map", + "version":"1.6", + "width":5 +} \ No newline at end of file diff --git a/tests/test_data/world_tests/both/tileset.json b/tests/test_data/world_tests/both/tileset.json new file mode 100644 index 00000000..6f07285a --- /dev/null +++ b/tests/test_data/world_tests/both/tileset.json @@ -0,0 +1,14 @@ +{ "columns":8, + "image":"..\/..\/images\/tmw_desert_spacing.png", + "imageheight":199, + "imagewidth":265, + "margin":1, + "name":"tileset", + "spacing":1, + "tilecount":48, + "tiledversion":"1.6.0", + "tileheight":32, + "tilewidth":32, + "type":"tileset", + "version":"1.6" +} \ No newline at end of file diff --git a/tests/test_data/world_tests/both/world.world b/tests/test_data/world_tests/both/world.world new file mode 100644 index 00000000..83164384 --- /dev/null +++ b/tests/test_data/world_tests/both/world.world @@ -0,0 +1,22 @@ +{ + "maps": [ + { + "fileName": "map_manual_one.json", + "height": 160, + "width": 160, + "x": -160, + "y": 0 + } + ], + "patterns": [ + { + "regexp": "map_p(\\d+)-n(\\d+)\\.json", + "multiplierX": 160, + "multiplierY": 160, + "offsetX": 0, + "offsetY": 0 + } + ], + "onlyShowAdjacentMaps": false, + "type": "world" +} \ No newline at end of file diff --git a/tests/test_data/world_tests/pattern_matched/expected.py b/tests/test_data/world_tests/pattern_matched/expected.py new file mode 100644 index 00000000..b6ab9f0e --- /dev/null +++ b/tests/test_data/world_tests/pattern_matched/expected.py @@ -0,0 +1,121 @@ +from pathlib import Path + +from pytiled_parser import common_types, layer, tiled_map, tileset, world + +EXPECTED = world.World( + only_show_adjacent=False, + maps=[ + world.WorldMap( + size=common_types.Size(160, 160), + coordinates=common_types.OrderedPair(0, 0), + tiled_map=tiled_map.TiledMap( + map_file=Path(Path(__file__).parent / "map_p0-n0.json") + .absolute() + .resolve(), + infinite=False, + map_size=common_types.Size(5, 5), + next_layer_id=2, + next_object_id=1, + orientation="orthogonal", + render_order="right-down", + tiled_version="1.6.0", + tile_size=common_types.Size(32, 32), + version="1.6", + tilesets={ + 1: tileset.Tileset( + columns=8, + image=Path( + Path(__file__).parent + / "../../images/tmw_desert_spacing.png" + ) + .absolute() + .resolve(), + image_width=265, + image_height=199, + margin=1, + spacing=1, + name="tileset", + tile_count=48, + tiled_version="1.6.0", + tile_height=32, + tile_width=32, + version="1.6", + type="tileset", + ) + }, + layers=[ + layer.TileLayer( + name="Tile Layer 1", + opacity=1, + visible=True, + id=1, + size=common_types.Size(5, 5), + data=[ + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + ], + ) + ], + ), + ), + world.WorldMap( + size=common_types.Size(160, 160), + coordinates=common_types.OrderedPair(0, 160), + tiled_map=tiled_map.TiledMap( + map_file=Path(Path(__file__).parent / "map_p0-n1.json") + .absolute() + .resolve(), + infinite=False, + map_size=common_types.Size(5, 5), + next_layer_id=2, + next_object_id=1, + orientation="orthogonal", + render_order="right-down", + tiled_version="1.6.0", + tile_size=common_types.Size(32, 32), + version="1.6", + tilesets={ + 1: tileset.Tileset( + columns=8, + image=Path( + Path(__file__).parent + / "../../images/tmw_desert_spacing.png" + ) + .absolute() + .resolve(), + image_width=265, + image_height=199, + margin=1, + spacing=1, + name="tileset", + tile_count=48, + tiled_version="1.6.0", + tile_height=32, + tile_width=32, + version="1.6", + type="tileset", + ) + }, + layers=[ + layer.TileLayer( + name="Tile Layer 1", + opacity=1, + visible=True, + id=1, + size=common_types.Size(5, 5), + data=[ + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + ], + ) + ], + ), + ), + ], +) diff --git a/tests/test_data/world_tests/pattern_matched/map_p0-n0.json b/tests/test_data/world_tests/pattern_matched/map_p0-n0.json new file mode 100644 index 00000000..db2e54a9 --- /dev/null +++ b/tests/test_data/world_tests/pattern_matched/map_p0-n0.json @@ -0,0 +1,32 @@ +{ "compressionlevel":-1, + "height":5, + "infinite":false, + "layers":[ + { + "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], + "height":5, + "id":1, + "name":"Tile Layer 1", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":5, + "x":0, + "y":0 + }], + "nextlayerid":2, + "nextobjectid":1, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.6.0", + "tileheight":32, + "tilesets":[ + { + "firstgid":1, + "source":"tileset.json" + }], + "tilewidth":32, + "type":"map", + "version":"1.6", + "width":5 +} \ No newline at end of file diff --git a/tests/test_data/world_tests/pattern_matched/map_p0-n1.json b/tests/test_data/world_tests/pattern_matched/map_p0-n1.json new file mode 100644 index 00000000..db2e54a9 --- /dev/null +++ b/tests/test_data/world_tests/pattern_matched/map_p0-n1.json @@ -0,0 +1,32 @@ +{ "compressionlevel":-1, + "height":5, + "infinite":false, + "layers":[ + { + "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], + "height":5, + "id":1, + "name":"Tile Layer 1", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":5, + "x":0, + "y":0 + }], + "nextlayerid":2, + "nextobjectid":1, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.6.0", + "tileheight":32, + "tilesets":[ + { + "firstgid":1, + "source":"tileset.json" + }], + "tilewidth":32, + "type":"map", + "version":"1.6", + "width":5 +} \ No newline at end of file diff --git a/tests/test_data/world_tests/pattern_matched/tileset.json b/tests/test_data/world_tests/pattern_matched/tileset.json new file mode 100644 index 00000000..6f07285a --- /dev/null +++ b/tests/test_data/world_tests/pattern_matched/tileset.json @@ -0,0 +1,14 @@ +{ "columns":8, + "image":"..\/..\/images\/tmw_desert_spacing.png", + "imageheight":199, + "imagewidth":265, + "margin":1, + "name":"tileset", + "spacing":1, + "tilecount":48, + "tiledversion":"1.6.0", + "tileheight":32, + "tilewidth":32, + "type":"tileset", + "version":"1.6" +} \ No newline at end of file diff --git a/tests/test_data/world_tests/pattern_matched/world.world b/tests/test_data/world_tests/pattern_matched/world.world new file mode 100644 index 00000000..6ad0898f --- /dev/null +++ b/tests/test_data/world_tests/pattern_matched/world.world @@ -0,0 +1,12 @@ +{ + "patterns": [ + { + "regexp": "map_p(\\d+)-n(\\d+)\\.json", + "multiplierX": 160, + "multiplierY": 160, + "offsetX": 0, + "offsetY": 0 + } + ], + "type": "world" +} \ No newline at end of file diff --git a/tests/test_data/world_tests/static_defined/expected.py b/tests/test_data/world_tests/static_defined/expected.py new file mode 100644 index 00000000..b7485776 --- /dev/null +++ b/tests/test_data/world_tests/static_defined/expected.py @@ -0,0 +1,121 @@ +from pathlib import Path + +from pytiled_parser import common_types, layer, tiled_map, tileset, world + +EXPECTED = world.World( + only_show_adjacent=False, + maps=[ + world.WorldMap( + size=common_types.Size(160, 160), + coordinates=common_types.OrderedPair(0, 0), + tiled_map=tiled_map.TiledMap( + map_file=Path(Path(__file__).parent / "map_01.json") + .absolute() + .resolve(), + infinite=False, + map_size=common_types.Size(5, 5), + next_layer_id=2, + next_object_id=1, + orientation="orthogonal", + render_order="right-down", + tiled_version="1.6.0", + tile_size=common_types.Size(32, 32), + version="1.6", + tilesets={ + 1: tileset.Tileset( + columns=8, + image=Path( + Path(__file__).parent + / "../../images/tmw_desert_spacing.png" + ) + .absolute() + .resolve(), + image_width=265, + image_height=199, + margin=1, + spacing=1, + name="tileset", + tile_count=48, + tiled_version="1.6.0", + tile_height=32, + tile_width=32, + version="1.6", + type="tileset", + ) + }, + layers=[ + layer.TileLayer( + name="Tile Layer 1", + opacity=1, + visible=True, + id=1, + size=common_types.Size(5, 5), + data=[ + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + ], + ) + ], + ), + ), + world.WorldMap( + size=common_types.Size(160, 160), + coordinates=common_types.OrderedPair(160, 0), + tiled_map=tiled_map.TiledMap( + map_file=Path(Path(__file__).parent / "map_02.json") + .absolute() + .resolve(), + infinite=False, + map_size=common_types.Size(5, 5), + next_layer_id=2, + next_object_id=1, + orientation="orthogonal", + render_order="right-down", + tiled_version="1.6.0", + tile_size=common_types.Size(32, 32), + version="1.6", + tilesets={ + 1: tileset.Tileset( + columns=8, + image=Path( + Path(__file__).parent + / "../../images/tmw_desert_spacing.png" + ) + .absolute() + .resolve(), + image_width=265, + image_height=199, + margin=1, + spacing=1, + name="tileset", + tile_count=48, + tiled_version="1.6.0", + tile_height=32, + tile_width=32, + version="1.6", + type="tileset", + ) + }, + layers=[ + layer.TileLayer( + name="Tile Layer 1", + opacity=1, + visible=True, + id=1, + size=common_types.Size(5, 5), + data=[ + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + [30, 30, 30, 30, 30], + ], + ) + ], + ), + ), + ], +) diff --git a/tests/test_data/world_tests/static_defined/map_01.json b/tests/test_data/world_tests/static_defined/map_01.json new file mode 100644 index 00000000..db2e54a9 --- /dev/null +++ b/tests/test_data/world_tests/static_defined/map_01.json @@ -0,0 +1,32 @@ +{ "compressionlevel":-1, + "height":5, + "infinite":false, + "layers":[ + { + "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], + "height":5, + "id":1, + "name":"Tile Layer 1", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":5, + "x":0, + "y":0 + }], + "nextlayerid":2, + "nextobjectid":1, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.6.0", + "tileheight":32, + "tilesets":[ + { + "firstgid":1, + "source":"tileset.json" + }], + "tilewidth":32, + "type":"map", + "version":"1.6", + "width":5 +} \ No newline at end of file diff --git a/tests/test_data/world_tests/static_defined/map_02.json b/tests/test_data/world_tests/static_defined/map_02.json new file mode 100644 index 00000000..db2e54a9 --- /dev/null +++ b/tests/test_data/world_tests/static_defined/map_02.json @@ -0,0 +1,32 @@ +{ "compressionlevel":-1, + "height":5, + "infinite":false, + "layers":[ + { + "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], + "height":5, + "id":1, + "name":"Tile Layer 1", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":5, + "x":0, + "y":0 + }], + "nextlayerid":2, + "nextobjectid":1, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.6.0", + "tileheight":32, + "tilesets":[ + { + "firstgid":1, + "source":"tileset.json" + }], + "tilewidth":32, + "type":"map", + "version":"1.6", + "width":5 +} \ No newline at end of file diff --git a/tests/test_data/world_tests/static_defined/tileset.json b/tests/test_data/world_tests/static_defined/tileset.json new file mode 100644 index 00000000..6f07285a --- /dev/null +++ b/tests/test_data/world_tests/static_defined/tileset.json @@ -0,0 +1,14 @@ +{ "columns":8, + "image":"..\/..\/images\/tmw_desert_spacing.png", + "imageheight":199, + "imagewidth":265, + "margin":1, + "name":"tileset", + "spacing":1, + "tilecount":48, + "tiledversion":"1.6.0", + "tileheight":32, + "tilewidth":32, + "type":"tileset", + "version":"1.6" +} \ No newline at end of file diff --git a/tests/test_data/world_tests/static_defined/world.world b/tests/test_data/world_tests/static_defined/world.world new file mode 100644 index 00000000..5cf3e569 --- /dev/null +++ b/tests/test_data/world_tests/static_defined/world.world @@ -0,0 +1,20 @@ +{ + "maps": [ + { + "fileName": "map_01.json", + "height": 160, + "width": 160, + "x": 0, + "y": 0 + }, + { + "fileName": "map_02.json", + "height": 160, + "width": 160, + "x": 160, + "y": 0 + } + ], + "onlyShowAdjacentMaps": false, + "type": "world" +} diff --git a/tests/test_layer.py b/tests/test_layer.py index 165a9932..117761b7 100644 --- a/tests/test_layer.py +++ b/tests/test_layer.py @@ -18,7 +18,7 @@ LAYER_TESTS / "b64", LAYER_TESTS / "b64_gzip", LAYER_TESTS / "b64_zlib", - LAYER_TESTS / "b64_zstd", + # LAYER_TESTS / "b64_zstd", LAYER_TESTS / "no_layers", LAYER_TESTS / "infinite_map", LAYER_TESTS / "infinite_map_b64", diff --git a/tests/test_map.py b/tests/test_map.py index 2d16edb9..00192387 100644 --- a/tests/test_map.py +++ b/tests/test_map.py @@ -17,6 +17,7 @@ MAP_TESTS / "no_background_color", MAP_TESTS / "hexagonal", MAP_TESTS / "embedded_tileset", + MAP_TESTS / "template", ] diff --git a/tests/test_tiled_object.py b/tests/test_tiled_object.py index 63dfd0c6..f202029d 100644 --- a/tests/test_tiled_object.py +++ b/tests/test_tiled_object.py @@ -1103,3 +1103,19 @@ def test_parse_layer(raw_object_json, expected): result = tiled_object.cast(raw_object) assert result == expected + + +def test_parse_no_parent_dir(): + + raw_object = """ + { + "id":1, + "template": "mytemplate.json", + "x":27.7185404115039, + "y":23.571672160964 + } + """ + + json_object = json.loads(raw_object) + with pytest.raises(RuntimeError): + tiled_object.cast(json_object) diff --git a/tests/test_tileset.py b/tests/test_tileset.py index f8a83a19..bca29bd4 100644 --- a/tests/test_tileset.py +++ b/tests/test_tileset.py @@ -20,6 +20,7 @@ TILE_SETS / "image_properties", TILE_SETS / "image_transparent_color", TILE_SETS / "image_tile_offset", + TILE_SETS / "image_transformations", TILE_SETS / "individual_images", TILE_SETS / "terrain", ] diff --git a/tests/test_world.py b/tests/test_world.py new file mode 100644 index 00000000..09024e5c --- /dev/null +++ b/tests/test_world.py @@ -0,0 +1,35 @@ +"""Tests for worlds""" +import importlib.util +import os +from pathlib import Path + +import pytest + +from pytiled_parser import world + +TESTS_DIR = Path(os.path.dirname(os.path.abspath(__file__))) +TEST_DATA = TESTS_DIR / "test_data" +WORLD_TESTS = TEST_DATA / "world_tests" + +ALL_WORLD_TESTS = [ + WORLD_TESTS / "static_defined", + WORLD_TESTS / "pattern_matched", + WORLD_TESTS / "both", +] + + +@pytest.mark.parametrize("world_test", ALL_WORLD_TESTS) +def test_world_integration(world_test): + # it's a PITA to import like this, don't do it + # https://stackoverflow.com/a/67692/1342874 + spec = importlib.util.spec_from_file_location( + "expected", world_test / "expected.py" + ) + expected = importlib.util.module_from_spec(spec) + spec.loader.exec_module(expected) + + raw_world_path = world_test / "world.world" + + casted_world = world.parse_world(raw_world_path) + + assert casted_world == expected.EXPECTED