Skip to content

Commit

Permalink
Merge branch 'release-3_4' into backport-fix-help-button-group
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Feb 28, 2019
2 parents 06f595b + de0aede commit a6cdf71
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/layout/qgslayoutitemattributetable.cpp
Expand Up @@ -411,6 +411,7 @@ bool QgsLayoutItemAttributeTable::getTableContents( QgsLayoutTableContents &cont
{ {
activeFilter = true; activeFilter = true;
req.setFilterExpression( mFeatureFilter ); req.setFilterExpression( mFeatureFilter );
req.setExpressionContext( context );
} }
} }


Expand Down
24 changes: 24 additions & 0 deletions tests/src/core/testqgslayouttable.cpp
Expand Up @@ -241,6 +241,30 @@ void TestQgsLayoutTable::attributeTableFilterFeatures()


//retrieve rows and check //retrieve rows and check
compareTable( table, expectedRows ); compareTable( table, expectedRows );

table->setFeatureFilter( QStringLiteral( "\"Class\"=@airplane_class" ) );
table->setFilterFeatures( true );
expectedRows.clear();
compareTable( table, expectedRows );

QgsExpressionContextUtils::setLayoutVariable( &l, QStringLiteral( "airplane_class" ), QStringLiteral( "Biplane" ) );

row.clear();
row << QStringLiteral( "Biplane" ) << QStringLiteral( "0" ) << QStringLiteral( "1" ) << QStringLiteral( "3" ) << QStringLiteral( "3" ) << QStringLiteral( "6" );
expectedRows.append( row );
row.clear();
row << QStringLiteral( "Biplane" ) << QStringLiteral( "340" ) << QStringLiteral( "1" ) << QStringLiteral( "3" ) << QStringLiteral( "3" ) << QStringLiteral( "6" );
expectedRows.append( row );
row.clear();
row << QStringLiteral( "Biplane" ) << QStringLiteral( "300" ) << QStringLiteral( "1" ) << QStringLiteral( "3" ) << QStringLiteral( "2" ) << QStringLiteral( "5" );
expectedRows.append( row );
row.clear();
row << QStringLiteral( "Biplane" ) << QStringLiteral( "270" ) << QStringLiteral( "1" ) << QStringLiteral( "3" ) << QStringLiteral( "4" ) << QStringLiteral( "7" );
expectedRows.append( row );
row.clear();
row << QStringLiteral( "Biplane" ) << QStringLiteral( "240" ) << QStringLiteral( "1" ) << QStringLiteral( "3" ) << QStringLiteral( "2" ) << QStringLiteral( "5" );
expectedRows.append( row );
compareTable( table, expectedRows );
} }


void TestQgsLayoutTable::attributeTableSetAttributes() void TestQgsLayoutTable::attributeTableSetAttributes()
Expand Down

0 comments on commit a6cdf71

Please sign in to comment.