Skip to content
Permalink
Browse files
add some more geometry tests (followup c686c4f)
  • Loading branch information
jef-n committed Jun 25, 2014
1 parent 97e7f0a commit e358a87beb236a38f36525392a200c8b268c68c2
Showing with 15 additions and 0 deletions.
  1. +15 −0 tests/src/python/test_qgsgeometry.py
@@ -903,6 +903,13 @@ def testDeleteVertex(self):
wkt = polyline.exportToWkt()
assert compareWkt( expwkt, wkt ), "Expected:\n%s\nGot:\n%s\n" % (expwkt, wkt )

polyline = QgsGeometry.fromWkt("MULTILINESTRING((0 0, 1 0, 1 1, 2 1,2 0),(3 0, 3 1, 5 1, 5 0, 6 0))")
for i in range(5):
assert polyline.deleteVertex(5), "Delete vertex 5 failed"
expwkt = "MULTILINESTRING((0 0, 1 0, 1 1, 2 1, 2 0))"
wkt = polyline.exportToWkt()
assert compareWkt( expwkt, wkt ), "Expected:\n%s\nGot:\n%s\n" % (expwkt, wkt )

# 5---4
# | |
# | 2-3
@@ -950,6 +957,14 @@ def testDeleteVertex(self):
wkt = polygon.exportToWkt()
assert compareWkt( expwkt, wkt ), "Expected:\n%s\nGot:\n%s\n" % (expwkt, wkt )

polygon = QgsGeometry.fromWkt( "MULTIPOLYGON(((0 0,1 0,1 1,2 1,2 2,0 2,0 0)),((4 0,5 0,5 2,3 2,3 1,4 1,4 0)))" )
for i in range(6):
assert polygon.deleteVertex( 0 ), "Delete vertex 0 failed"

expwkt = "MULTIPOLYGON(((4 0,5 0,5 2,3 2,3 1,4 1,4 0)))"
wkt = polygon.exportToWkt()
assert compareWkt( expwkt, wkt ), "Expected:\n%s\nGot:\n%s\n" % (expwkt, wkt )

# 3-+-+-+-+-+-+-+-+-2
# | |
# + 8-7 3-2 8-7 3-2 +

0 comments on commit e358a87

Please sign in to comment.