Skip to content

Commit ab823c4

Browse files
committed
[processing] add tests for network analysis algorithms
Tests dissabled for now, as algorithms require access to QGIS iface.
1 parent 77ecfb9 commit ab823c4

File tree

9 files changed

+838
-3
lines changed

9 files changed

+838
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<GMLFeatureClassList>
2+
<GMLFeatureClass>
3+
<Name>fastest</Name>
4+
<ElementPath>fastest</ElementPath>
5+
<!--LINESTRING-->
6+
<GeometryType>2</GeometryType>
7+
<SRSName>EPSG:32733</SRSName>
8+
<DatasetSpecificInfo>
9+
<FeatureCount>1</FeatureCount>
10+
<ExtentXMin>1000953.57974</ExtentXMin>
11+
<ExtentXMax>1003540.98718</ExtentXMax>
12+
<ExtentYMin>6219890.54669</ExtentYMin>
13+
<ExtentYMax>6222358.69756</ExtentYMax>
14+
</DatasetSpecificInfo>
15+
</GMLFeatureClass>
16+
</GMLFeatureClassList>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ogr:FeatureCollection
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation=""
5+
xmlns:ogr="http://ogr.maptools.org/"
6+
xmlns:gml="http://www.opengis.net/gml">
7+
<gml:boundedBy>
8+
<gml:Box>
9+
<gml:coord><gml:X>1000953.579740714</gml:X><gml:Y>6219890.54669478</gml:Y></gml:coord>
10+
<gml:coord><gml:X>1003540.987180206</gml:X><gml:Y>6222358.69755776</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:fastest fid="fastest.0">
16+
<ogr:geometryProperty><gml:LineString srsName="EPSG:32733"><gml:coordinates>1000953.57974071,6220312.94386716 1001107.24684923,6220391.87436156 1001202.14148585,6220278.54570253 1001223.5527025,6220254.162188 1001246.61300986,6220217.55052604 1001256.7885771,6220198.09709699 1001288.75671853,6220134.59225221 1001316.12250986,6220076.61143154 1001343.39016642,6220022.54512089 1001398.88208812,6219947.57470368 1001446.00944971,6219890.54669478 1001690.15771473,6220308.37238282 1001859.8438323,6220539.82106708 1002257.84768038,6220937.82878925 1002518.75791724,6221133.53444839 1002622.66996036,6221162.46807726 1002667.16458207,6221195.87188063 1002845.50542017,6221400.90692838 1003028.1814962,6221611.96830289 1003474.59453034,6222127.67457486 1003406.90500878,6222189.64158806 1003472.3070191,6222272.11630568 1003483.81137232,6222286.60579404 1003540.98718021,6222358.69755776</gml:coordinates></gml:LineString></ogr:geometryProperty>
17+
</ogr:fastest>
18+
</gml:featureMember>
19+
</ogr:FeatureCollection>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<GMLFeatureClassList>
2+
<GMLFeatureClass>
3+
<Name>servicearea</Name>
4+
<ElementPath>servicearea</ElementPath>
5+
<!--POLYGON-->
6+
<GeometryType>3</GeometryType>
7+
<SRSName>EPSG:32733</SRSName>
8+
<DatasetSpecificInfo>
9+
<FeatureCount>2</FeatureCount>
10+
<ExtentXMin>1001968.37489</ExtentXMin>
11+
<ExtentXMax>1003285.47179</ExtentXMax>
12+
<ExtentYMin>6221400.90693</ExtentYMin>
13+
<ExtentYMax>6222727.93692</ExtentYMax>
14+
</DatasetSpecificInfo>
15+
<PropertyDefn>
16+
<Name>type</Name>
17+
<ElementPath>type</ElementPath>
18+
<Type>String</Type>
19+
<Width>5</Width>
20+
</PropertyDefn>
21+
</GMLFeatureClass>
22+
</GMLFeatureClassList>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ogr:FeatureCollection
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation=""
5+
xmlns:ogr="http://ogr.maptools.org/"
6+
xmlns:gml="http://www.opengis.net/gml">
7+
<gml:boundedBy>
8+
<gml:Box>
9+
<gml:coord><gml:X>1001968.37489204</gml:X><gml:Y>6221400.90692838</gml:Y></gml:coord>
10+
<gml:coord><gml:X>1003285.47179071</gml:X><gml:Y>6222727.93691723</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:servicearea fid="servicearea.0">
16+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:32733"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1002845.50542017,6221400.90692838 1001968.37489204,6221502.13083684 1002180.65496167,6222555.77455478 1002527.19655281,6222727.93691723 1003198.63616199,6222463.1404267 1003285.47179071,6222319.99149044 1002845.50542017,6221400.90692838</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
17+
<ogr:type>upper</ogr:type>
18+
</ogr:servicearea>
19+
</gml:featureMember>
20+
<gml:featureMember>
21+
<ogr:servicearea fid="servicearea.1">
22+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:32733"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1002302.22841804,6221576.64258306 1002137.81278244,6221630.62018051 1002286.87770297,6222431.05239093 1002657.05576802,6222472.25802353 1002852.09477137,6222467.55382686 1003172.94058079,6222436.28679202 1003028.1814962,6221611.96830289 1002302.22841804,6221576.64258306</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
23+
<ogr:type>lower</ogr:type>
24+
</ogr:servicearea>
25+
</gml:featureMember>
26+
</ogr:FeatureCollection>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<GMLFeatureClassList>
2+
<GMLFeatureClass>
3+
<Name>shortest</Name>
4+
<ElementPath>shortest</ElementPath>
5+
<!--LINESTRING-->
6+
<GeometryType>2</GeometryType>
7+
<SRSName>EPSG:32733</SRSName>
8+
<DatasetSpecificInfo>
9+
<FeatureCount>1</FeatureCount>
10+
<ExtentXMin>1000953.57974</ExtentXMin>
11+
<ExtentXMax>1003540.98718</ExtentXMax>
12+
<ExtentYMin>6220312.94387</ExtentYMin>
13+
<ExtentYMax>6222436.28679</ExtentYMax>
14+
</DatasetSpecificInfo>
15+
</GMLFeatureClass>
16+
</GMLFeatureClassList>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ogr:FeatureCollection
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation=""
5+
xmlns:ogr="http://ogr.maptools.org/"
6+
xmlns:gml="http://www.opengis.net/gml">
7+
<gml:boundedBy>
8+
<gml:Box>
9+
<gml:coord><gml:X>1000953.57974071</gml:X><gml:Y>6220312.94386716</gml:Y></gml:coord>
10+
<gml:coord><gml:X>1003540.98718021</gml:X><gml:Y>6222436.28679202</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:shortest fid="shortest.0">
16+
<ogr:geometryProperty><gml:LineString srsName="EPSG:32733"><gml:coordinates>1000953.57974071,6220312.94386716 1001107.24684923,6220391.87436156 1001186.34740161,6220459.66433954 1001230.60014311,6220497.58606688 1001417.00785562,6220703.65963346 1001474.56242038,6220771.95914347 1001535.25328051,6220851.26299517 1001730.88604383,6221182.3451556 1001806.08518826,6221307.13224234 1001821.61736105,6221332.90322892 1001835.96992268,6221356.72100035 1001891.40736133,6221430.94581986 1001930.78353526,6221467.36521594 1001968.37489204,6221502.13083684 1002137.81278244,6221630.62018051 1002215.13556068,6221689.25446887 1002288.4678461,6221744.85964495 1002334.20638747,6221779.49098284 1002425.63766482,6221848.74446543 1002462.62346654,6221875.38780442 1002518.06990805,6221915.34875741 1002626.85249869,6221993.7562202 1002657.33259138,6222018.20620536 1002781.74783802,6222107.45193255 1002852.18578258,6222162.74032983 1002903.48249244,6222204.64725757 1002916.58033846,6222216.16749784 1002945.17950103,6222241.31856099 1002991.11072264,6222281.72914386 1003040.80096358,6222322.18412711 1003081.26058941,6222355.11171034 1003105.74257399,6222376.7841218 1003153.88971381,6222419.41498029 1003172.94058079,6222436.28679202 1003285.47179071,6222319.99149044 1003330.95107314,6222272.98904849 1003394.25380049,6222340.63979273 1003441.51556356,6222297.15044041 1003465.11136422,6222304.2892544 1003483.26027016,6222288.61783917 1003483.81137232,6222286.60579404 1003540.98718021,6222358.69755776</gml:coordinates></gml:LineString></ogr:geometryProperty>
17+
</ogr:shortest>
18+
</gml:featureMember>
19+
</ogr:FeatureCollection>

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

+55-3
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ tests:
11621162
OUTPUT:
11631163
name: expected/line_intersection.gml
11641164
type: vector
1165-
1165+
11661166
# Case 2: Keep fid field from both layers
11671167
- algorithm: qgis:lineintersections
11681168
name: Line Intersection Keep fid from Both
@@ -1850,7 +1850,7 @@ tests:
18501850
type: rasterhash
18511851

18521852
- algorithm: qgis:rastercalculator
1853-
name: Raster Calculator
1853+
name: Raster Calculator
18541854
params:
18551855
LAYERS:
18561856
params:
@@ -1893,7 +1893,6 @@ tests:
18931893
geometry:
18941894
precision: 7
18951895

1896-
18971896
- algorithm: qgis:orthogonalize
18981897
name: Orthogonalize lines
18991898
params:
@@ -1908,3 +1907,56 @@ tests:
19081907
geometry:
19091908
precision: 7
19101909

1910+
# These tests dissabled because algs require access to iface which
1911+
# is not available in the test suite.
1912+
#- algorithm: qgis:shortestpath
1913+
# name: Shortest path (shortest route)
1914+
# params:
1915+
# DEFAULT_DIRECTION: '2'
1916+
# DEFAULT_SPEED: 5.0
1917+
# END_POINT: 1003534.816864,6222363.591221
1918+
# INPUT_VECTOR:
1919+
# name: roads.gml
1920+
# type: vector
1921+
# START_POINT: 1000943.661493,6220332.253368
1922+
# STRATEGY: '0'
1923+
# TOLERANCE: 0.0
1924+
# results:
1925+
# OUTPUT_LAYER:
1926+
# name: expected/shortest.gml
1927+
# type: vector
1928+
1929+
#- algorithm: qgis:shortestpath
1930+
# name: Shortest path (fastest route)
1931+
# params:
1932+
# DEFAULT_DIRECTION: '2'
1933+
# DEFAULT_SPEED: 60.0
1934+
# END_POINT: 1003534.816864,6222363.591221
1935+
# INPUT_VECTOR:
1936+
# name: roads.gml
1937+
# type: vector
1938+
# SPEED_FIELD: SPEED
1939+
# START_POINT: 1000943.661493,6220332.253368
1940+
# STRATEGY: '1'
1941+
# TOLERANCE: 0.0
1942+
# results:
1943+
# OUTPUT_LAYER:
1944+
# name: expected/fastest.gml
1945+
# type: vector
1946+
1947+
#- algorithm: qgis:servicearea
1948+
# name: Service area (route length)
1949+
# params:
1950+
# DEFAULT_DIRECTION: '2'
1951+
# DEFAULT_SPEED: 5.0
1952+
# INPUT_VECTOR:
1953+
# name: roads.gml
1954+
# type: vector
1955+
# START_POINT: 1002660.341692,6222015.780774
1956+
# STRATEGY: '0'
1957+
# TOLERANCE: 0.0
1958+
# TRAVEL_COST: 700.0
1959+
# results:
1960+
# OUTPUT_LAYER:
1961+
# name: expected/servicearea.gml
1962+
# type: vector
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<GMLFeatureClassList>
2+
<GMLFeatureClass>
3+
<Name>roads</Name>
4+
<ElementPath>roads</ElementPath>
5+
<!--LINESTRING-->
6+
<GeometryType>2</GeometryType>
7+
<SRSName>EPSG:32733</SRSName>
8+
<DatasetSpecificInfo>
9+
<FeatureCount>105</FeatureCount>
10+
<ExtentXMin>1000449.94001</ExtentXMin>
11+
<ExtentXMax>1005036.20988</ExtentXMax>
12+
<ExtentYMin>6219385.32394</ExtentYMin>
13+
<ExtentYMax>6223414.48676</ExtentYMax>
14+
</DatasetSpecificInfo>
15+
<PropertyDefn>
16+
<Name>SPEED</Name>
17+
<ElementPath>SPEED</ElementPath>
18+
<Type>Integer</Type>
19+
</PropertyDefn>
20+
</GMLFeatureClass>
21+
</GMLFeatureClassList>

0 commit comments

Comments
 (0)