@@ -2271,6 +2271,18 @@ def testReshape(self):
22712271 wkt = g .asWkt ()
22722272 assert compareWkt (expWkt , wkt ), "testReshape failed: mismatch Expected:\n %s\n Got:\n %s\n " % (expWkt , wkt )
22732273
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+
22742286 # Test reshape a line from first/last vertex
22752287 g = QgsGeometry .fromWkt ('LineString (0 0, 5 0, 5 1)' )
22762288 # extend start
0 commit comments