Skip to content

Commit e474bd2

Browse files
committed
Add failing test for #16517
1 parent bb7f95f commit e474bd2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/src/core/testqgscomposition.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,17 +758,21 @@ void TestQgsComposition::mapLayersRestoredFromTemplate()
758758
QgsVectorLayer *layer2 = new QgsVectorLayer( vectorFileInfo2.filePath(),
759759
vectorFileInfo2.completeBaseName(),
760760
"ogr" );
761+
QFileInfo rasterFileInfo( QString( TEST_DATA_DIR ) + "/landsat.tif" );
762+
QgsRasterLayer *rl = new QgsRasterLayer( rasterFileInfo.filePath(),
763+
rasterFileInfo.completeBaseName() );
761764

762765
QgsMapLayerRegistry::instance()->addMapLayer( layer2 );
763766
QgsMapLayerRegistry::instance()->addMapLayer( layer );
767+
QgsMapLayerRegistry::instance()->addMapLayer( rl );
764768

765769
// create composition
766770
QgsMapSettings ms;
767771
QgsComposition c( ms );
768772
// add a map
769773
QgsComposerMap *map = new QgsComposerMap( &c, 1, 1, 10, 10 );
770774
c.addComposerMap( map );
771-
map->setLayerSet( QStringList() << layer->id() << layer2->id() );
775+
map->setLayerSet( QStringList() << layer->id() << layer2->id() << rl->id() );
772776

773777
// save composition to template
774778
QDomDocument doc;
@@ -785,8 +789,11 @@ void TestQgsComposition::mapLayersRestoredFromTemplate()
785789
QgsVectorLayer *layer4 = new QgsVectorLayer( vectorFileInfo2.filePath(),
786790
vectorFileInfo2.completeBaseName(),
787791
"ogr" );
792+
QgsRasterLayer *rl5 = new QgsRasterLayer( rasterFileInfo.filePath(),
793+
rasterFileInfo.completeBaseName() );
788794
QgsMapLayerRegistry::instance()->addMapLayer( layer4 );
789795
QgsMapLayerRegistry::instance()->addMapLayer( layer3 );
796+
QgsMapLayerRegistry::instance()->addMapLayer( rl5 );
790797

791798
// make a new composition from template
792799
QgsComposition c2( ms );
@@ -797,7 +804,7 @@ void TestQgsComposition::mapLayersRestoredFromTemplate()
797804
QgsComposerMap *map2 = static_cast< QgsComposerMap *>( maps.at( 0 ) );
798805
QVERIFY( map2 );
799806

800-
QCOMPARE( map2->layerSet(), QStringList() << layer3->id() << layer4->id() );
807+
QCOMPARE( map2->layerSet(), QStringList() << layer3->id() << layer4->id() << rl5->id() );
801808
}
802809

803810
void TestQgsComposition::mapLayersStyleOverrideRestoredFromTemplate()

0 commit comments

Comments
 (0)