Skip to content
Permalink
Browse files

Tests QgsProcessingParameterBoolean

  • Loading branch information
rldhont authored and nyalldawson committed May 4, 2021
1 parent 08947d7 commit 2754f829dd290d1c331de1d65847ba29410e4ab4
Showing with 28 additions and 0 deletions.
  1. +28 −0 python/plugins/processing/tests/ParametersTest.py
@@ -146,6 +146,34 @@ def testParameterNumberDesc(self):
self.assertEqual(param.minimum(), 0)
self.assertEqual(param.maximum(), 20)

def testParameterBooleanDesc(self):
desc = 'QgsProcessingParameterBoolean|in_bool|Input Boolean'
param = getParameterFromString(desc)
self.assertIsNotNone(param)
self.assertEqual(param.type(), 'boolean')
self.assertEqual(param.name(), 'in_bool')
self.assertEqual(param.description(), 'Input Boolean')
self.assertFalse(param.defaultValue())
self.assertFalse(param.flags() & QgsProcessingParameterDefinition.FlagOptional)

desc = 'QgsProcessingParameterBoolean|in_bool|Input Boolean|True'
param = getParameterFromString(desc)
self.assertIsNotNone(param)
self.assertEqual(param.type(), 'boolean')
self.assertEqual(param.name(), 'in_bool')
self.assertEqual(param.description(), 'Input Boolean')
self.assertTrue(param.defaultValue())
self.assertFalse(param.flags() & QgsProcessingParameterDefinition.FlagOptional)

desc = 'QgsProcessingParameterBoolean|in_bool|Input Boolean|False|True'
param = getParameterFromString(desc)
self.assertIsNotNone(param)
self.assertEqual(param.type(), 'boolean')
self.assertEqual(param.name(), 'in_bool')
self.assertEqual(param.description(), 'Input Boolean')
self.assertFalse(param.defaultValue())
self.assertTrue(param.flags() & QgsProcessingParameterDefinition.FlagOptional)


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

0 comments on commit 2754f82

Please sign in to comment.