diff --git a/tests/test_tiled_object.py b/tests/test_tiled_object.py index 5e26931..b0b1de8 100644 --- a/tests/test_tiled_object.py +++ b/tests/test_tiled_object.py @@ -9,7 +9,8 @@ from pytiled_parser import common_types, tiled_object ELLIPSES = [ ( """ - {"ellipse":true, + { + "ellipse":true, "height":18.5517790155735, "id":6, "name":"name: ellipse", @@ -18,7 +19,8 @@ ELLIPSES = [ "visible":true, "width":57.4013868364215, "x":37.5400704785722, - "y":81.1913152210981} + "y":81.1913152210981 + } """, tiled_object.Ellipse( id_=6, @@ -32,7 +34,8 @@ ELLIPSES = [ ), ( """ - {"ellipse":true, + { + "ellipse":true, "height":31.4288962146186, "id":7, "name":"name: ellipse - invisible", @@ -41,7 +44,8 @@ ELLIPSES = [ "visible":false, "width":6.32943048766625, "x":22.6986472661134, - "y":53.9092872570194} + "y":53.9092872570194 + } """, tiled_object.Ellipse( id_=7, @@ -55,7 +59,8 @@ ELLIPSES = [ ), ( """ - {"ellipse":true, + { + "ellipse":true, "height":24.2264408321018, "id":8, "name":"name: ellipse - rotated", @@ -64,7 +69,8 @@ ELLIPSES = [ "visible":true, "width":29.6828464249176, "x":35.7940206888712, - "y":120.040923041946} + "y":120.040923041946 + } """, tiled_object.Ellipse( id_=8, @@ -81,7 +87,8 @@ ELLIPSES = [ RECTANGLES = [ ( """ - {"height":41.4686825053996, + { + "height":41.4686825053996, "id":1, "name":"name: rectangle", "rotation":0, @@ -89,7 +96,8 @@ RECTANGLES = [ "visible":true, "width":45.3972945322269, "x":27.7185404115039, - "y":23.571672160964} + "y":23.571672160964 + } """, tiled_object.Rectangle( id_=1, @@ -106,7 +114,8 @@ RECTANGLES = [ POINTS = [ ( """ - {"height":0, + { + "height":0, "id":2, "name":"name: point", "point":true, @@ -115,7 +124,8 @@ POINTS = [ "visible":true, "width":0, "x":159.981811981357, - "y":82.9373650107991} + "y":82.9373650107991 + } """, { "height": 0, @@ -136,7 +146,197 @@ TILE_IMAGES = [] POLYGONS = [] -POLYLINES = [] +POLYLINES = [ + ( + """ + { + "height":0, + "id":9, + "name":"name: polyline", + "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":"polyline", + "visible":true, + "width":0, + "x":89.485051722178, + "y":38.6313515971354 + } + """, + tiled_object.Polyline( + id_=9, + name="name: polyline", + points=[ + common_types.OrderedPair(0, 0), + common_types.OrderedPair(19.424803910424, 27.063771740366), + common_types.OrderedPair(19.6430601341366, 3.05558713197681), + common_types.OrderedPair(-2.61907468455156, 15.9327043310219), + common_types.OrderedPair(25.317721950665, 16.3692167784472), + ], + rotation=0, + type="polyline", + visible=True, + coordinates=common_types.OrderedPair(89.485051722178, 38.6313515971354), + ), + ), + ( + """ + { + "height":0, + "id":10, + "name":"name: polyline - invisible", + "polygon":[ + { + "x":0, + "y":0 + }, + { + "x":-12.8771171990451, + "y":7.63896782994203 + }, + { + "x":-14.8414232124588, + "y":-10.2580425144936 + }], + "rotation":0, + "type":"polyline", + "visible":false, + "width":0, + "x":133.791065135842, + "y":24.4446970558145 + } + """, + tiled_object.Polyline( + id_=10, + name="name: polyline - invisible", + points=[ + common_types.OrderedPair(0, 0), + common_types.OrderedPair(-12.8771171990451, 7.63896782994203), + common_types.OrderedPair(-14.8414232124588, -10.2580425144936), + ], + rotation=0, + type="polyline", + visible=False, + coordinates=common_types.OrderedPair(133.791065135842, 24.4446970558145), + ), + ), + ( + """ + { + "height":0, + "id":11, + "name":"name: polyline - 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":"polyline", + "visible":true, + "width":0, + "x":152.779356598841, + "y":19.8613163578493 + } + """, + tiled_object.Polyline( + id_=11, + name="name: polyline - rotated", + points=[ + common_types.OrderedPair(0, 0), + common_types.OrderedPair(-12.8771171990451, 0), + common_types.OrderedPair(-6.98419915880413, 7.63896782994203), + common_types.OrderedPair(-13.9683983176083, 16.8057292258725), + common_types.OrderedPair(3.71035580311468, 15.277935659884), + common_types.OrderedPair(-3.71035580311471, 8.29373650107991), + ], + rotation=123, + type="polyline", + visible=True, + coordinates=common_types.OrderedPair(152.779356598841, 19.8613163578493), + ), + ), + ( + """ + { + "height":0, + "id":12, + "name":"name: polyline - not closed", + "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 + } + """, + tiled_object.Polyline( + id_=12, + name="name: polyline - not closed", + points=[ + common_types.OrderedPair(0, 0), + common_types.OrderedPair(-13.3136296464704, 41.0321700579743), + common_types.OrderedPair(21.3891099238377, 16.8057292258725), + ], + rotation=0, + type="polyline", + visible=True, + coordinates=common_types.OrderedPair(124.187791292486, 90.1398203933159), + ), + ), +] TEXTS = []