Skip to content

Commit

Permalink
Add missing bracket to formula generated by data defined override
Browse files Browse the repository at this point in the history
Refs #21617
  • Loading branch information
AlisterH authored and nyalldawson committed Mar 21, 2019
1 parent 10a542e commit da6a378
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/qgspropertytransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ QString QgsColorRampTransformer::toExpression( const QString &baseExpression ) c
QString maxValueString = QString::number( mMaxValue );
QString nullColorString = mNullColor.name();

return QStringLiteral( "coalesce(ramp_color('%1',scale_linear(%2, %3, %4, 0, 1), '%5')" ).arg( !mRampName.isEmpty() ? mRampName : QStringLiteral( "custom ramp" ),
return QStringLiteral( "coalesce(ramp_color('%1',scale_linear(%2, %3, %4, 0, 1)), '%5')" ).arg( !mRampName.isEmpty() ? mRampName : QStringLiteral( "custom ramp" ),
baseExpression, minValueString, maxValueString, nullColorString );
}

Expand Down
4 changes: 2 additions & 2 deletions tests/src/core/testqgsproperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1252,9 +1252,9 @@ void TestQgsProperty::colorRampTransformer()
25,
new QgsGradientColorRamp( QColor( 10, 20, 30 ), QColor( 200, 190, 180 ) ),
QColor( 100, 150, 200 ) );
QCOMPARE( t5.toExpression( "5+6" ), QStringLiteral( "coalesce(ramp_color('custom ramp',scale_linear(5+6, 15, 25, 0, 1), '#6496c8')" ) );
QCOMPARE( t5.toExpression( "5+6" ), QStringLiteral( "coalesce(ramp_color('custom ramp',scale_linear(5+6, 15, 25, 0, 1)), '#6496c8')" ) );
t5.setRampName( QStringLiteral( "my ramp" ) );
QCOMPARE( t5.toExpression( "5+6" ), QStringLiteral( "coalesce(ramp_color('my ramp',scale_linear(5+6, 15, 25, 0, 1), '#6496c8')" ) );
QCOMPARE( t5.toExpression( "5+6" ), QStringLiteral( "coalesce(ramp_color('my ramp',scale_linear(5+6, 15, 25, 0, 1)), '#6496c8')" ) );
}

void TestQgsProperty::propertyToTransformer()
Expand Down

0 comments on commit da6a378

Please sign in to comment.