Skip to content
Permalink
Browse files

Gradient fill test

(cherry picked from commit 41afb24)
  • Loading branch information
nyalldawson committed Nov 20, 2020
1 parent 4d956a5 commit 0dd2d902f72d887b5a92bd9ea08a9bf50b518b2f
@@ -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 0dd2d90

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