Skip to content


Browse files Browse the repository at this point in the history
Add a unit test for missing datum transforms
  • Loading branch information
nyalldawson committed Dec 15, 2017
1 parent 96c2ce1 commit 1217e59
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/src/python/
Expand Up @@ -332,6 +332,29 @@ def testWriteReadXml(self):
self.assertEqual(context2.sourceDestinationDatumTransforms(), {('EPSG:4204', 'EPSG:4326'): QgsCoordinateTransform.TransformPair(source_id_1, dest_id_1),
('EPSG:4205', 'EPSG:4326'): QgsCoordinateTransform.TransformPair(source_id_2, dest_id_2)})

def testMissingTransforms(self):
# fudge context xml with a missing transform
doc = QDomDocument("testdoc")
elem = doc.createElement("test")
contextElem = doc.createElement("transformContext")
transformElem = doc.createElement("srcDest")
transformElem.setAttribute("source", 'EPSG:4204')
transformElem.setAttribute("dest", 'EPSG:4326')
transformElem.setAttribute("sourceTransform", 'not valid')
transformElem.setAttribute("destTransform", 'not valid 2')

elem2 = doc.createElement("test2")

# restore from xml
context2 = QgsCoordinateTransformContext()
ok, errors = context2.readXml(elem2, QgsReadWriteContext())

# check result
self.assertEqual(errors, ['not valid', 'not valid 2'])

def testProject(self):
Test project's transform context
Expand Down

0 comments on commit 1217e59

Please sign in to comment.