Helper module for gui test suite
Context manager for redirection of stdout and stderr
This is from http://stackoverflow.com/questions/6796492/ python-temporarily-redirect-stdout-stderr
In this context, the class is used to get rid of QGIS output in the test suite - BUT IT DOESN’T WORK (Maybe because QGIS starts its providers in a different process?)
Usage:
devnull = open(os.devnull, ‘w’) print(‘Fubar’)
print(“I’m back!”)
Assert that a files has matches its expected hash
Assert that a files has matches one of a list of expected hashes
Compare a test image against a known good image.
theControlImagePath: The image representing expected output
as the control image).
two images.
Compare a test image against a collection of known good images.
as the test image path (CONTROL_IMAGE_DIR) will be prepended.
as the control image). Must be full path to image.
two images.
Start one QGis application to test agaist
If QGis is already running the handle to that app will be returned
Helper to load and return a single QGIS layer
theLayerFile: Pathname to raster or vector file DIR: Optional parameter stating the parent dir. If None,
pathname is assumed to be absolute
Returns: QgsMapLayer, str (for layer type)
Zoom to an area occupied by both Batemans Bay layers in geo crs
Helper to set the crs for the CANVAS before a test is run.
Args:
theEpsgId - Valid EPSG identifier (int)
- theOtfpFlag - whether on the fly projections should be enabled
on the CANVAS. Default to False.
Zoom to an area specified given bounding box (list)
Zoom to an area occupied by both Jakarta layers in Geo
Zoom to an area occupied by both Jakarta layers in 900913 crs
Zoom to an area occupied by both both Padang layers
Zoom to an area occupied by both Jakarta layers in Geo
Return the absolute path to the InaSAFE unit test data dir.
Note
This is not the same thing as the SVN inasafe_data dir. Rather this is a new dataset where the test datasets are all tiny for fast testing and the datasets live in the same repo as the code.
This module forms part of the InaSAFE tool.