Skip to content

Commit

Permalink
Add initial test suite for processing algorithm dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 4, 2017
1 parent 34ef954 commit 69a25d0
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/plugins/processing/gui/AlgorithmDialogBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def pushConsoleInfo(self, msg):
class AlgorithmDialogBase(BASE, WIDGET):

def __init__(self, alg):
super(AlgorithmDialogBase, self).__init__(iface.mainWindow())
super(AlgorithmDialogBase, self).__init__(iface.mainWindow() if iface else None)
self.setupUi(self)

# don't collapse parameters panel
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ PLUGIN_INSTALL(processing tests/testdata ${TEST_DATA_FILES})

IF(ENABLE_TESTS)
INCLUDE(UsePythonTest)
ADD_PYTHON_TEST(ProcessingGuiTest GuiTest.py)
ADD_PYTHON_TEST(ProcessingParametersTest ParametersTest.py)
ADD_PYTHON_TEST(ProcessingModelerTest ModelerTest.py)
ADD_PYTHON_TEST(ProcessingToolsTest ToolsTest.py)
Expand Down
45 changes: 45 additions & 0 deletions python/plugins/processing/tests/GuiTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
ParametersTest
---------------------
Date : August 2017
Copyright : (C) 2017 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""

__author__ = 'Nyall Dawson'
__date__ = 'August 2017'
__copyright__ = '(C) 2017, Nyall Dawson'

# This will get replaced with a git SHA1 when you do a git archive

__revision__ = '$Format:%H$'

from qgis.testing import start_app, unittest
from qgis.core import QgsApplication

from processing.gui.AlgorithmDialog import AlgorithmDialog

start_app()


class AlgorithmDialogTest(unittest.TestCase):

def testCreation(self):
alg = QgsApplication.processingRegistry().algorithmById('native:centroids')
a = AlgorithmDialog(alg)
self.assertEqual(a.mainWidget().alg, alg)


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

0 comments on commit 69a25d0

Please sign in to comment.