Skip to content
Permalink
Browse files

Tests QgsProcessingParameterCrs

  • Loading branch information
rldhont authored and nyalldawson committed May 4, 2021
1 parent 2754f82 commit 8d232b247bc6acca62b8aefd281fa7038afb169e
Showing with 28 additions and 0 deletions.
  1. +28 −0 python/plugins/processing/tests/ParametersTest.py
@@ -174,6 +174,34 @@ def testParameterBooleanDesc(self):
self.assertFalse(param.defaultValue())
self.assertTrue(param.flags() & QgsProcessingParameterDefinition.FlagOptional)

def testParameterCrsDesc(self):
desc = 'QgsProcessingParameterCrs|in_crs|Input CRS'
param = getParameterFromString(desc)
self.assertIsNotNone(param)
self.assertEqual(param.type(), 'crs')
self.assertEqual(param.name(), 'in_crs')
self.assertEqual(param.description(), 'Input CRS')
self.assertIsNone(param.defaultValue())
self.assertFalse(param.flags() & QgsProcessingParameterDefinition.FlagOptional)

desc = 'QgsProcessingParameterCrs|in_crs|Input CRS|EPSG:2154'
param = getParameterFromString(desc)
self.assertIsNotNone(param)
self.assertEqual(param.type(), 'crs')
self.assertEqual(param.name(), 'in_crs')
self.assertEqual(param.description(), 'Input CRS')
self.assertEqual(param.defaultValue(), 'EPSG:2154')
self.assertFalse(param.flags() & QgsProcessingParameterDefinition.FlagOptional)

desc = 'QgsProcessingParameterCrs|in_crs|Input CRS|None|True'
param = getParameterFromString(desc)
self.assertIsNotNone(param)
self.assertEqual(param.type(), 'crs')
self.assertEqual(param.name(), 'in_bool')
self.assertEqual(param.description(), 'Input CRS')
self.assertIsNone(param.defaultValue())
self.assertTrue(param.flags() & QgsProcessingParameterDefinition.FlagOptional


if __name__ == '__main__':
unittest.main()

0 comments on commit 8d232b2

Please sign in to comment.