コード例 #1
0
ファイル: test_map_legend.py プロジェクト: gsuhartono/inasafe
    def test_getRasterLegend(self):
        """Getting a legend for a raster layer works."""
        myLayer, _ = load_layer('test_floodimpact.tif')
        myMapLegend = MapLegend(myLayer)
        myImage = myMapLegend.getRasterLegend()
        myPath = unique_filename(
            prefix='getRasterLegend',
            suffix='.png',
            dir=temp_dir('test'))
        myImage.save(myPath, 'PNG')
        LOGGER.debug(myPath)
        # As we have discovered, different versions of Qt and
        # OS platforms cause different output, so myControlImages is a list
        # of 'known good' renders.

        myTolerance = 0  # to allow for version number changes in disclaimer
        myFlag, myMessage = check_images(
            'getRasterLegend', myPath, myTolerance)
        myMessage += (
            '\nWe want these images to match, if they do already copy the test'
            ' image generated to create a new control image.')
        assert myFlag, myMessage