Skip to content

Commit

Permalink
Add test for @parent aggregate filter
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Oct 27, 2016
1 parent c79cf9a commit f292fdd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/src/core/testqgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 );
Expand Down

0 comments on commit f292fdd

Please sign in to comment.