Skip to content
Permalink
Browse files

Fix blending tests

  • Loading branch information
nyalldawson committed May 26, 2013
1 parent 61285a9 commit 8cf9f7bd1e23d3ca447d37bd4f79cf63633288e3
@@ -121,15 +121,19 @@ void TestQgsBlendModes::vectorBlending()
{
//Add two vector layers
QStringList myLayers;
myLayers << mpPointsLayer->id();
myLayers << mpLinesLayer->id();
myLayers << mpPolysLayer->id();
mpMapRenderer->setLayerSet( myLayers );

//Set blending modes for both layers
mpPointsLayer->setBlendMode( QPainter::CompositionMode_Overlay );
mpPolysLayer->setBlendMode( QPainter::CompositionMode_Multiply );
mpLinesLayer->setBlendMode( QPainter::CompositionMode_Difference );
mpPolysLayer->setBlendMode( QPainter::CompositionMode_Difference );
mpMapRenderer->setExtent( mpPointsLayer->extent() );
QVERIFY( imageCheck( "vector_blendmodes" ) );

//Reset layers
mpLinesLayer->setBlendMode( QPainter::CompositionMode_SourceOver );
mpPolysLayer->setBlendMode( QPainter::CompositionMode_SourceOver );
}

void TestQgsBlendModes::featureBlending()
@@ -144,6 +148,9 @@ void TestQgsBlendModes::featureBlending()
mpLinesLayer->setFeatureBlendMode( QPainter::CompositionMode_Plus );
mpMapRenderer->setExtent( mpPointsLayer->extent() );
QVERIFY( imageCheck( "vector_featureblendmodes" ) );

//Reset layers
mpLinesLayer->setFeatureBlendMode( QPainter::CompositionMode_SourceOver );
}

void TestQgsBlendModes::vectorLayerTransparency()
@@ -153,12 +160,14 @@ void TestQgsBlendModes::vectorLayerTransparency()
myLayers << mpLinesLayer->id();
myLayers << mpPolysLayer->id();
mpMapRenderer->setLayerSet( myLayers );
mpLinesLayer->setFeatureBlendMode( QPainter::CompositionMode_SourceOver );

//Set feature blending modes for point layer
mpLinesLayer->setLayerTransparency( 50 );
mpMapRenderer->setExtent( mpPointsLayer->extent() );
QVERIFY( imageCheck( "vector_layertransparency" ) );

//Reset layers
mpLinesLayer->setLayerTransparency( 0 );
}

void TestQgsBlendModes::rasterBlending()
@@ -96,14 +96,14 @@ def testVectorBlending(self):

#Add vector layers to map
myLayers = QStringList()
myLayers.append(self.mPointLayer.id())
myLayers.append(self.mLineLayer.id())
myLayers.append(self.mPolygonLayer.id())
self.mMapRenderer.setLayerSet(myLayers)
self.mMapRenderer.setExtent(self.mPointLayer.extent())

#Set blending modes for both layers
self.mPointLayer.setBlendMode(QPainter.CompositionMode_Overlay)
self.mPolygonLayer.setBlendMode(QPainter.CompositionMode_Multiply)
self.mLineLayer.setBlendMode(QPainter.CompositionMode_Difference)
self.mPolygonLayer.setBlendMode(QPainter.CompositionMode_Difference)

checker = QgsRenderChecker()
checker.setControlName("expected_vector_blendmodes")
@@ -113,6 +113,10 @@ def testVectorBlending(self):
myMessage = ('vector blending failed')
assert myResult, myMessage

#Reset layers
self.mLineLayer.setBlendMode(QPainter.CompositionMode_SourceOver)
self.mPolygonLayer.setBlendMode(QPainter.CompositionMode_SourceOver)

def testVectorFeatureBlending(self):
"""Test that feature blend modes work for vector layers."""

@@ -122,7 +126,6 @@ def testVectorFeatureBlending(self):
myLayers.append(self.mPolygonLayer.id())
self.mMapRenderer.setLayerSet(myLayers)
self.mMapRenderer.setExtent(self.mPointLayer.extent())
self.mPolygonLayer.setBlendMode(QPainter.CompositionMode_Multiply)

#Set feature blending for line layer
self.mLineLayer.setFeatureBlendMode(QPainter.CompositionMode_Plus)
@@ -135,6 +138,9 @@ def testVectorFeatureBlending(self):
myMessage = ('vector feature blending failed')
assert myResult, myMessage

#Reset layers
self.mLineLayer.setFeatureBlendMode(QPainter.CompositionMode_SourceOver)

def testVectorLayerTransparency(self):
"""Test that layer transparency works for vector layers."""

@@ -144,7 +150,6 @@ def testVectorLayerTransparency(self):
myLayers.append(self.mPolygonLayer.id())
self.mMapRenderer.setLayerSet(myLayers)
self.mMapRenderer.setExtent(self.mPointLayer.extent())
self.mPolygonLayer.setBlendMode(QPainter.CompositionMode_Multiply)

#Set feature blending for line layer
self.mLineLayer.setLayerTransparency( 50 )
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 8cf9f7b

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