Skip to content
Permalink
Browse files
Add test for QgsGeometry.orthogonalize()
  • Loading branch information
agiudiceandrea authored and nyalldawson committed Aug 11, 2022
1 parent c2e2369 commit d7994dff40392fa85a2f84d354a567b5c670d1d0
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 d7994df

Please sign in to comment.