Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Sep 28, 2020
1 parent 86175e3 commit cd2032f
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/src/python/test_qgsserver_wms_getfeatureinfo.py
Expand Up @@ -802,6 +802,49 @@ def testGetFeatureInfoCascadingLayers(self):
'wms_getfeatureinfo_cascading_issue31177',
project_name)

def testGetFeatureInfoRasterNoData(self):
# out
self.wms_request_compare('GetFeatureInfo',
'&BBOX=-39.43236293126383885,135.95002698514588246,-30.54405018572365194,156.29582900705395332' +
'&CRS=EPSG:4326' +
'&VERSION=1.3.0' +
'&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',
'test_raster_nodata.qgz',
normalizeJson=True)

# 0
self.wms_request_compare('GetFeatureInfo',
'&BBOX=-39.43236293126383885,135.95002698514588246,-30.54405018572365194,156.29582900705395332' +
'&CRS=EPSG:4326' +
'&VERSION=1.3.0' +
'&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',
'test_raster_nodata.qgz',
normalizeJson=True)

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


if __name__ == '__main__':
unittest.main()
Binary file added tests/testdata/qgis_server/test_raster_nodata.qgz
Binary file not shown.
@@ -0,0 +1,8 @@
*****
Content-Type: text/plain; charset=utf-8

GetFeatureInfo results

Layer 'requires_warped_vrt'
Band 1 = 'no data'

@@ -0,0 +1,7 @@
*****
Content-Type: text/plain; charset=utf-8

GetFeatureInfo results

Layer 'requires_warped_vrt'

@@ -0,0 +1,8 @@
*****
Content-Type: text/plain; charset=utf-8

GetFeatureInfo results

Layer 'requires_warped_vrt'
Band 1 = '0'

0 comments on commit cd2032f

Please sign in to comment.