mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Add a unit test (would crash without the fix)
This commit is contained in:
parent
9e853bd415
commit
f0df3e1f59
@ -46,6 +46,7 @@
|
||||
#include "qgsrastertransparency.h"
|
||||
#include "qgspalettedrasterrenderer.h"
|
||||
#include "qgsrasterlayertemporalproperties.h"
|
||||
#include "qgsmaplayerrenderer.h"
|
||||
|
||||
//qgis unit test includes
|
||||
#include <qgsrenderchecker.h>
|
||||
@ -101,6 +102,7 @@ class TestQgsRasterLayer : public QgsTest
|
||||
void sample();
|
||||
void testTemporalProperties();
|
||||
void rotatedRaster();
|
||||
void forceRasterRender();
|
||||
|
||||
|
||||
private:
|
||||
@ -1055,5 +1057,18 @@ void TestQgsRasterLayer::rotatedRaster()
|
||||
QVERIFY( render( QStringLiteral( "raster_rotated_rgba" ) ) );
|
||||
}
|
||||
|
||||
void TestQgsRasterLayer::forceRasterRender()
|
||||
{
|
||||
QVERIFY2( mpLandsatRasterLayer->isValid(), "landsat.tif layer is not valid!" );
|
||||
|
||||
mMapSettings->setDestinationCrs( mpLandsatRasterLayer->crs() );
|
||||
mMapSettings->setExtent( QgsRectangle( 10, 10, 11, 11 ) ); // outside of layer extent
|
||||
mMapSettings->setLayers( QList<QgsMapLayer *>() << mpLandsatRasterLayer );
|
||||
|
||||
QgsRenderContext context( QgsRenderContext::fromMapSettings( *mMapSettings ) );
|
||||
std::unique_ptr<QgsMapLayerRenderer> layerRenderer( mpLandsatRasterLayer->createMapRenderer( context ) );
|
||||
layerRenderer->forceRasterRender(); // this should not crash
|
||||
}
|
||||
|
||||
QGSTEST_MAIN( TestQgsRasterLayer )
|
||||
#include "testqgsrasterlayer.moc"
|
||||
|
Loading…
x
Reference in New Issue
Block a user