Skip to content

Commit e0bb7d4

Browse files
committedNov 17, 2020
Font marker test
1 parent 7fbe92e commit e0bb7d4

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
 

‎tests/src/core/testqgsfontmarker.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class TestQgsFontMarkerSymbol : public QObject
5959
void fontMarkerSymbolStroke();
6060
void bounds();
6161
void fontMarkerSymbolDataDefinedProperties();
62+
void opacityWithDataDefinedColor();
6263

6364
private:
6465
bool mTestHasError = false ;
@@ -209,6 +210,25 @@ void TestQgsFontMarkerSymbol::bounds()
209210
QVERIFY( result );
210211
}
211212

213+
void TestQgsFontMarkerSymbol::opacityWithDataDefinedColor()
214+
{
215+
mFontMarkerLayer->setColor( QColor( 200, 200, 200 ) );
216+
mFontMarkerLayer->setStrokeColor( QColor( 0, 0, 0 ) );
217+
QFont font = QgsFontUtils::getStandardTestFont( QStringLiteral( "Bold" ) );
218+
mFontMarkerLayer->setFontFamily( font.family() );
219+
mFontMarkerLayer->setCharacter( QChar( 'X' ) );
220+
mFontMarkerLayer->setSize( 12 );
221+
mFontMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyFillColor, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, 'red', 'green')" ) ) );
222+
mFontMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeColor, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, 'blue', 'magenta')" ) ) );
223+
mFontMarkerLayer->setStrokeWidth( 0.5 );
224+
mMarkerSymbol->setOpacity( 0.5 );
225+
226+
bool result = imageCheck( QStringLiteral( "fontmarker_opacityddcolor" ) );
227+
mFontMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyFillColor, QgsProperty() );
228+
mFontMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeColor, QgsProperty() );
229+
mMarkerSymbol->setOpacity( 1.0 );
230+
QVERIFY( result );
231+
}
212232

213233
//
214234
// Private helper functions not called directly by CTest

0 commit comments

Comments
 (0)
Please sign in to comment.