@@ -766,7 +766,6 @@ def testMultipoint(self):
766766 assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
767767
768768 assert multipoint .insertVertex (6 , 6 , 2 ), "MULTIPOINT append 6,6 at 2 failed"
769-
770769 expwkt = "MULTIPOINT(4 4, 5 5, 6 6, 7 7)"
771770 wkt = multipoint .exportToWkt ()
772771 assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
@@ -775,19 +774,16 @@ def testMultipoint(self):
775774 assert not multipoint .deleteVertex (- 1 ), "MULTIPOINT delete at -1 unexpectedly succeeded"
776775
777776 assert multipoint .deleteVertex (1 ), "MULTIPOINT delete at 1 failed"
778-
779777 expwkt = "MULTIPOINT(4 4, 6 6, 7 7)"
780778 wkt = multipoint .exportToWkt ()
781779 assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
782780
783781 assert multipoint .deleteVertex (2 ), "MULTIPOINT delete at 2 failed"
784-
785782 expwkt = "MULTIPOINT(4 4, 6 6)"
786783 wkt = multipoint .exportToWkt ()
787784 assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
788785
789786 assert multipoint .deleteVertex (0 ), "MULTIPOINT delete at 2 failed"
790-
791787 expwkt = "MULTIPOINT(6 6)"
792788 wkt = multipoint .exportToWkt ()
793789 assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
@@ -852,6 +848,49 @@ def testDeleteVertex(self):
852848 assert not polyline .deleteVertex ( - 5 ), "Delete vertex -5 unexpectedly succeeded"
853849 assert not polyline .deleteVertex ( 100 ), "Delete vertex 100 unexpectedly succeeded"
854850
851+ # 2-3 6-+-7
852+ # | | | |
853+ # 0-1 4 5 8-9
854+ polyline = QgsGeometry .fromWkt ("MULTILINESTRING((0 0, 1 0, 1 1, 2 1,2 0),(3 0, 3 1, 5 1, 5 0, 6 0))" )
855+ assert polyline .deleteVertex (5 ), "Delete vertex 5 failed"
856+ expwkt = "MULTILINESTRING((0 0, 1 0, 1 1, 2 1, 2 0), (3 1, 5 1, 5 0, 6 0))"
857+ wkt = polyline .exportToWkt ()
858+ assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
859+
860+ assert not polyline .deleteVertex (- 100 ), "Delete vertex -100 unexpectedly succeeded"
861+ assert not polyline .deleteVertex (100 ), "Delete vertex 100 unexpectedly succeeded"
862+
863+ assert polyline .deleteVertex (0 ), "Delete vertex 0 failed"
864+ expwkt = "MULTILINESTRING((1 0, 1 1, 2 1, 2 0), (3 1, 5 1, 5 0, 6 0))"
865+ wkt = polyline .exportToWkt ()
866+ assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
867+
868+ # 5---4
869+ # | |
870+ # | 2-3
871+ # | |
872+ # 0-1
873+ polygon = QgsGeometry .fromWkt ("POLYGON((0 0, 1 0, 1 1, 2 1, 2 2, 0 2, 0 0))" )
874+
875+ assert polygon .deleteVertex (2 ), "Delete vertex 2 failed"
876+ print "FIXME: exportToWkt doesn't put a blanks behind the comma"
877+ expwkt = "POLYGON((0 0,1 0,2 1,2 2,0 2,0 0))"
878+ wkt = polygon .exportToWkt ()
879+ assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
880+
881+ assert polygon .deleteVertex (0 ), "Delete vertex 0 failed"
882+ expwkt = "POLYGON((1 0,2 1,2 2,0 2,1 0))"
883+ wkt = polygon .exportToWkt ()
884+ assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
885+
886+ assert polygon .deleteVertex (4 ), "Delete vertex 4 failed"
887+ expwkt = "POLYGON((2 1,2 2,0 2,2 1))"
888+ wkt = polygon .exportToWkt ()
889+ assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
890+
891+ assert not polygon .deleteVertex (- 100 ), "Delete vertex -100 unexpectedly succeeded"
892+ assert not polygon .deleteVertex (100 ), "Delete vertex 100 unexpectedly succeeded"
893+
855894 # 5-+-4 0-+-9
856895 # | | | |
857896 # 6 2-3 1-2 +
0 commit comments