@@ -2271,6 +2271,18 @@ def testReshape(self):
2271
2271
wkt = g .asWkt ()
2272
2272
assert compareWkt (expWkt , wkt ), "testReshape failed: mismatch Expected:\n %s\n Got:\n %s\n " % (expWkt , wkt )
2273
2273
2274
+ # Test reshape a polygon with a line starting or ending at the polygon's first vertex, no change expexted
2275
+ g = QgsGeometry .fromWkt ('Polygon ((0 0, 1 0, 1 1, 0 1, 0 0))' )
2276
+ expWkt = g .asWkt ()
2277
+ g .reshapeGeometry (QgsLineString ([QgsPoint (0 , 0 ), QgsPoint (- 1 , - 1 )]))
2278
+ assert compareWkt (g .asWkt (), expWkt ), "testReshape failed: mismatch Expected:\n %s\n Got:\n %s\n " % (expWkt , wkt )
2279
+
2280
+ # Test reshape a polygon with a line starting or ending at the polygon's first vertex
2281
+ g = QgsGeometry .fromWkt ('Polygon ((0 0, 1 0, 1 1, 0 1, 0 0))' )
2282
+ g .reshapeGeometry (QgsLineString ([QgsPoint (0 , 0 ), QgsPoint (0.5 , 0.5 ), QgsPoint (0 , 1 )]))
2283
+ expWkt = 'Polygon ((0 0, 1 0, 1 1, 0 1, 0.5 0.5, 0 0))'
2284
+ assert compareWkt (g .asWkt (), expWkt ), "testReshape failed: mismatch Expected:\n %s\n Got:\n %s\n " % (expWkt , wkt )
2285
+
2274
2286
# Test reshape a line from first/last vertex
2275
2287
g = QgsGeometry .fromWkt ('LineString (0 0, 5 0, 5 1)' )
2276
2288
# extend start
0 commit comments