Skip to content

Commit

Permalink
Centroid fill test
Browse files Browse the repository at this point in the history
(cherry picked from commit 6ef01f5)
  • Loading branch information
nyalldawson committed Nov 20, 2020
1 parent d4bf8ce commit 4d956a5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/src/core/testqgscentroidfillsymbol.cpp
Expand Up @@ -59,6 +59,7 @@ class TestQgsCentroidFillSymbol : public QObject
void centroidFillClipOnCurrentPartOnly();
void centroidFillClipOnCurrentPartOnlyBiggest();
void centroidFillClipMultiplayerPoints();
void opacityWithDataDefinedColor();

private:
bool mTestHasError = false ;
Expand Down Expand Up @@ -199,6 +200,22 @@ void TestQgsCentroidFillSymbol::centroidFillClipMultiplayerPoints()
mFillSymbol->changeSymbolLayer( 0, mCentroidFill );
}


void TestQgsCentroidFillSymbol::opacityWithDataDefinedColor()
{
QgsSimpleFillSymbolLayer simpleFill( QColor( 255, 255, 255, 100 ) );

mCentroidFill->subSymbol()->symbolLayer( 0 )->setDataDefinedProperty( QgsSymbolLayer::PropertyFillColor, QgsProperty::fromExpression( QStringLiteral( "if(Name='Dam', 'red', 'green')" ) ) );
mCentroidFill->subSymbol()->symbolLayer( 0 )->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeColor, QgsProperty::fromExpression( QStringLiteral( "if(Name='Dam', 'blue', 'magenta')" ) ) );
dynamic_cast< QgsSimpleMarkerSymbolLayer * >( mCentroidFill->subSymbol()->symbolLayer( 0 ) )->setStrokeWidth( 0.5 );
dynamic_cast< QgsSimpleMarkerSymbolLayer * >( mCentroidFill->subSymbol()->symbolLayer( 0 ) )->setSize( 5 );
mCentroidFill->subSymbol()->setOpacity( 0.5 );
mFillSymbol->setOpacity( 0.5 );

QVERIFY( imageCheck( "symbol_centroidfill_opacityddcolor" ) );
}


//
// Private helper functions not called directly by CTest
//
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4d956a5

Please sign in to comment.