Skip to content

Commit

Permalink
Ellipse marker test
Browse files Browse the repository at this point in the history
(cherry picked from commit f3e3a6b)
  • Loading branch information
nyalldawson committed Nov 20, 2020
1 parent 6a631e2 commit 5a2d4cb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/src/core/testqgsellipsemarker.cpp
Expand Up @@ -60,6 +60,7 @@ class TestQgsEllipseMarkerSymbol : public QObject
void ellipseMarkerSymbolRoundJoin(); void ellipseMarkerSymbolRoundJoin();
void selected(); void selected();
void bounds(); void bounds();
void opacityWithDataDefinedColor();


private: private:
bool mTestHasError = false ; bool mTestHasError = false ;
Expand Down Expand Up @@ -228,6 +229,26 @@ void TestQgsEllipseMarkerSymbol::bounds()
QVERIFY( result ); QVERIFY( result );
} }


void TestQgsEllipseMarkerSymbol::opacityWithDataDefinedColor()
{
mEllipseMarkerLayer->setColor( QColor( 200, 200, 200 ) );
mEllipseMarkerLayer->setStrokeColor( QColor( 0, 0, 0 ) );
mEllipseMarkerLayer->setSymbolName( QStringLiteral( "circle" ) );
mEllipseMarkerLayer->setSymbolName( QStringLiteral( "circle" ) );
mEllipseMarkerLayer->setSymbolHeight( 3 );
mEllipseMarkerLayer->setSymbolWidth( 6 );
mEllipseMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyFillColor, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, 'red', 'green')" ) ) );
mEllipseMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeColor, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, 'blue', 'magenta')" ) ) );
mEllipseMarkerLayer->setStrokeWidth( 0.5 );
mMarkerSymbol->setOpacity( 0.5 );

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



// //
// Private helper functions not called directly by CTest // 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 5a2d4cb

Please sign in to comment.