Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add test for QgsGeometry.orthogonalize()
  • Loading branch information
agiudiceandrea authored and nyalldawson committed Aug 11, 2022
1 parent 9c76c07 commit d38268b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/src/python/test_qgsgeometry.py
Expand Up @@ -5084,6 +5084,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)
Expand Down

0 comments on commit d38268b

Please sign in to comment.