Skip to content

Commit

Permalink
Swap unit tests to use native algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 8, 2017
1 parent cecdf33 commit f4b9bbd
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 77 deletions.
Expand Up @@ -12,21 +12,5 @@
<ExtentYMin>-3.00000</ExtentYMin>
<ExtentYMax>3.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>name</Name>
<ElementPath>name</ElementPath>
<Type>String</Type>
<Width>5</Width>
</PropertyDefn>
<PropertyDefn>
<Name>intval</Name>
<ElementPath>intval</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>floatval</Name>
<ElementPath>floatval</ElementPath>
<Type>Real</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>
Expand Up @@ -12,26 +12,18 @@
</gml:boundedBy>

<gml:featureMember>
<ogr:extract_by_location_intersection fid="polys.0">
<ogr:extract_by_location_intersection fid="extract_by_location_intersection.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
</ogr:extract_by_location_intersection>
</gml:featureMember>
<gml:featureMember>
<ogr:extract_by_location_intersection fid="polys.3">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,1 10,1 10,-3 6,-3 6,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,0 7,-2 9,-2 9,0 7,0</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>ASDF</ogr:name>
<ogr:intval>0</ogr:intval>
<ogr:extract_by_location_intersection fid="extract_by_location_intersection.1">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,2 6,1 6,-3 2,-1 2,2 3,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
</ogr:extract_by_location_intersection>
</gml:featureMember>
<gml:featureMember>
<ogr:extract_by_location_intersection fid="polys.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,2 6,1 6,-3 2,-1 2,2 3,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>elim</ogr:name>
<ogr:intval>2</ogr:intval>
<ogr:floatval>3.33</ogr:floatval>
<ogr:extract_by_location_intersection fid="extract_by_location_intersection.2">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,1 10,1 10,-3 6,-3 6,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,0 7,-2 9,-2 9,0 7,0</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></ogr:geometryProperty>
</ogr:extract_by_location_intersection>
</gml:featureMember>
</ogr:FeatureCollection>
Expand Up @@ -12,15 +12,5 @@
<ExtentYMin>1.00000</ExtentYMin>
<ExtentYMax>1.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>id</Name>
<ElementPath>id</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>id2</Name>
<ElementPath>id2</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>
Expand Up @@ -12,17 +12,13 @@
</gml:boundedBy>

<gml:featureMember>
<ogr:extract_by_location_within fid="points.0">
<ogr:extract_by_location_within fid="extract_by_location_within.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>1,1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>1</ogr:id>
<ogr:id2>2</ogr:id2>
</ogr:extract_by_location_within>
</gml:featureMember>
<gml:featureMember>
<ogr:extract_by_location_within fid="points.4">
<ogr:extract_by_location_within fid="extract_by_location_within.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>4,1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>5</ogr:id>
<ogr:id2>1</ogr:id2>
</ogr:extract_by_location_within>
</gml:featureMember>
</ogr:FeatureCollection>
68 changes: 36 additions & 32 deletions python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
Expand Up @@ -2970,38 +2970,42 @@ tests:
name: expected/convert_poly_nodes.gml
type: vector

# # - algorithm: qgis:extractbylocation
# # name: polygon intersecting points
# # params:
# # INPUT:
# # name: polys.gml
# # type: vector
# # INTERSECT:
# # name: custom/points.shp
# # type: vector
# # PRECISION: 0.0
# # PREDICATE: '[''intersects'']'
# # results:
# # OUTPUT:
# # name: expected/extract_by_location_intersection.gml
# # type: vector
# #
# # - algorithm: qgis:extractbylocation
# # name: points within polygons
# # params:
# # INPUT:
# # name: custom/points.shp
# # type: vector
# # INTERSECT:
# # name: polys.gml
# # type: vector
# # PRECISION: 0.0
# # PREDICATE: '[''within'']'
# # results:
# # OUTPUT:
# # name: expected/extract_by_location_within.gml
# # type: vector
#
- algorithm: native:extractbylocation
name: polygon intersecting points
params:
INPUT:
name: polys.gml
type: vector
INTERSECT:
name: custom/points.shp
type: vector
PREDICATE: 0
results:
OUTPUT:
name: expected/extract_by_location_intersection.gml
type: vector
compare:
fields:
fid: skip

- algorithm: native:extractbylocation
name: points within polygons
params:
INPUT:
name: custom/points.shp
type: vector
INTERSECT:
name: polys.gml
type: vector
PREDICATE: 6
results:
OUTPUT:
name: expected/extract_by_location_within.gml
type: vector
compare:
fields:
fid: skip

- algorithm: qgis:addfieldtoattributestable
name: add float field
params:
Expand Down

0 comments on commit f4b9bbd

Please sign in to comment.