diff --git a/tests/test_data/simple_objects.json b/tests/test_data/simple_objects.json index 1da91c1..dbf407c 100644 --- a/tests/test_data/simple_objects.json +++ b/tests/test_data/simple_objects.json @@ -1,600 +1,649 @@ -{ "compressionlevel":0, - "editorsettings": +{ + "compressionlevel": 0, + "editorsettings": { + "export": { + "target": "." + } + }, + "height": 6, + "infinite": false, + "layers": [ { - "export": - { - "target":"." - } + "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 }, - "height":6, - "infinite":false, - "layers":[ + { + "draworder": "topdown", + "id": 2, + "name": "Object Layer 1", + "objects": [ { - "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 - }, + "height": 41.4686825053996, + "id": 1, + "name": "name: rectangle", + "rotation": 0, + "type": "rectangle", + "visible": true, + "width": 45.3972945322269, + "x": 27.7185404115039, + "y": 23.571672160964 + }, { - "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":"", - "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":[ + "height": 0, + "id": 2, + "name": "name: point", + "point": true, + "rotation": 0, + "type": "point", + "visible": true, + "width": 0, + "x": 159.981811981357, + "y": 82.9373650107991 + }, { - "firstgid":1, - "source":"..\/..\/old_tests\/test_data\/tile_set_image_objects.tsx" - }, + "height": 0, + "id": 3, + "name": "name: point invisible", + "point": true, + "rotation": 0, + "type": "point", + "visible": false, + "width": 0, + "x": 109.346368080027, + "y": 95.8144822098443 + }, { - "firstgid":49, - "source":"..\/..\/old_tests\/test_data\/tile_set_image.tsx" - }], - "tilewidth":32, - "type":"map", - "version":1.2, - "width":8 -} \ No newline at end of file + "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": "../../old_tests/test_data/tile_set_image_objects.tsx" + }, + { + "firstgid": 49, + "source": "../../old_tests/test_data/tile_set_image.tsx" + } + ], + "tilewidth": 32, + "type": "map", + "version": 1.2, + "width": 8 +} diff --git a/tests/test_tiled_object.py b/tests/test_tiled_object.py index 7c3805b..5530d73 100644 --- a/tests/test_tiled_object.py +++ b/tests/test_tiled_object.py @@ -83,6 +83,30 @@ ELLIPSES = [ coordinates=common_types.OrderedPair(35.7940206888712, 120.040923041946), ), ), + ( + """ + { + "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 + } + """, + tiled_object.Ellipse( + id_=29, + name="name: ellipse - no width or height", + rotation=0, + type="ellipse", + visible=True, + coordinates=common_types.OrderedPair(72.4610662725929, 127.679890871888), + ), + ), ] RECTANGLES = [ @@ -734,7 +758,299 @@ POLYLINES = [ ), ] -TEXTS = [] +TEXTS = [ + ( + """ + { + "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 + } + """, + tiled_object.Text( + id_=19, + name="name: text", + text="Hello World", + type="text", + wrap=True, + rotation=0, + size=common_types.Size(92.375, 19), + coordinates=common_types.OrderedPair(81.7106470956008, 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 + } + """, + tiled_object.Text( + id_=20, + name="name: text - invisible", + text="Hello World", + wrap=True, + type="text", + rotation=0, + visible=False, + size=common_types.Size(92.375, 19), + coordinates=common_types.OrderedPair(8.37655592815732, 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 + } + """, + tiled_object.Text( + id_=21, + name="name: text - rotated", + text="Hello World", + wrap=True, + rotation=19, + type="text", + visible=True, + size=common_types.Size(92.375, 19), + coordinates=common_types.OrderedPair(157.882069171308, 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 + } + """, + tiled_object.Text( + id_=22, + name="name: text - different font", + text="Hello World", + wrap=True, + bold=True, + font_family="DejaVu Sans", + font_size=19, + rotation=0, + type="text", + visible=True, + size=common_types.Size(92.375, 19), + coordinates=common_types.OrderedPair(2.70189411162896, 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 + } + """, + tiled_object.Text( + id_=23, + name="name: text - no word wrap", + text="Hello World", + rotation=0, + type="text", + visible=True, + size=common_types.Size(92.375, 19), + coordinates=common_types.OrderedPair(9.90434949414573, 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 + } + """, + tiled_object.Text( + id_=24, + name="name: text - right bottom align", + text="Hello World", + wrap=True, + horizontal_align="right", + vertical_align="bottom", + rotation=0, + type="text", + visible=True, + size=common_types.Size(92.375, 19), + coordinates=common_types.OrderedPair(151.989151131067, 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 + } + """, + tiled_object.Text( + id_=25, + name="text: center center align", + rotation=0, + text="Hello World", + wrap=True, + horizontal_align="center", + vertical_align="center", + type="text", + visible=True, + size=common_types.Size(92.375, 19), + coordinates=common_types.OrderedPair(4.22968767761736, 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 + } + """, + tiled_object.Text( + id_=26, + name="name: text - justified", + rotation=0, + text="Hello World", + wrap=True, + horizontal_align="justify", + type="text", + visible=True, + size=common_types.Size(92.375, 19), + coordinates=common_types.OrderedPair(13.8329615209731, 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 + } + """, + tiled_object.Text( + id_=27, + name="name: text - red", + rotation=0, + text="Hello World", + wrap=True, + color="#aa0000", + type="text", + visible=True, + size=common_types.Size(92.375, 19), + coordinates=common_types.OrderedPair(96.3338140843469, 130.620495623508), + ), + ), +] OBJECTS = ELLIPSES + RECTANGLES + POINTS + TILE_IMAGES + POLYGONS + POLYLINES + TEXTS