Skip to content

Commit

Permalink
Convert processing tests to use native algs where they exist
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 17, 2017
1 parent 469eb0d commit 7b2250b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 48 deletions.
5 changes: 5 additions & 0 deletions python/plugins/processing/tests/AlgorithmsTestBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

from qgis.core import (QgsVectorLayer,
QgsRasterLayer,
QgsFeatureRequest,
QgsMapLayer,
QgsProject,
QgsApplication,
Expand Down Expand Up @@ -123,6 +124,10 @@ def check_algorithm(self, name, defs):
# ignore user setting for invalid geometry handling
context = QgsProcessingContext()
context.setProject(QgsProject.instance())

if 'skipInvalid' in defs and defs['skipInvalid']:
context.setInvalidGeometryCheck(QgsFeatureRequest.GeometrySkipInvalid)

feedback = QgsProcessingFeedback()

if expectFailure:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<GMLFeatureClass>
<Name>nullGeometryDissolve_output</Name>
<ElementPath>nullGeometryDissolve_output</ElementPath>
<GeometryType>3</GeometryType>
<!--MULTIPOLYGON-->
<GeometryType>6</GeometryType>
<SRSName>EPSG:3003</SRSName>
<DatasetSpecificInfo>
<FeatureCount>1</FeatureCount>
Expand Down
89 changes: 42 additions & 47 deletions python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -289,53 +289,48 @@ tests:
name: expected/dissolve_two_fields.gml
type: vector

# - name: Dissolve with geometries reported as valid but as invalid with isGeosValid
# algorithm: qgis:dissolve
# params:
# DISSOLVE_ALL: 'True'
# FIELD: None
# INPUT:
# name: custom/innerRingTouchesOuterRing.gml
# type: vector
# results:
# OUTPUT:
# type: vector
# name: expected/innerRingTouchesOuterRing_output.gml
# compare:
# geometry:
# precision: 0
#
# - name: Dissolve with NULL geometries
# algorithm: qgis:dissolve
# params:
# DISSOLVE_ALL: 'True'
# FIELD: None
# INPUT:
# name: custom/nullGeometryDissolve.gml
# type: vector
# results:
# OUTPUT:
# type: vector
# name: expected/nullGeometryDissolve_output.gml
# compare:
# geometry:
# precision: 7
#
# - name: Dissolve with invalid geometries
# algorithm: qgis:dissolve
# params:
# DISSOLVE_ALL: 'True'
# FIELD: None
# INPUT:
# name: custom/PolygonDissolveTest.gml
# type: vector
# results:
# OUTPUT:
# type: vector
# name: expected/PolygonDissolveTest_output.gml
# compare:
# geometry:
# precision: 7
- name: Dissolve with geometries reported as valid but as invalid with isGeosValid
algorithm: native:dissolve
params:
INPUT:
name: custom/innerRingTouchesOuterRing.gml
type: vector
results:
OUTPUT:
type: vector
name: expected/innerRingTouchesOuterRing_output.gml
compare:
geometry:
precision: 0

- name: Dissolve with NULL geometries
algorithm: native:dissolve
params:
INPUT:
name: custom/nullGeometryDissolve.gml
type: vector
results:
OUTPUT:
type: vector
name: expected/nullGeometryDissolve_output.gml
compare:
geometry:
precision: 7

- name: Dissolve with invalid geometries
algorithm: native:dissolve
skipInvalid: true
params:
INPUT:
name: custom/PolygonDissolveTest.gml
type: vector
results:
OUTPUT:
type: vector
name: expected/PolygonDissolveTest_output.gml
compare:
geometry:
precision: 7

- algorithm: qgis:fixeddistancebuffer
name: Basic polygon buffer
Expand Down

0 comments on commit 7b2250b

Please sign in to comment.