Skip to content
Permalink
Browse files
Add test for QgsGeometry.orthogonalize()
  • Loading branch information
agiudiceandrea committed Aug 11, 2022
1 parent 663ae8a commit 00080c59f8fef52d490f17f4642995f6e4468f87
Showing 1 changed file with 9 additions and 0 deletions.
@@ -5166,6 +5166,15 @@ def testOrthogonalize(self):
self.assertTrue(compareWkt(result, exp, 0.00001),
"orthogonalize: mismatch Expected:\n{}\nGot:\n{}\n".format(exp, result))

# already orthogonal polygon with a vertex on a "straight line" (https://github.com/qgis/QGIS/issues/49621)
polygon = QgsGeometry.fromWkt(
'Polygon ((0 0, 5 0, 10 0, 10 10, 0 10, 0 0))')
o = polygon.orthogonalize()
exp = 'Polygon ((0 0, 5 0, 10 0, 10 10, 0 10, 0 0))'
result = o.asWkt()
self.assertTrue(compareWkt(result, exp, 0.00001),
"orthogonalize: mismatch Expected:\n{}\nGot:\n{}\n".format(exp, result))

def testPolygonize(self):
o = QgsGeometry.polygonize([])
self.assertFalse(o)

0 comments on commit 00080c5

Please sign in to comment.