@@ -2334,6 +2334,18 @@ def testReshape(self):
2334
2334
wkt = g .asWkt ()
2335
2335
assert compareWkt (expWkt , wkt ), "testReshape failed: mismatch Expected:\n %s\n Got:\n %s\n " % (expWkt , wkt )
2336
2336
2337
+ # Test reshape a polygon with a line starting or ending at the polygon's first vertex, no change expexted
2338
+ g = QgsGeometry .fromWkt ('Polygon ((0 0, 1 0, 1 1, 0 1, 0 0))' )
2339
+ expWkt = g .asWkt ()
2340
+ g .reshapeGeometry (QgsLineString ([QgsPoint (0 , 0 ), QgsPoint (- 1 , - 1 )]))
2341
+ assert compareWkt (g .asWkt (), expWkt ), "testReshape failed: mismatch Expected:\n %s\n Got:\n %s\n " % (expWkt , wkt )
2342
+
2343
+ # Test reshape a polygon with a line starting or ending at the polygon's first vertex
2344
+ g = QgsGeometry .fromWkt ('Polygon ((0 0, 1 0, 1 1, 0 1, 0 0))' )
2345
+ g .reshapeGeometry (QgsLineString ([QgsPoint (0 , 0 ), QgsPoint (0.5 , 0.5 ), QgsPoint (0 , 1 )]))
2346
+ expWkt = 'Polygon ((0 0, 1 0, 1 1, 0 1, 0.5 0.5, 0 0))'
2347
+ assert compareWkt (g .asWkt (), expWkt ), "testReshape failed: mismatch Expected:\n %s\n Got:\n %s\n " % (expWkt , wkt )
2348
+
2337
2349
# Test reshape a line from first/last vertex
2338
2350
g = QgsGeometry .fromWkt ('LineString (0 0, 5 0, 5 1)' )
2339
2351
# extend start
0 commit comments