Created test to replicate issue #7023

This commit is contained in:
Tim Sutton 2013-01-22 11:07:50 +02:00
parent 7010fbdd02
commit 2fbe172dd1
4 changed files with 61 additions and 0 deletions

View File

@ -151,6 +151,18 @@ class TestQgsRasterLayer(TestCase):
myResultFlag = myChecker.runTest("raster_transparency_python");
assert myResultFlag, "Raster transparency rendering test failed"
def testIssue7023(self):
"""Check if converting a raster from 1.8 to 2 works."""
myPath = os.path.join(unitTestDataPath('raster'),
'raster-pallette-crash2.tif')
myFileInfo = QFileInfo(myPath)
myBaseName = myFileInfo.baseName()
myRasterLayer = QgsRasterLayer(myPath, myBaseName)
myMessage = 'Raster not loaded: %s' % myPath
assert myRasterLayer.isValid(), myMessage
# crash on next line
QgsMapLayerRegistry.addMapLayers([myRasterLayer])
def testShaderCrash(self):
"""Check if we assign a shader and then reassign it no crash occurs."""
myPath = os.path.join(unitTestDataPath('raster'),

View File

@ -0,0 +1,44 @@
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis version="1.8.0-Lisboa" minimumScale="0" maximumScale="1e+08" hasScaleBasedVisibilityFlag="0">
<transparencyLevelInt>255</transparencyLevelInt>
<rasterproperties>
<mDrawingStyle>PalettedColor</mDrawingStyle>
<mColorShadingAlgorithm>ColorRampShader</mColorShadingAlgorithm>
<mInvertColor boolean="false"/>
<mRedBandName>Not Set</mRedBandName>
<mGreenBandName>Not Set</mGreenBandName>
<mBlueBandName>Not Set</mBlueBandName>
<mGrayBandName>Band 1</mGrayBandName>
<mStandardDeviations>0</mStandardDeviations>
<mUserDefinedRGBMinimumMaximum boolean="false"/>
<mRGBMinimumMaximumEstimated boolean="true"/>
<mUserDefinedGrayMinimumMaximum boolean="false"/>
<mGrayMinimumMaximumEstimated boolean="true"/>
<mContrastEnhancementAlgorithm>NoEnhancement</mContrastEnhancementAlgorithm>
<contrastEnhancementMinMaxValues>
<minMaxEntry>
<min>-1.79769e+308</min>
<max>1.79769e+308</max>
</minMaxEntry>
</contrastEnhancementMinMaxValues>
<mNoDataValue mValidNoDataValue="true">nan</mNoDataValue>
<singleValuePixelList>
<pixelListEntry pixelValue="0.419576" percentTransparent="100"/>
<pixelListEntry pixelValue="94.209307" percentTransparent="30"/>
<pixelListEntry pixelValue="187.999039" percentTransparent="30"/>
<pixelListEntry pixelValue="281.788770" percentTransparent="30"/>
<pixelListEntry pixelValue="375.578502" percentTransparent="30"/>
</singleValuePixelList>
<threeValuePixelList>
<pixelListEntry red="nan" blue="nan" green="nan" percentTransparent="100"/>
</threeValuePixelList>
<customColorRamp>
<colorRampType>DISCRETE</colorRampType>
<colorRampEntry red="238" blue="238" value="0.419576" green="255" label="0.42 people/cell"/>
<colorRampEntry red="255" blue="127" value="94.209307" green="255" label=""/>
<colorRampEntry red="225" blue="0" value="187.999039" green="85" label="188.00 people/cell"/>
<colorRampEntry red="228" blue="27" value="281.788770" green="0" label=""/>
<colorRampEntry red="115" blue="0" value="375.578502" green="0" label="375.58 people/cell"/>
</customColorRamp>
</rasterproperties>
</qgis>

Binary file not shown.

View File

@ -0,0 +1,5 @@
<PAMDataset>
<PAMRasterBand band="1">
<NoDataValue le_hex_equiv="000000000000F87F">nan</NoDataValue>
</PAMRasterBand>
</PAMDataset>