Skip to content
Permalink
Browse files
Add test for QgsGeometry.orthogonalize()
  • Loading branch information
agiudiceandrea authored and nyalldawson committed Aug 11, 2022
1 parent 9c76c07 commit d38268b4f0d887b81081df2c940eab0877fa8c63
Showing 1 changed file with 9 additions and 0 deletions.
@@ -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)

0 comments on commit d38268b

Please sign in to comment.