Skip to content

Commit f292fdd

Browse files
committed
Add test for @parent aggregate filter
1 parent c79cf9a commit f292fdd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/src/core/testqgsexpression.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,8 @@ class TestQgsExpression: public QObject
12701270
QTest::newRow( "filter context" ) << "aggregate('test','sum',\"col1\", \"col1\" <= @test_var)" << false << QVariant( 13 );
12711271
QTest::newRow( "filter named" ) << "aggregate(layer:='test',aggregate:='sum',expression:=\"col1\", filter:=\"col1\" <= 10)" << false << QVariant( 13 );
12721272
QTest::newRow( "filter no matching" ) << "aggregate('test','sum',\"col1\", \"col1\" <= -10)" << false << QVariant( 0 );
1273+
1274+
QTest::newRow( "filter by @parent attribute" ) << "aggregate(layer:='child_layer', aggregate:='min', expression:=\"col3\", filter:=\"parent\"=attribute(@parent,'col1'))" << false << QVariant( 1 );
12731275
}
12741276

12751277
void aggregate()
@@ -1278,6 +1280,9 @@ class TestQgsExpression: public QObject
12781280
QgsExpressionContextScope* scope = new QgsExpressionContextScope();
12791281
scope->setVariable( QStringLiteral( "test_var" ), 10 );
12801282
context << scope;
1283+
QgsFeature f;
1284+
mAggregatesLayer->getFeatures( "col1 = 4 " ).nextFeature( f );
1285+
context.setFeature( f );
12811286

12821287
QFETCH( QString, string );
12831288
QFETCH( bool, evalError );

0 commit comments

Comments
 (0)