Skip to content

Commit ef0f2de

Browse files
committedDec 4, 2019
followup: fix type mistake and tests
1 parent b67dd46 commit ef0f2de

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed
 

‎src/core/expression/qgsexpressionfunction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ static QVariant fcnLog( const QVariantList &values, const QgsExpressionContext *
369369
}
370370
static QVariant fcnRndF( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
371371
{
372-
double min = QgsExpressionUtils::getIntValue( values.at( 0 ), parent );
373-
double max = QgsExpressionUtils::getIntValue( values.at( 1 ), parent );
372+
double min = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent );
373+
double max = QgsExpressionUtils::getDoubleValue( values.at( 1 ), parent );
374374
if ( max < min )
375375
return QVariant();
376376

‎tests/src/core/testqgsexpression.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2209,16 +2209,16 @@ class TestQgsExpression: public QObject
22092209
// Supports multiple type of seeds
22102210
QgsExpression exp4( QStringLiteral( "randf(1,100,123)" ) );
22112211
QVariant v4 = exp4.evaluate();
2212-
QCOMPARE( v4.type(), QVariant::Double );
2212+
QCOMPARE( v4.type(), QVariant::LongLong );
22132213
QgsExpression exp5( QStringLiteral( "randf(1,100,1.23)" ) );
22142214
QVariant v5 = exp5.evaluate();
2215-
QCOMPARE( v5.type(), QVariant::Double );
2215+
QCOMPARE( v5.type(), QVariant::LongLong );
22162216
QgsExpression exp6( QStringLiteral( "randf(1,100,'123')" ) );
22172217
QVariant v6 = exp6.evaluate();
2218-
QCOMPARE( v6.type(), QVariant::Double );
2218+
QCOMPARE( v6.type(), QVariant::LongLong );
22192219
QgsExpression exp7( QStringLiteral( "randf(1,100,'abc')" ) );
22202220
QVariant v7 = exp7.evaluate();
2221-
QCOMPARE( v7.type(), QVariant::Double );
2221+
QCOMPARE( v7.type(), QVariant::LongLong );
22222222

22232223
// Two calls with the same seed return the same numer
22242224
QgsExpression exp8( QStringLiteral( "randf(seed:=1)" ) );

0 commit comments

Comments
 (0)
Please sign in to comment.