Skip to content
Permalink
Browse files

add test for SVG marker with dynamic parameters (#40891)

  • Loading branch information
3nids committed Jan 7, 2021
1 parent 1754ecc commit 2ffc3061fb055653dbf43caa7ef14e249dc43204
@@ -66,6 +66,7 @@ class TestQgsSvgMarkerSymbol : public QObject
void resetDefaultAspectRatio();
void opacityWithDataDefinedColor();
void dataDefinedOpacity();
void dynamicParameters();

private:
bool mTestHasError = false ;
@@ -342,6 +343,22 @@ void TestQgsSvgMarkerSymbol::dataDefinedOpacity()
QVERIFY( result );
}

void TestQgsSvgMarkerSymbol::dynamicParameters()
{
const QString svgPath = TEST_DATA_DIR + QStringLiteral( "/svg/test_dynamic_svg.svg" );

QMap<QString, QgsProperty> parameters {{QStringLiteral( "text1" ), QgsProperty::fromExpression( QStringLiteral( "1+1" ) )},
{QStringLiteral( "text2" ), QgsProperty::fromExpression( QStringLiteral( "\"Class\"" ) )},
{QStringLiteral( "align" ), QgsProperty::fromExpression( QStringLiteral( "'middle'" ) ) }};

mSvgMarkerLayer->setPath( svgPath );
mSvgMarkerLayer->setSize( 20 );
mSvgMarkerLayer->setParameters( parameters );
bool result = imageCheck( QStringLiteral( "svgmarker_dynamic_parameters" ) );
mSvgMarkerLayer->setParameters( QMap<QString, QgsProperty>() );
QVERIFY( result );
}

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

0 comments on commit 2ffc306

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