Skip to content

Commit

Permalink
Make TestQgsCoordinateOperationWidget tolerant to presence of grid sh…
Browse files Browse the repository at this point in the history
…ift files
  • Loading branch information
nyalldawson committed Feb 8, 2021
1 parent 1372714 commit f3fab9e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/src/python/test_qgscoordinateoperationwidget.py
Expand Up @@ -58,9 +58,16 @@ def testOperations(self):
self.assertTrue(w.hasSelection())
self.assertGreaterEqual(len(w.availableOperations()), 3)

self.assertEqual(w.defaultOperation().proj, '+proj=pipeline +step +proj=unitconvert +xy_in=us-ft +xy_out=m +step +inv +proj=lcc +lat_0=33.5 +lon_0=-118 +lat_1=35.4666666666667 +lat_2=34.0333333333333 +x_0=609601.219202438 +y_0=0 +ellps=clrk66 +step +proj=push +v_3 +step +proj=cart +ellps=clrk66 +step +proj=helmert +x=-8 +y=159 +z=175 +step +inv +proj=cart +ellps=WGS84 +step +proj=pop +v_3 +step +proj=webmerc +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84')
self.assertEqual(w.selectedOperation().proj,
'+proj=pipeline +step +proj=unitconvert +xy_in=us-ft +xy_out=m +step +inv +proj=lcc +lat_0=33.5 +lon_0=-118 +lat_1=35.4666666666667 +lat_2=34.0333333333333 +x_0=609601.219202438 +y_0=0 +ellps=clrk66 +step +proj=push +v_3 +step +proj=cart +ellps=clrk66 +step +proj=helmert +x=-8 +y=159 +z=175 +step +inv +proj=cart +ellps=WGS84 +step +proj=pop +v_3 +step +proj=webmerc +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84')
available_operations = QgsDatumTransform.operations(w.sourceCrs(), w.destinationCrs())
for op in available_operations:
if op.isAvailable:
default_proj = op.proj
break
else:
self.assertTrue(False, 'No operations available')

self.assertEqual(w.defaultOperation().proj, default_proj)
self.assertEqual(w.selectedOperation().proj, default_proj)
self.assertTrue(w.selectedOperation().isAvailable)

op = QgsCoordinateOperationWidget.OperationDetails()
Expand Down Expand Up @@ -97,8 +104,7 @@ def testOperations(self):
w.setSelectedOperation(op)
w.setSelectedOperationUsingContext(context)
# should go to default, because there's nothing in the context matching these crs
self.assertEqual(w.selectedOperation().proj,
'+proj=pipeline +step +proj=unitconvert +xy_in=us-ft +xy_out=m +step +inv +proj=lcc +lat_0=33.5 +lon_0=-118 +lat_1=35.4666666666667 +lat_2=34.0333333333333 +x_0=609601.219202438 +y_0=0 +ellps=clrk66 +step +proj=push +v_3 +step +proj=cart +ellps=clrk66 +step +proj=helmert +x=-8 +y=159 +z=175 +step +inv +proj=cart +ellps=WGS84 +step +proj=pop +v_3 +step +proj=webmerc +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84')
self.assertEqual(w.selectedOperation().proj, default_proj)
self.assertEqual(len(spy), 6)

# put something in the context
Expand Down

0 comments on commit f3fab9e

Please sign in to comment.