Skip to content
Permalink
Browse files

Gradient fill test

  • Loading branch information
nyalldawson committed Nov 17, 2020
1 parent a0e5e15 commit 62b630c523e28536584c277e188fc0df95c15895
@@ -62,7 +62,9 @@ class TestQgsGradients : public QObject
void gradientSymbolReflectSpread();
void gradientSymbolRepeatSpread();
void gradientSymbolRotate();
void opacityWithDataDefinedColor();
void gradientSymbolFromQml();

private:
bool mTestHasError = false ;
bool setQml( const QString &type );
@@ -244,6 +246,16 @@ void TestQgsGradients::gradientSymbolRotate()
mGradientFill->setAngle( 0 );
}

void TestQgsGradients::opacityWithDataDefinedColor()
{
mGradientFill->setDataDefinedProperty( QgsSymbolLayer::PropertyFillColor, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, 'red', 'green')" ) ) );
mGradientFill->setDataDefinedProperty( QgsSymbolLayer::PropertySecondaryColor, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, 'blue', 'magenta')" ) ) );
mFillSymbol->setOpacity( 0.5 );

bool result = imageCheck( QStringLiteral( "gradient_opacityddcolor" ) );
QVERIFY( result );
}

void TestQgsGradients::gradientSymbolFromQml()
{
mReport += QLatin1String( "<h2>Gradient symbol from QML test</h2>\n" );
@@ -254,8 +266,6 @@ void TestQgsGradients::gradientSymbolFromQml()
QVERIFY( imageCheck( "gradient_from_qml" ) );
}



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

0 comments on commit 62b630c

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