Skip to content

Commit dccd00d

Browse files
gacarrillornyalldawson
authored andcommittedNov 24, 2016
Adding test to Line Intersection algorithm
Since both input and intersect layers have only one field (fid), the result is the same for both (existing and new) tests. The result now comes with the intersect field, renamed to fid_1 (previously not kept).
1 parent 193d400 commit dccd00d

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed
 

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<GMLFeatureClass>
33
<Name>line_intersection</Name>
44
<ElementPath>line_intersection</ElementPath>
5+
<!--POINT-->
56
<GeometryType>1</GeometryType>
67
<SRSName>EPSG:4326</SRSName>
78
<DatasetSpecificInfo>
@@ -11,5 +12,10 @@
1112
<ExtentYMin>-0.22085</ExtentYMin>
1213
<ExtentYMax>3.22098</ExtentYMax>
1314
</DatasetSpecificInfo>
15+
<PropertyDefn>
16+
<Name>fid_1</Name>
17+
<ElementPath>fid_1</ElementPath>
18+
<Type>Integer</Type>
19+
</PropertyDefn>
1420
</GMLFeatureClass>
1521
</GMLFeatureClassList>

‎python/plugins/processing/tests/testdata/expected/line_intersection.gml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,26 @@
1313

1414
<gml:featureMember>
1515
<ogr:line_intersection fid="lines.0">
16-
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>9.220978076442222,3.220978076442222</gml:coordinates></gml:Point></ogr:geometryProperty>
16+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>9.22097807644222,3.22097807644222</gml:coordinates></gml:Point></ogr:geometryProperty>
17+
<ogr:fid_1>3</ogr:fid_1>
1718
</ogr:line_intersection>
1819
</gml:featureMember>
1920
<gml:featureMember>
2021
<ogr:line_intersection fid="lines.2">
2122
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3.0,2.8034726769992</gml:coordinates></gml:Point></ogr:geometryProperty>
23+
<ogr:fid_1>3</ogr:fid_1>
2224
</ogr:line_intersection>
2325
</gml:featureMember>
2426
<gml:featureMember>
2527
<ogr:line_intersection fid="lines.3">
26-
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3.155795677799609,1.0</gml:coordinates></gml:Point></ogr:geometryProperty>
28+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3.15579567779961,1.0</gml:coordinates></gml:Point></ogr:geometryProperty>
29+
<ogr:fid_1>2</ogr:fid_1>
2730
</ogr:line_intersection>
2831
</gml:featureMember>
2932
<gml:featureMember>
3033
<ogr:line_intersection fid="lines.5">
31-
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8.779149848187174,-0.220850151812825</gml:coordinates></gml:Point></ogr:geometryProperty>
34+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8.77914984818717,-0.220850151812825</gml:coordinates></gml:Point></ogr:geometryProperty>
35+
<ogr:fid_1>2</ogr:fid_1>
3236
</ogr:line_intersection>
3337
</gml:featureMember>
3438
</ogr:FeatureCollection>

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,8 +1137,9 @@ tests:
11371137
hash: 7fe0e0174185fd743e23760f33615adf10f771b4275f320db6f7f4f8
11381138
type: rasterhash
11391139

1140+
# Case 1: Keep all fields
11401141
- algorithm: qgis:lineintersections
1141-
name: Line intersection
1142+
name: Line Intersection Keep All Fields from Both
11421143
params:
11431144
INPUT_A:
11441145
name: lines.gml
@@ -1150,6 +1151,23 @@ tests:
11501151
OUTPUT:
11511152
name: expected/line_intersection.gml
11521153
type: vector
1154+
1155+
# Case 2: Keep fid field from both layers
1156+
- algorithm: qgis:lineintersections
1157+
name: Line Intersection Keep fid from Both
1158+
params:
1159+
FIELD_A: fid
1160+
FIELD_B: fid
1161+
INPUT_A:
1162+
name: lines.gml
1163+
type: vector
1164+
INPUT_B:
1165+
name: simplify_lines.gml
1166+
type: vector
1167+
results:
1168+
OUTPUT:
1169+
name: expected/line_intersection.gml
1170+
type: vector
11531171

11541172
- algorithm: qgis:sumlinelengths
11551173
name: Sum line lengths

0 commit comments

Comments
 (0)
Please sign in to comment.