Skip to content

Commit 69a25d0

Browse files
committedAug 4, 2017
Add initial test suite for processing algorithm dialog
1 parent 34ef954 commit 69a25d0

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed
 

‎python/plugins/processing/gui/AlgorithmDialogBase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def pushConsoleInfo(self, msg):
8585
class AlgorithmDialogBase(BASE, WIDGET):
8686

8787
def __init__(self, alg):
88-
super(AlgorithmDialogBase, self).__init__(iface.mainWindow())
88+
super(AlgorithmDialogBase, self).__init__(iface.mainWindow() if iface else None)
8989
self.setupUi(self)
9090

9191
# don't collapse parameters panel

‎python/plugins/processing/tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ PLUGIN_INSTALL(processing tests/testdata ${TEST_DATA_FILES})
66

77
IF(ENABLE_TESTS)
88
INCLUDE(UsePythonTest)
9+
ADD_PYTHON_TEST(ProcessingGuiTest GuiTest.py)
910
ADD_PYTHON_TEST(ProcessingParametersTest ParametersTest.py)
1011
ADD_PYTHON_TEST(ProcessingModelerTest ModelerTest.py)
1112
ADD_PYTHON_TEST(ProcessingToolsTest ToolsTest.py)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
ParametersTest
6+
---------------------
7+
Date : August 2017
8+
Copyright : (C) 2017 by Nyall Dawson
9+
Email : nyall dot dawson at gmail dot com
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = 'Nyall Dawson'
21+
__date__ = 'August 2017'
22+
__copyright__ = '(C) 2017, Nyall Dawson'
23+
24+
# This will get replaced with a git SHA1 when you do a git archive
25+
26+
__revision__ = '$Format:%H$'
27+
28+
from qgis.testing import start_app, unittest
29+
from qgis.core import QgsApplication
30+
31+
from processing.gui.AlgorithmDialog import AlgorithmDialog
32+
33+
start_app()
34+
35+
36+
class AlgorithmDialogTest(unittest.TestCase):
37+
38+
def testCreation(self):
39+
alg = QgsApplication.processingRegistry().algorithmById('native:centroids')
40+
a = AlgorithmDialog(alg)
41+
self.assertEqual(a.mainWidget().alg, alg)
42+
43+
44+
if __name__ == '__main__':
45+
unittest.main()

0 commit comments

Comments
 (0)
Please sign in to comment.