mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Add test for @parent aggregate filter
This commit is contained in:
parent
c79cf9ae15
commit
f292fdd625
@ -1270,6 +1270,8 @@ class TestQgsExpression: public QObject
|
||||
QTest::newRow( "filter context" ) << "aggregate('test','sum',\"col1\", \"col1\" <= @test_var)" << false << QVariant( 13 );
|
||||
QTest::newRow( "filter named" ) << "aggregate(layer:='test',aggregate:='sum',expression:=\"col1\", filter:=\"col1\" <= 10)" << false << QVariant( 13 );
|
||||
QTest::newRow( "filter no matching" ) << "aggregate('test','sum',\"col1\", \"col1\" <= -10)" << false << QVariant( 0 );
|
||||
|
||||
QTest::newRow( "filter by @parent attribute" ) << "aggregate(layer:='child_layer', aggregate:='min', expression:=\"col3\", filter:=\"parent\"=attribute(@parent,'col1'))" << false << QVariant( 1 );
|
||||
}
|
||||
|
||||
void aggregate()
|
||||
@ -1278,6 +1280,9 @@ class TestQgsExpression: public QObject
|
||||
QgsExpressionContextScope* scope = new QgsExpressionContextScope();
|
||||
scope->setVariable( QStringLiteral( "test_var" ), 10 );
|
||||
context << scope;
|
||||
QgsFeature f;
|
||||
mAggregatesLayer->getFeatures( "col1 = 4 " ).nextFeature( f );
|
||||
context.setFeature( f );
|
||||
|
||||
QFETCH( QString, string );
|
||||
QFETCH( bool, evalError );
|
||||
|
Loading…
x
Reference in New Issue
Block a user