Skip to content
Permalink
Browse files

Filled marker test

  • Loading branch information
nyalldawson committed Nov 17, 2020
1 parent e0bb7d4 commit c784831ed34fe7b02d33f03c910c4a8b1b66dc8c
@@ -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 c784831

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