Skip to content

Commit

Permalink
add some more geometry tests (followup c686c4f)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jun 25, 2014
1 parent 97e7f0a commit e358a87
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/src/python/test_qgsgeometry.py
Expand Up @@ -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
Expand Down Expand Up @@ -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 +
Expand Down

0 comments on commit e358a87

Please sign in to comment.