Skip to content
Permalink
Browse files

Filled marker test

(cherry picked from commit 24ca064)
  • Loading branch information
nyalldawson committed Nov 20, 2020
1 parent 1989dd3 commit b04add8fb89905515efd5463a4eb8a052d321ff6
@@ -56,6 +56,7 @@ class TestQgsFilledMarkerSymbol : public QObject
void filledMarkerSymbol();
void dataDefinedShape();
void bounds();
void opacityWithDataDefinedColor();

private:
bool mTestHasError = false ;
@@ -166,6 +167,24 @@ void TestQgsFilledMarkerSymbol::bounds()
QVERIFY( result );
}

void TestQgsFilledMarkerSymbol::opacityWithDataDefinedColor()
{
dynamic_cast< QgsGradientFillSymbolLayer * >( mFilledMarkerLayer->subSymbol()->symbolLayer( 0 ) )->setColor( QColor( 200, 200, 200 ) );
dynamic_cast< QgsGradientFillSymbolLayer * >( mFilledMarkerLayer->subSymbol()->symbolLayer( 0 ) )->setColor2( QColor( 0, 0, 0 ) );
dynamic_cast< QgsGradientFillSymbolLayer * >( mFilledMarkerLayer->subSymbol()->symbolLayer( 0 ) )->setDataDefinedProperty( QgsSymbolLayer::PropertyFillColor, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, 'red', 'green')" ) ) );
dynamic_cast< QgsGradientFillSymbolLayer * >( mFilledMarkerLayer->subSymbol()->symbolLayer( 0 ) )->setDataDefinedProperty( QgsSymbolLayer::PropertySecondaryColor, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, 'blue', 'magenta')" ) ) );
mMarkerSymbol->setOpacity( 0.8 );
// set opacity on both the symbol AND sub symbol to test that both are applied
mFilledMarkerLayer->subSymbol()->setOpacity( 0.6 );

bool result = imageCheck( QStringLiteral( "filledmarker_opacityddcolor" ) );
mFilledMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyFillColor, QgsProperty() );
mFilledMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeColor, QgsProperty() );
mMarkerSymbol->setOpacity( 1.0 );
mFilledMarkerLayer->subSymbol()->setOpacity( 1.0 );
QVERIFY( result );
}

//
// Private helper functions not called directly by CTest
//
Binary file not shown.

0 comments on commit b04add8

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