Skip to content
Permalink
Browse files

Add test for @parent aggregate filter

  • Loading branch information
m-kuhn committed Oct 27, 2016
1 parent c79cf9a commit f292fdd625cffcb004a023b21b47ade36e9d6173
Showing with 5 additions and 0 deletions.
  1. +5 −0 tests/src/core/testqgsexpression.cpp
@@ -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 );

0 comments on commit f292fdd

Please sign in to comment.
You can’t perform that action at this time.