mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Created test to replicate issue #7023
This commit is contained in:
parent
7010fbdd02
commit
2fbe172dd1
@ -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'),
|
||||
|
44
tests/testdata/raster/raster-pallette-crash2.qml
vendored
Normal file
44
tests/testdata/raster/raster-pallette-crash2.qml
vendored
Normal 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>
|
BIN
tests/testdata/raster/raster-pallette-crash2.tif
vendored
Normal file
BIN
tests/testdata/raster/raster-pallette-crash2.tif
vendored
Normal file
Binary file not shown.
5
tests/testdata/raster/raster-pallette-crash2.tif.aux.xml
vendored
Normal file
5
tests/testdata/raster/raster-pallette-crash2.tif.aux.xml
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
<PAMDataset>
|
||||
<PAMRasterBand band="1">
|
||||
<NoDataValue le_hex_equiv="000000000000F87F">nan</NoDataValue>
|
||||
</PAMRasterBand>
|
||||
</PAMDataset>
|
Loading…
x
Reference in New Issue
Block a user