@@ -1509,6 +1509,22 @@ def testAddPart(self):
15091509 wkt = polygon .asWkt ()
15101510 assert compareWkt (expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
15111511
1512+ # test adding a part to a multisurface
1513+ geom = QgsGeometry .fromWkt ('MultiSurface(((0 0,0 1,1 1,0 0)))' )
1514+ g2 = QgsGeometry .fromWkt ('CurvePolygon ((0 0,0 1,1 1,0 0))' )
1515+ geom .addPart (g2 .get ().clone ())
1516+ wkt = geom .asWkt ()
1517+ expwkt = 'MultiSurface (Polygon ((0 0, 0 1, 1 1, 0 0)),CurvePolygon ((0 0, 0 1, 1 1, 0 0)))'
1518+ assert compareWkt (expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
1519+
1520+ # test adding a multisurface to a multisurface
1521+ geom = QgsGeometry .fromWkt ('MultiSurface(((20 0,20 1,21 1,20 0)))' )
1522+ g2 = QgsGeometry .fromWkt ('MultiSurface (Polygon ((0 0, 0 1, 1 1, 0 0)),CurvePolygon ((0 0, 0 1, 1 1, 0 0)))' )
1523+ geom .addPart (g2 .get ().clone ())
1524+ wkt = geom .asWkt ()
1525+ expwkt = 'MultiSurface (Polygon ((20 0, 20 1, 21 1, 20 0)),Polygon ((0 0, 0 1, 1 1, 0 0)),CurvePolygon ((0 0, 0 1, 1 1, 0 0)))'
1526+ assert compareWkt (expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
1527+
15121528 # Test adding parts to empty geometry, should become first part
15131529 empty = QgsGeometry ()
15141530 # if not default type specified, addPart should fail
0 commit comments