Skip to content

Commit

Permalink
Add unit test for HTML format
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Sep 28, 2020
1 parent cd2032f commit 636942a
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 6 deletions.
57 changes: 51 additions & 6 deletions tests/src/python/test_qgsserver_wms_getfeatureinfo.py
Expand Up @@ -803,7 +803,7 @@ def testGetFeatureInfoCascadingLayers(self):
project_name)

def testGetFeatureInfoRasterNoData(self):
# out
# out text
self.wms_request_compare('GetFeatureInfo',
'&BBOX=-39.43236293126383885,135.95002698514588246,-30.54405018572365194,156.29582900705395332' +
'&CRS=EPSG:4326' +
Expand All @@ -813,11 +813,11 @@ def testGetFeatureInfoRasterNoData(self):
'&QUERY_LAYERS=requires_warped_vrt' +
'&I=1&J=1' +
'&FEATURE_COUNT=10',
'wms_getfeatureinfo_raster_nodata_out',
'wms_getfeatureinfo_raster_nodata_out_txt',
'test_raster_nodata.qgz',
normalizeJson=True)

# 0
# 0 text
self.wms_request_compare('GetFeatureInfo',
'&BBOX=-39.43236293126383885,135.95002698514588246,-30.54405018572365194,156.29582900705395332' +
'&CRS=EPSG:4326' +
Expand All @@ -827,11 +827,11 @@ def testGetFeatureInfoRasterNoData(self):
'&QUERY_LAYERS=requires_warped_vrt' +
'&I=576&J=163' +
'&FEATURE_COUNT=10',
'wms_getfeatureinfo_raster_nodata_zero',
'wms_getfeatureinfo_raster_nodata_zero_txt',
'test_raster_nodata.qgz',
normalizeJson=True)

# nodata
# nodata text
self.wms_request_compare('GetFeatureInfo',
'&BBOX=-39.43236293126383885,135.95002698514588246,-30.54405018572365194,156.29582900705395332' +
'&CRS=EPSG:4326' +
Expand All @@ -841,7 +841,52 @@ def testGetFeatureInfoRasterNoData(self):
'&QUERY_LAYERS=requires_warped_vrt' +
'&I=560&J=78' +
'&FEATURE_COUNT=10',
'wms_getfeatureinfo_raster_nodata',
'wms_getfeatureinfo_raster_nodata_txt',
'test_raster_nodata.qgz',
normalizeJson=True)

# out html
self.wms_request_compare('GetFeatureInfo',
'&BBOX=-39.43236293126383885,135.95002698514588246,-30.54405018572365194,156.29582900705395332' +
'&CRS=EPSG:4326' +
'&VERSION=1.3.0' +
'&INFO_FORMAT=text/html' +
'&WIDTH=800&HEIGHT=400' +
'&LAYERS=requires_warped_vrt' +
'&QUERY_LAYERS=requires_warped_vrt' +
'&I=1&J=1' +
'&FEATURE_COUNT=10',
'wms_getfeatureinfo_raster_nodata_out_html',
'test_raster_nodata.qgz',
normalizeJson=True)

# 0 html
self.wms_request_compare('GetFeatureInfo',
'&BBOX=-39.43236293126383885,135.95002698514588246,-30.54405018572365194,156.29582900705395332' +
'&CRS=EPSG:4326' +
'&VERSION=1.3.0' +
'&INFO_FORMAT=text/html' +
'&WIDTH=800&HEIGHT=400' +
'&LAYERS=requires_warped_vrt' +
'&QUERY_LAYERS=requires_warped_vrt' +
'&I=576&J=163' +
'&FEATURE_COUNT=10',
'wms_getfeatureinfo_raster_nodata_zero_html',
'test_raster_nodata.qgz',
normalizeJson=True)

# nodata html
self.wms_request_compare('GetFeatureInfo',
'&BBOX=-39.43236293126383885,135.95002698514588246,-30.54405018572365194,156.29582900705395332' +
'&CRS=EPSG:4326' +
'&VERSION=1.3.0' +
'&INFO_FORMAT=text/html' +
'&WIDTH=800&HEIGHT=400' +
'&LAYERS=requires_warped_vrt' +
'&QUERY_LAYERS=requires_warped_vrt' +
'&I=560&J=78' +
'&FEATURE_COUNT=10',
'wms_getfeatureinfo_raster_nodata_html',
'test_raster_nodata.qgz',
normalizeJson=True)

Expand Down
@@ -0,0 +1,14 @@
*****
Content-Type: text/html; charset=utf-8

<HEAD>
<TITLE> GetFeatureInfo results </TITLE>
<META http-equiv="Content-Type" content="text/html;charset=utf-8"/>
</HEAD>
<BODY>
<TABLE border=1 width=100%>
<TR><TH width=25%>Layer</TH><TD>requires_warped_vrt</TD></TR>
</BR><TR><TH>Band 1</TH><TD>no data</TD></TR>
</TABLE>
<BR></BR>
</BODY>
@@ -0,0 +1,13 @@
*****
Content-Type: text/html; charset=utf-8

<HEAD>
<TITLE> GetFeatureInfo results </TITLE>
<META http-equiv="Content-Type" content="text/html;charset=utf-8"/>
</HEAD>
<BODY>
<TABLE border=1 width=100%>
<TR><TH width=25%>Layer</TH><TD>requires_warped_vrt</TD></TR>
</BR></TABLE>
<BR></BR>
</BODY>
@@ -0,0 +1,14 @@
*****
Content-Type: text/html; charset=utf-8

<HEAD>
<TITLE> GetFeatureInfo results </TITLE>
<META http-equiv="Content-Type" content="text/html;charset=utf-8"/>
</HEAD>
<BODY>
<TABLE border=1 width=100%>
<TR><TH width=25%>Layer</TH><TD>requires_warped_vrt</TD></TR>
</BR><TR><TH>Band 1</TH><TD>0</TD></TR>
</TABLE>
<BR></BR>
</BODY>

0 comments on commit 636942a

Please sign in to comment.