Skip to content
Permalink
Browse files

Make raster blend modes tests more robust

  • Loading branch information
nyalldawson committed Jun 18, 2015
1 parent 40acaa0 commit 6deb520ff113f5c00fd97118ef17d230b2602099
@@ -51,8 +51,8 @@ class TestQgsBlendModes : public QObject
private slots:
void initTestCase();// will be called before the first testfunction is executed.
void cleanupTestCase();// will be called after the last testfunction was executed.
void init() {};// will be called before each testfunction is executed.
void cleanup() {};// will be called after every testfunction.
void init() {} // will be called before each testfunction is executed.
void cleanup() {} // will be called after every testfunction.

void vectorBlending();
void featureBlending();
@@ -115,12 +115,12 @@ void TestQgsBlendModes::initTestCase()
QList<QgsMapLayer *>() << mpLinesLayer );

//create two raster layers
QFileInfo rasterFileInfo( mTestDataDir + "landsat.tif" );
QFileInfo rasterFileInfo( mTestDataDir + "rgb256x256.png" );
mRasterLayer1 = new QgsRasterLayer( rasterFileInfo.filePath(),
rasterFileInfo.completeBaseName() );
mRasterLayer2 = new QgsRasterLayer( rasterFileInfo.filePath(),
rasterFileInfo.completeBaseName() );
QgsMultiBandColorRenderer* rasterRenderer = new QgsMultiBandColorRenderer( mRasterLayer1->dataProvider(), 2, 3, 4 );
QgsMultiBandColorRenderer* rasterRenderer = new QgsMultiBandColorRenderer( mRasterLayer1->dataProvider(), 1, 2, 3 );
mRasterLayer1->setRenderer( rasterRenderer );
mRasterLayer2->setRenderer(( QgsRasterRenderer* ) rasterRenderer->clone() );
QgsMapLayerRegistry::instance()->addMapLayers(
@@ -214,7 +214,7 @@ void TestQgsBlendModes::rasterBlending()
mMapSettings.setExtent( mRasterLayer1->extent() );

// set blending mode for top layer
mRasterLayer1->setBlendMode( QPainter::CompositionMode_Plus );
mRasterLayer1->setBlendMode( QPainter::CompositionMode_Difference );
QVERIFY( imageCheck( "raster_blendmodes" ) );
}

@@ -76,13 +76,13 @@ def __init__(self, methodName):
self.mMapRegistry.addMapLayer(self.mLineLayer)

# create two raster layers
myRasterFile = os.path.join(TEST_DATA_DIR, 'landsat.tif')
myRasterFile = os.path.join(TEST_DATA_DIR, 'rgb256x256.png')
self.mRasterLayer1 = QgsRasterLayer(myRasterFile, "raster1")
self.mRasterLayer2 = QgsRasterLayer(myRasterFile, "raster2")
myMultiBandRenderer1 = QgsMultiBandColorRenderer(self.mRasterLayer1.dataProvider(), 2, 3, 4)
myMultiBandRenderer1 = QgsMultiBandColorRenderer(self.mRasterLayer1.dataProvider(), 1, 2, 3)
self.mRasterLayer1.setRenderer(myMultiBandRenderer1)
self.mMapRegistry.addMapLayer(self.mRasterLayer1)
myMultiBandRenderer2 = QgsMultiBandColorRenderer(self.mRasterLayer2.dataProvider(), 2, 3, 4)
myMultiBandRenderer2 = QgsMultiBandColorRenderer(self.mRasterLayer2.dataProvider(), 1, 2, 3)
self.mRasterLayer2.setRenderer(myMultiBandRenderer2)
self.mMapRegistry.addMapLayer(self.mRasterLayer2)

@@ -178,7 +178,7 @@ def testRasterBlending(self):
self.mapSettings.setExtent(self.mRasterLayer1.extent())

#Set blending mode for top layer
self.mRasterLayer1.setBlendMode(QPainter.CompositionMode_Plus)
self.mRasterLayer1.setBlendMode(QPainter.CompositionMode_Difference)
checker = QgsMultiRenderChecker()
checker.setControlName("expected_raster_blendmodes")
checker.setMapSettings(self.mapSettings)
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 6deb520

Please sign in to comment.
You can’t perform that action at this time.