Skip to content

Commit

Permalink
make advanced params optional to keep algorithm API stable
Browse files Browse the repository at this point in the history
(cherry picked from commit c643837)
  • Loading branch information
alexbruy committed Jan 1, 2019
1 parent be60f12 commit cee8a20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/plugins/processing/algs/gdal/gdaladdo.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@ def initAlgorithm(self, config=None):
self.tr('Resampling method'),
options=[i[0] for i in self.methods],
allowMultiple=False,
defaultValue=0))
defaultValue=0,
optional=True))
params.append(QgsProcessingParameterEnum(self.FORMAT,
self.tr('Overviews format'),
options=self.formats,
allowMultiple=False,
defaultValue=0))
defaultValue=0,
optional=True))
for p in params:
p.setFlags(p.flags() | QgsProcessingParameterDefinition.FlagAdvanced)
self.addParameter(p)
Expand Down
8 changes: 8 additions & 0 deletions python/plugins/processing/tests/GdalAlgorithmsTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2440,6 +2440,14 @@ def testGdalAddo(self):
['gdaladdo',
source + ' ' + '-r nearest 2 4 8 16 32 64'])

# without advanced params
self.assertEqual(
alg.getConsoleCommands({'INPUT': source,
'LEVELS': '2 4 8 16',
'CLEAN': False}, context, feedback),
['gdaladdo',
source + ' ' + '-r nearest 2 4 8 16'])


class TestGdalOgrToPostGis(unittest.TestCase):

Expand Down

0 comments on commit cee8a20

Please sign in to comment.