[server] More WMS tests for FILTER parameter with bool operators and UTF8

Forward port from 2.18 commit 8fd4fc60697738a986207
This commit is contained in:
Alessandro Pasotti 2017-05-06 10:45:10 +02:00
parent a46e9a56c9
commit 3c4567d0af
4 changed files with 80 additions and 0 deletions

View File

@ -96,6 +96,35 @@ class TestQgsServerWMS(QgsServerTestBase):
'FEATURE_COUNT=10&FILTER=testlayer%20%C3%A8%C3%A9' + urllib.parse.quote(':"NAME" = \'two\''),
'wms_getfeatureinfo_filter')
# Test a filter with NO condition results
self.wms_request_compare('GetFeatureInfo',
'&layers=testlayer%20%C3%A8%C3%A9&' +
'INFO_FORMAT=text%2Fxml&' +
'width=600&height=400&srs=EPSG%3A3857&' +
'query_layers=testlayer%20%C3%A8%C3%A9&' +
'FEATURE_COUNT=10&FILTER=testlayer%20%C3%A8%C3%A9' + urllib.parse.quote(':"NAME" = \'two\' AND "utf8nameè" = \'no-results\''),
'wms_getfeatureinfo_filter_no_results')
# Test a filter with OR condition results
self.wms_request_compare('GetFeatureInfo',
'&layers=testlayer%20%C3%A8%C3%A9&' +
'INFO_FORMAT=text%2Fxml&' +
'width=600&height=400&srs=EPSG%3A3857&' +
'query_layers=testlayer%20%C3%A8%C3%A9&' +
'FEATURE_COUNT=10&FILTER=testlayer%20%C3%A8%C3%A9' + urllib.parse.quote(':"NAME" = \'two\' OR "NAME" = \'three\''),
'wms_getfeatureinfo_filter_or')
# Test a filter with OR condition and UTF results
# Note that the layer name that contains utf-8 chars cannot be
# to upper case.
self.wms_request_compare('GetFeatureInfo',
'&layers=testlayer%20%C3%A8%C3%A9&' +
'INFO_FORMAT=text%2Fxml&' +
'width=600&height=400&srs=EPSG%3A3857&' +
'query_layers=testlayer%20%C3%A8%C3%A9&' +
'FEATURE_COUNT=10&FILTER=testlayer%20%C3%A8%C3%A9' + urllib.parse.quote(':"NAME" = \'two\' OR "utf8nameè" = \'three èé↓\''),
'wms_getfeatureinfo_filter_or_utf8')
def wms_inspire_request_compare(self, request):
"""WMS INSPIRE tests"""
project = self.testdata_path + "test_project_inspire.qgs"

View File

@ -0,0 +1,7 @@
Content-Length: 151
Content-Type: text/xml; charset=utf-8
<GetFeatureInfoResponse>
<BoundingBox maxy="0" maxx="0" miny="0" CRS="EPSG:3857" minx="0"/>
<Layer name="testlayer èé"/>
</GetFeatureInfoResponse>

View File

@ -0,0 +1,22 @@
Content-Length: 943
Content-Type: text/xml; charset=utf-8
<GetFeatureInfoResponse>
<BoundingBox maxy="5606017.87425818" maxx="913214.67407005" miny="5606011.45647302" CRS="EPSG:3857" minx="913204.91280263"/>
<Layer name="testlayer èé">
<Feature id="1">
<Attribute value="2" name="id"/>
<Attribute value="two" name="name"/>
<Attribute value="two àò" name="utf8nameè"/>
<BoundingBox maxy="5606017.8743" maxx="913214.6741" miny="5606017.8743" CRS="EPSG:3857" minx="913214.6741"/>
<Attribute type="derived" value="Point (913214.6741 5606017.8743)" name="geometry"/>
</Feature>
<Feature id="2">
<Attribute value="3" name="id"/>
<Attribute value="three" name="name"/>
<Attribute value="three èé↓" name="utf8nameè"/>
<BoundingBox maxy="5606011.4565" maxx="913204.9128" miny="5606011.4565" CRS="EPSG:3857" minx="913204.9128"/>
<Attribute type="derived" value="Point (913204.9128 5606011.4565)" name="geometry"/>
</Feature>
</Layer>
</GetFeatureInfoResponse>

View File

@ -0,0 +1,22 @@
Content-Length: 943
Content-Type: text/xml; charset=utf-8
<GetFeatureInfoResponse>
<BoundingBox maxy="5606017.87425818" maxx="913214.67407005" miny="5606011.45647302" CRS="EPSG:3857" minx="913204.91280263"/>
<Layer name="testlayer èé">
<Feature id="1">
<Attribute value="2" name="id"/>
<Attribute value="two" name="name"/>
<Attribute value="two àò" name="utf8nameè"/>
<BoundingBox maxy="5606017.8743" maxx="913214.6741" miny="5606017.8743" CRS="EPSG:3857" minx="913214.6741"/>
<Attribute type="derived" value="Point (913214.6741 5606017.8743)" name="geometry"/>
</Feature>
<Feature id="2">
<Attribute value="3" name="id"/>
<Attribute value="three" name="name"/>
<Attribute value="three èé↓" name="utf8nameè"/>
<BoundingBox maxy="5606011.4565" maxx="913204.9128" miny="5606011.4565" CRS="EPSG:3857" minx="913204.9128"/>
<Attribute type="derived" value="Point (913204.9128 5606011.4565)" name="geometry"/>
</Feature>
</Layer>
</GetFeatureInfoResponse>