Skip to content

Commit

Permalink
Merge pull request #6764 from tudorbarascu/featureinfo_values
Browse files Browse the repository at this point in the history
server tests for GetFeatureinfo different widget values
  • Loading branch information
elpaso committed May 8, 2018
2 parents 83218c9 + 90355f0 commit f2304c1
Show file tree
Hide file tree
Showing 8 changed files with 1,837 additions and 2 deletions.
72 changes: 70 additions & 2 deletions tests/src/python/test_qgsserver_wms_getfeatureinfo.py
Expand Up @@ -66,7 +66,7 @@ def testGetFeatureInfo(self):
'query_layers=testlayer%20%C3%A8%C3%A9&X=190&Y=320',
'wms_getfeatureinfo-text-html')

#Test getfeatureinfo response html with geometry
# Test getfeatureinfo response html with geometry
self.wms_request_compare('GetFeatureInfo',
'&layers=testlayer%20%C3%A8%C3%A9&styles=&' +
'info_format=text%2Fhtml&transparent=true&' +
Expand All @@ -76,7 +76,7 @@ def testGetFeatureInfo(self):
'with_geometry=true',
'wms_getfeatureinfo-text-html-geometry')

#Test getfeatureinfo response html with maptip
# Test getfeatureinfo response html with maptip
self.wms_request_compare('GetFeatureInfo',
'&layers=testlayer%20%C3%A8%C3%A9&styles=&' +
'info_format=text%2Fhtml&transparent=true&' +
Expand Down Expand Up @@ -167,6 +167,74 @@ def testGetFeatureInfo(self):
'wms_getfeatureinfo_notvisible',
'test_project_scalevisibility.qgs')

# Test GetFeatureInfo resolves "value map" widget values
mypath = self.testdata_path + "test_project_values.qgs"
self.wms_request_compare('GetFeatureInfo',
'&layers=layer0&styles=&' +
'VERSION=1.3.0&' +
'info_format=text%2Fxml&' +
'width=926&height=787&srs=EPSG%3A4326' +
'&bbox=912217,5605059,914099,5606652' +
'&CRS=EPSG:3857' +
'&FEATURE_COUNT=10' +
'&QUERY_LAYERS=layer0&I=487&J=308',
'wms_getfeatureinfo-values1-text-xml',
'test_project_values.qgs')

# TODO fix regression in QGIS 3 as the widget values don't get solved and enable test
@unittest.expectedFailure
def testGetFeatureInfoValueRelation(self):
"""Test GetFeatureInfo resolves "value relation" widget values"""
mypath = self.testdata_path + "test_project_values.qgs"
self.wms_request_compare('GetFeatureInfo',
'&layers=layer1&styles=&' +
'VERSION=1.3.0&' +
'info_format=text%2Fxml&' +
'width=926&height=787&srs=EPSG%3A4326' +
'&bbox=912217,5605059,914099,5606652' +
'&CRS=EPSG:3857' +
'&FEATURE_COUNT=10' +
'&WITH_GEOMETRY=True' +
'&QUERY_LAYERS=layer1&I=487&J=308',
'wms_getfeatureinfo-values1-text-xml',
'test_project_values.qgs')

# TODO make GetFeatureInfo show the dictionary values and enable test
@unittest.expectedFailure
def testGetFeatureInfoValueRelationArray(self):
"""Test GetFeatureInfo on "value relation" widget with array field (multiple selections)"""
mypath = self.testdata_path + "test_project_values.qgs"
self.wms_request_compare('GetFeatureInfo',
'&layers=layer3&styles=&' +
'VERSION=1.3.0&' +
'info_format=text%2Fxml&' +
'width=926&height=787&srs=EPSG%3A4326' +
'&bbox=912217,5605059,914099,5606652' +
'&CRS=EPSG:3857' +
'&FEATURE_COUNT=10' +
'&WITH_GEOMETRY=True' +
'&QUERY_LAYERS=layer3&I=487&J=308',
'wms_getfeatureinfo-values3-text-xml',
'test_project_values.qgs')

# TODO make GetFeatureInfo show what's in the display expression and enable test
@unittest.expectedFailure
def testGetFeatureInfoRelationReference(self):
"""Test GetFeatureInfo solves "relation reference" widget "display expression" values"""
mypath = self.testdata_path + "test_project_values.qgs"
self.wms_request_compare('GetFeatureInfo',
'&layers=layer2&styles=&' +
'VERSION=1.3.0&' +
'info_format=text%2Fxml&' +
'width=926&height=787&srs=EPSG%3A4326' +
'&bbox=912217,5605059,914099,5606652' +
'&CRS=EPSG:3857' +
'&FEATURE_COUNT=10' +
'&WITH_GEOMETRY=True' +
'&QUERY_LAYERS=layer2&I=487&J=308',
'wms_getfeatureinfo-values2-text-xml',
'test_project_values.qgs')

def testGetFeatureInfoFilter(self):
# Test getfeatureinfo response xml

Expand Down
8 changes: 8 additions & 0 deletions tests/testdata/provider/testdata_pg.sql
Expand Up @@ -76,6 +76,14 @@ INSERT INTO qgis_test."some_poly_data" (pk, geom) VALUES
(4, NULL)
;


CREATE TABLE qgis_test.array_tbl (id serial PRIMARY KEY, location int[], geom geometry(Point,3857));

INSERT INTO qgis_test.array_tbl (location, geom) VALUES ('{1, 2, 3}', 'srid=3857;Point(913209.0358 5606025.2373)'::geometry);
INSERT INTO qgis_test.array_tbl (location, geom) VALUES ('{}', 'srid=3857;Point(913214.6741 5606017.8743)'::geometry);
INSERT INTO qgis_test.array_tbl (geom) VALUES ('srid=3857;Point(913204.9128 5606011.4565)'::geometry);


-- Provider check with compound key

CREATE TABLE qgis_test."someDataCompound" (
Expand Down
4 changes: 4 additions & 0 deletions tests/testdata/qgis_server/material_values.csv
@@ -0,0 +1,4 @@
id,short_ro,_displayname_en,diameter,pressure_nominal
1,PE,PE 1000 PN6,1000,6
2,PE,PE,,
3,PE,PE 1000 PN8,1000,8

0 comments on commit f2304c1

Please sign in to comment.