Skip to content

Commit a369c9b

Browse files
authoredAug 17, 2017
Merge pull request #4760 from nyalldawson/tests
Convert processing tests to use native algs where they exist
2 parents 5fbd628 + 7b2250b commit a369c9b

File tree

3 files changed

+49
-48
lines changed

3 files changed

+49
-48
lines changed
 

‎python/plugins/processing/tests/AlgorithmsTestBase.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656

5757
from qgis.core import (QgsVectorLayer,
5858
QgsRasterLayer,
59+
QgsFeatureRequest,
5960
QgsMapLayer,
6061
QgsProject,
6162
QgsApplication,
@@ -123,6 +124,10 @@ def check_algorithm(self, name, defs):
123124
# ignore user setting for invalid geometry handling
124125
context = QgsProcessingContext()
125126
context.setProject(QgsProject.instance())
127+
128+
if 'skipInvalid' in defs and defs['skipInvalid']:
129+
context.setInvalidGeometryCheck(QgsFeatureRequest.GeometrySkipInvalid)
130+
126131
feedback = QgsProcessingFeedback()
127132

128133
if expectFailure:

‎python/plugins/processing/tests/testdata/expected/nullGeometryDissolve_output.gfs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<GMLFeatureClass>
33
<Name>nullGeometryDissolve_output</Name>
44
<ElementPath>nullGeometryDissolve_output</ElementPath>
5-
<GeometryType>3</GeometryType>
5+
<!--MULTIPOLYGON-->
6+
<GeometryType>6</GeometryType>
67
<SRSName>EPSG:3003</SRSName>
78
<DatasetSpecificInfo>
89
<FeatureCount>1</FeatureCount>

‎python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml

Lines changed: 42 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -289,53 +289,48 @@ tests:
289289
name: expected/dissolve_two_fields.gml
290290
type: vector
291291

292-
# - name: Dissolve with geometries reported as valid but as invalid with isGeosValid
293-
# algorithm: qgis:dissolve
294-
# params:
295-
# DISSOLVE_ALL: 'True'
296-
# FIELD: None
297-
# INPUT:
298-
# name: custom/innerRingTouchesOuterRing.gml
299-
# type: vector
300-
# results:
301-
# OUTPUT:
302-
# type: vector
303-
# name: expected/innerRingTouchesOuterRing_output.gml
304-
# compare:
305-
# geometry:
306-
# precision: 0
307-
#
308-
# - name: Dissolve with NULL geometries
309-
# algorithm: qgis:dissolve
310-
# params:
311-
# DISSOLVE_ALL: 'True'
312-
# FIELD: None
313-
# INPUT:
314-
# name: custom/nullGeometryDissolve.gml
315-
# type: vector
316-
# results:
317-
# OUTPUT:
318-
# type: vector
319-
# name: expected/nullGeometryDissolve_output.gml
320-
# compare:
321-
# geometry:
322-
# precision: 7
323-
#
324-
# - name: Dissolve with invalid geometries
325-
# algorithm: qgis:dissolve
326-
# params:
327-
# DISSOLVE_ALL: 'True'
328-
# FIELD: None
329-
# INPUT:
330-
# name: custom/PolygonDissolveTest.gml
331-
# type: vector
332-
# results:
333-
# OUTPUT:
334-
# type: vector
335-
# name: expected/PolygonDissolveTest_output.gml
336-
# compare:
337-
# geometry:
338-
# precision: 7
292+
- name: Dissolve with geometries reported as valid but as invalid with isGeosValid
293+
algorithm: native:dissolve
294+
params:
295+
INPUT:
296+
name: custom/innerRingTouchesOuterRing.gml
297+
type: vector
298+
results:
299+
OUTPUT:
300+
type: vector
301+
name: expected/innerRingTouchesOuterRing_output.gml
302+
compare:
303+
geometry:
304+
precision: 0
305+
306+
- name: Dissolve with NULL geometries
307+
algorithm: native:dissolve
308+
params:
309+
INPUT:
310+
name: custom/nullGeometryDissolve.gml
311+
type: vector
312+
results:
313+
OUTPUT:
314+
type: vector
315+
name: expected/nullGeometryDissolve_output.gml
316+
compare:
317+
geometry:
318+
precision: 7
319+
320+
- name: Dissolve with invalid geometries
321+
algorithm: native:dissolve
322+
skipInvalid: true
323+
params:
324+
INPUT:
325+
name: custom/PolygonDissolveTest.gml
326+
type: vector
327+
results:
328+
OUTPUT:
329+
type: vector
330+
name: expected/PolygonDissolveTest_output.gml
331+
compare:
332+
geometry:
333+
precision: 7
339334

340335
- algorithm: qgis:fixeddistancebuffer
341336
name: Basic polygon buffer

0 commit comments

Comments
 (0)
Please sign in to comment.