@@ -359,7 +359,7 @@ class TestQgsExpression: public QObject
359
359
}
360
360
361
361
QgsExpressionContext context;
362
- Q_ASSERT ( exp.prepare ( &context ) );
362
+ QVERIFY ( exp.prepare ( &context ) );
363
363
364
364
QVariant res = exp.evaluate ();
365
365
if ( exp.hasEvalError () )
@@ -388,10 +388,10 @@ class TestQgsExpression: public QObject
388
388
QgsExpression expression ( " represent_value(\" Pilots\" , 'Pilots')" );
389
389
if ( expression.hasParserError () )
390
390
qDebug () << expression.parserErrorString ();
391
- Q_ASSERT ( !expression.hasParserError () );
391
+ QVERIFY ( !expression.hasParserError () );
392
392
if ( expression.hasEvalError () )
393
393
qDebug () << expression.evalErrorString ();
394
- Q_ASSERT ( !expression.hasEvalError () );
394
+ QVERIFY ( !expression.hasEvalError () );
395
395
expression.prepare ( &context );
396
396
397
397
QgsFeature feature;
@@ -403,10 +403,10 @@ class TestQgsExpression: public QObject
403
403
QgsExpression expression2 ( " represent_value(\" Class\" , 'Class')" );
404
404
if ( expression2.hasParserError () )
405
405
qDebug () << expression2.parserErrorString ();
406
- Q_ASSERT ( !expression2.hasParserError () );
406
+ QVERIFY ( !expression2.hasParserError () );
407
407
if ( expression2.hasEvalError () )
408
408
qDebug () << expression2.evalErrorString ();
409
- Q_ASSERT ( !expression2.hasEvalError () );
409
+ QVERIFY ( !expression2.hasEvalError () );
410
410
expression2.prepare ( &context );
411
411
mPointsLayer ->getFeatures ( QgsFeatureRequest ().setFilterExpression ( " Class = 'Jet'" ) ).nextFeature ( feature );
412
412
context.setFeature ( feature );
@@ -416,10 +416,10 @@ class TestQgsExpression: public QObject
416
416
QgsExpression expression3 ( " represent_value(\" Pilots\" )" );
417
417
if ( expression3.hasParserError () )
418
418
qDebug () << expression.parserErrorString ();
419
- Q_ASSERT ( !expression3.hasParserError () );
419
+ QVERIFY ( !expression3.hasParserError () );
420
420
if ( expression3.hasEvalError () )
421
421
qDebug () << expression3.evalErrorString ();
422
- Q_ASSERT ( !expression3.hasEvalError () );
422
+ QVERIFY ( !expression3.hasEvalError () );
423
423
424
424
mPointsLayer ->getFeatures ( QgsFeatureRequest ().setFilterExpression ( " Pilots = 1" ) ).nextFeature ( feature );
425
425
context.setFeature ( feature );
@@ -428,12 +428,22 @@ class TestQgsExpression: public QObject
428
428
expression3.prepare ( &context );
429
429
QCOMPARE ( expression.evaluate ( &context ).toString (), QStringLiteral ( " one" ) );
430
430
431
-
432
431
QgsExpression expression4 ( " represent_value('Class')" );
432
+ expression4.evaluate ();
433
+ if ( expression4.hasParserError () )
434
+ qDebug () << expression4.parserErrorString ();
435
+ QVERIFY ( !expression4.hasParserError () );
436
+ if ( expression4.hasEvalError () )
437
+ qDebug () << expression4.evalErrorString ();
438
+ QVERIFY ( expression4.hasEvalError () );
439
+
440
+ expression4.prepare ( &context );
433
441
if ( expression4.hasParserError () )
434
442
qDebug () << expression4.parserErrorString ();
435
- Q_ASSERT ( !expression4.hasParserError () );
436
- Q_ASSERT ( expression4.hasEvalError () );
443
+ QVERIFY ( !expression4.hasParserError () );
444
+ if ( expression4.hasEvalError () )
445
+ qDebug () << expression4.evalErrorString ();
446
+ QVERIFY ( expression4.hasEvalError () );
437
447
}
438
448
439
449
void evaluation_data ()
@@ -1224,7 +1234,7 @@ class TestQgsExpression: public QObject
1224
1234
1225
1235
QgsExpressionContext context;
1226
1236
1227
- Q_ASSERT ( exp.prepare ( &context ) );
1237
+ QVERIFY ( exp.prepare ( &context ) );
1228
1238
1229
1239
QVariant::Type resultType = result.type ();
1230
1240
QVariant::Type expectedType = expected.type ();
@@ -1278,7 +1288,7 @@ class TestQgsExpression: public QObject
1278
1288
break ;
1279
1289
}
1280
1290
default :
1281
- Q_ASSERT ( false ); // should never happen
1291
+ QVERIFY ( false ); // should never happen
1282
1292
}
1283
1293
}
1284
1294
@@ -2417,7 +2427,7 @@ class TestQgsExpression: public QObject
2417
2427
QgsExpression exp1 ( QStringLiteral ( " eval()" ) );
2418
2428
QVariant v1 = exp1.evaluate ( &context );
2419
2429
2420
- Q_ASSERT ( !v1.isValid () );
2430
+ QVERIFY ( !v1.isValid () );
2421
2431
2422
2432
QgsExpression exp2 ( QStringLiteral ( " eval('4')" ) );
2423
2433
QVariant v2 = exp2.evaluate ( &context );
@@ -2903,7 +2913,7 @@ class TestQgsExpression: public QObject
2903
2913
QgsExpression e3 ( QStringLiteral ( " env('TESTENV_I_DO_NOT_EXIST')" ) );
2904
2914
QVariant result3 = e3 .evaluate ( &context );
2905
2915
2906
- Q_ASSERT ( result3.isNull () );
2916
+ QVERIFY ( result3.isNull () );
2907
2917
}
2908
2918
2909
2919
void test_formatPreviewString ()
0 commit comments