|
| 1 | +from pathlib import Path |
| 2 | + |
| 3 | +from pytiled_parser import common_types, layer, tiled_map, tiled_object, tileset |
| 4 | + |
| 5 | +EXPECTED = tiled_map.TiledMap( |
| 6 | + infinite=False, |
| 7 | + map_size=common_types.Size(8, 6), |
| 8 | + next_layer_id=3, |
| 9 | + next_object_id=1, |
| 10 | + orientation="orthogonal", |
| 11 | + render_order="right-down", |
| 12 | + tiled_version="1.5.0", |
| 13 | + tile_size=common_types.Size(32, 32), |
| 14 | + version=1.5, |
| 15 | + background_color=common_types.Color(255, 0, 4, 255), |
| 16 | + layers=[ |
| 17 | + layer.TileLayer( |
| 18 | + name="Layer 1", |
| 19 | + opacity=1, |
| 20 | + visible=True, |
| 21 | + id=2, |
| 22 | + size=common_types.Size(8, 6), |
| 23 | + data=[ |
| 24 | + [4, 3, 2, 1, 0, 0, 0, 0], |
| 25 | + [ |
| 26 | + 0, |
| 27 | + 0, |
| 28 | + 0, |
| 29 | + 0, |
| 30 | + 0, |
| 31 | + 0, |
| 32 | + 0, |
| 33 | + 0, |
| 34 | + ], |
| 35 | + [ |
| 36 | + 0, |
| 37 | + 0, |
| 38 | + 0, |
| 39 | + 0, |
| 40 | + 0, |
| 41 | + 0, |
| 42 | + 0, |
| 43 | + 0, |
| 44 | + ], |
| 45 | + [ |
| 46 | + 0, |
| 47 | + 0, |
| 48 | + 0, |
| 49 | + 0, |
| 50 | + 0, |
| 51 | + 0, |
| 52 | + 0, |
| 53 | + 0, |
| 54 | + ], |
| 55 | + [ |
| 56 | + 0, |
| 57 | + 0, |
| 58 | + 0, |
| 59 | + 0, |
| 60 | + 0, |
| 61 | + 0, |
| 62 | + 0, |
| 63 | + 0, |
| 64 | + ], |
| 65 | + [ |
| 66 | + 0, |
| 67 | + 0, |
| 68 | + 0, |
| 69 | + 0, |
| 70 | + 0, |
| 71 | + 0, |
| 72 | + 0, |
| 73 | + 0, |
| 74 | + ], |
| 75 | + ], |
| 76 | + ), |
| 77 | + ], |
| 78 | + tilesets={ |
| 79 | + 1: tileset.Tileset( |
| 80 | + columns=0, |
| 81 | + margin=0, |
| 82 | + spacing=0, |
| 83 | + name="tileset", |
| 84 | + tile_count=4, |
| 85 | + tiled_version="1.3.5", |
| 86 | + tile_height=32, |
| 87 | + tile_width=32, |
| 88 | + version=1.2, |
| 89 | + type="tileset", |
| 90 | + grid=tileset.Grid(orientation="orthogonal", width=1, height=1), |
| 91 | + tiles={ |
| 92 | + 0: tileset.Tile( |
| 93 | + animation=[ |
| 94 | + tileset.Frame(duration=100, tile_id=0), |
| 95 | + tileset.Frame(duration=100, tile_id=1), |
| 96 | + tileset.Frame(duration=100, tile_id=2), |
| 97 | + tileset.Frame(duration=100, tile_id=3), |
| 98 | + ], |
| 99 | + id=0, |
| 100 | + image=Path(Path(__file__).parent / "../../images/tile_01.png") |
| 101 | + .absolute() |
| 102 | + .resolve(), |
| 103 | + image_height=32, |
| 104 | + image_width=32, |
| 105 | + properties={"float property": 2.2}, |
| 106 | + type="tile", |
| 107 | + ), |
| 108 | + 1: tileset.Tile( |
| 109 | + id=1, |
| 110 | + image=Path(Path(__file__).parent / "../../images/tile_02.png") |
| 111 | + .absolute() |
| 112 | + .resolve(), |
| 113 | + image_height=32, |
| 114 | + image_width=32, |
| 115 | + objects=layer.ObjectLayer( |
| 116 | + name="", |
| 117 | + opacity=1, |
| 118 | + visible=True, |
| 119 | + draw_order="index", |
| 120 | + tiled_objects=[ |
| 121 | + tiled_object.Rectangle( |
| 122 | + id=2, |
| 123 | + name="", |
| 124 | + size=common_types.Size( |
| 125 | + 14.4766410408043, 13.7196924896511 |
| 126 | + ), |
| 127 | + rotation=0, |
| 128 | + type="", |
| 129 | + visible=True, |
| 130 | + coordinates=common_types.OrderedPair( |
| 131 | + 13.4358367829687, 13.5304553518628 |
| 132 | + ), |
| 133 | + ), |
| 134 | + tiled_object.Ellipse( |
| 135 | + id=3, |
| 136 | + name="", |
| 137 | + size=common_types.Size( |
| 138 | + 14.287403903016, 11.070372560615 |
| 139 | + ), |
| 140 | + rotation=0, |
| 141 | + type="", |
| 142 | + visible=True, |
| 143 | + coordinates=common_types.OrderedPair( |
| 144 | + 13.8143110585452, 1.98698994677705 |
| 145 | + ), |
| 146 | + ), |
| 147 | + ], |
| 148 | + ), |
| 149 | + properties={"string property": "testing"}, |
| 150 | + type="tile", |
| 151 | + ), |
| 152 | + 2: tileset.Tile( |
| 153 | + id=2, |
| 154 | + image=Path(Path(__file__).parent / "../../images/tile_03.png") |
| 155 | + .absolute() |
| 156 | + .resolve(), |
| 157 | + image_height=32, |
| 158 | + image_width=32, |
| 159 | + properties={"bool property": True}, |
| 160 | + type="tile", |
| 161 | + ), |
| 162 | + 3: tileset.Tile( |
| 163 | + id=3, |
| 164 | + image=Path(Path(__file__).parent / "../../images/tile_04.png") |
| 165 | + .absolute() |
| 166 | + .resolve(), |
| 167 | + image_height=32, |
| 168 | + image_width=32, |
| 169 | + type="tile", |
| 170 | + ), |
| 171 | + }, |
| 172 | + ) |
| 173 | + }, |
| 174 | + properties={ |
| 175 | + "bool property - true": True, |
| 176 | + "color property": common_types.Color(255, 73, 252, 255), |
| 177 | + "file property": Path("../../../../../../var/log/syslog"), |
| 178 | + "float property": 1.23456789, |
| 179 | + "int property": 13, |
| 180 | + "string property": "Hello, World!!", |
| 181 | + }, |
| 182 | +) |
0 commit comments