From e55fbebf680bfdce8bb2709493f1f92c2922f900 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Sun, 26 Mar 2017 14:33:55 +1000 Subject: [PATCH] Add failing test to ensure that QgsAbstractGeometry.centroid result matches that of GEOS It doesn't, and reveals the the QGIS native centroid calculation is quite broken --- tests/src/python/test_qgsgeometry.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/src/python/test_qgsgeometry.py b/tests/src/python/test_qgsgeometry.py index 957461dcf51..b19f3820511 100644 --- a/tests/src/python/test_qgsgeometry.py +++ b/tests/src/python/test_qgsgeometry.py @@ -4108,6 +4108,11 @@ class TestQgsGeometry(unittest.TestCase): self.assertTrue(compareWkt(result, exp, 0.00001), "centroid: mismatch Expected:\n{}\nGot:\n{}\n".format(exp, result)) + # QGIS native algorithms are bad! + if False: + result = QgsGeometry(input.geometry().centroid()).exportToWkt() + self.assertTrue(compareWkt(result, exp, 0.00001), + "centroid: mismatch using QgsAbstractGeometry methods Input {} \n Expected:\n{}\nGot:\n{}\n".format(t[0], exp, result)) if __name__ == '__main__': unittest.main()