Skip to content

Commit

Permalink
Simple marker test
Browse files Browse the repository at this point in the history
(cherry picked from commit af0160e)
  • Loading branch information
nyalldawson committed Nov 20, 2020
1 parent 2a30136 commit 6a631e2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/src/core/testqgssimplemarker.cpp
Expand Up @@ -81,6 +81,7 @@ class TestQgsSimpleMarkerSymbol : public QObject
void boundsWithRotation();
void boundsWithRotationAndOffset();
void colors();
void opacityWithDataDefinedColor();

private:
bool mTestHasError = false ;
Expand Down Expand Up @@ -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
//
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 6a631e2

Please sign in to comment.