Skip to content
Permalink
Browse files

Fix copy/paste error, update unit tests

  • Loading branch information
nyalldawson committed Dec 18, 2017
1 parent c701791 commit a77b5b651798df8ab7150b8de3de94d89c004524
Showing with 15 additions and 4 deletions.
  1. +1 −1 src/core/qgsdatumtransform.cpp
  2. +14 −3 tests/src/python/test_qgscoordinatetransform.py
@@ -68,7 +68,7 @@ QList< QgsDatumTransform::TransformPair > QgsDatumTransform::datumTransformation
}

//add direct datum transformations
for ( int transform : qgis::as_const( directTransforms ) )
for ( int transform : qgis::as_const( reverseDirectTransforms ) )
{
transformations.push_back( QgsDatumTransform::TransformPair( -1, transform ) );
}
@@ -213,10 +213,21 @@ def testTransformInfo(self):
transforms = QgsDatumTransform.datumTransformations(QgsCoordinateReferenceSystem(4613), QgsCoordinateReferenceSystem(4326))
self.assertTrue(len(transforms) > 0)
self.assertIn('+towgs84=-403,684,41', [QgsDatumTransform.datumTransformToProj(t.sourceTransformId) for t in transforms])
self.assertIn('+towgs84=-403,684,41', [QgsDatumTransform.datumTransformToProj(t.destinationTransformId) for t in transforms])
self.assertIn('EPSG:4613', [QgsDatumTransform.datumTransformInfo(t.destinationTransformId).sourceCrsAuthId for t in
self.assertEqual([''] * len(transforms), [QgsDatumTransform.datumTransformToProj(t.destinationTransformId) for t in transforms])
self.assertIn('EPSG:4613', [QgsDatumTransform.datumTransformInfo(t.sourceTransformId).sourceCrsAuthId for t in
transforms])
self.assertIn('EPSG:4326', [QgsDatumTransform.datumTransformInfo(t.destinationTransformId).destinationCrsAuthId for t in
self.assertEqual([''] * len(transforms), [QgsDatumTransform.datumTransformInfo(t.destinationTransformId).destinationCrsAuthId for t in
transforms])

# and the reverse
transforms = QgsDatumTransform.datumTransformations(QgsCoordinateReferenceSystem(4326), QgsCoordinateReferenceSystem(4613))
self.assertTrue(len(transforms) > 0)
self.assertEqual([''] * len(transforms), [QgsDatumTransform.datumTransformToProj(t.sourceTransformId) for t in transforms])
self.assertIn('+towgs84=-403,684,41',
[QgsDatumTransform.datumTransformToProj(t.destinationTransformId) for t in transforms])
self.assertEqual([''] * len(transforms), [QgsDatumTransform.datumTransformInfo(t.sourceTransformId).destinationCrsAuthId for t in
transforms])
self.assertIn('EPSG:4613', [QgsDatumTransform.datumTransformInfo(t.destinationTransformId).sourceCrsAuthId for t in
transforms])

def testStringToTransformId(self):

0 comments on commit a77b5b6

Please sign in to comment.
You can’t perform that action at this time.