Skip to content
Permalink
Browse files

Simple marker test

(cherry picked from commit af0160e)
  • Loading branch information
nyalldawson committed Nov 20, 2020
1 parent 2a30136 commit 6a631e225074fcfec7a093f8b8d9843293b400a5
@@ -81,6 +81,7 @@ class TestQgsSimpleMarkerSymbol : public QObject
void boundsWithRotation();
void boundsWithRotationAndOffset();
void colors();
void opacityWithDataDefinedColor();

private:
bool mTestHasError = false ;
@@ -333,6 +334,24 @@ void TestQgsSimpleMarkerSymbol::colors()
QCOMPARE( marker.strokeColor(), QColor( 250, 250, 250 ) );
}

void TestQgsSimpleMarkerSymbol::opacityWithDataDefinedColor()
{
mSimpleMarkerLayer->setColor( QColor( 200, 200, 200 ) );
mSimpleMarkerLayer->setStrokeColor( QColor( 0, 0, 0 ) );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Square );
mSimpleMarkerLayer->setSize( 5 );
mSimpleMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyFillColor, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, 'red', 'green')" ) ) );
mSimpleMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeColor, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, 'blue', 'magenta')" ) ) );
mSimpleMarkerLayer->setStrokeWidth( 0.5 );
mMarkerSymbol->setOpacity( 0.5 );

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

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

0 comments on commit 6a631e2

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