Skip to content
Permalink
Browse files

Add a test for Atlas generation when the coverage layer is hidden

  • Loading branch information
Hugo Mercier
Hugo Mercier committed Sep 28, 2012
1 parent e986e4f commit c85ad5a46a4175c40912db7d2f9922192e086f6b
Showing with 29 additions and 5 deletions.
  1. +29 −5 tests/src/core/testqgscomposermapatlas.cpp
@@ -44,6 +44,8 @@ private slots:
void autoscale_render();
// test rendering with a fixed scale atlas
void fixedscale_render();
// test rendering with a hidden coverage
void hiding_render();
private:
QgsComposition* mComposition;
QgsComposerLabel* mLabel1;
@@ -117,13 +119,9 @@ void TestQgsComposerMapAtlas::initTestCase()

void TestQgsComposerMapAtlas::cleanupTestCase()
{
/* delete mComposition;
delete mComposerMap;
delete mLabel1;
delete mLabel2;
delete mComposition;
delete mMapRenderer;
delete mVectorLayer;
*/
}

void TestQgsComposerMapAtlas::init()
@@ -149,6 +147,7 @@ void TestQgsComposerMapAtlas::filename()
atlasRender.end();
}


void TestQgsComposerMapAtlas::autoscale_render()
{
mAtlasMap->setAtlasFixedScale( false );
@@ -196,5 +195,30 @@ void TestQgsComposerMapAtlas::fixedscale_render()

}

void TestQgsComposerMapAtlas::hiding_render()
{
mAtlasMap->setNewExtent( QgsRectangle( 209838.166, 6528781.020, 610491.166, 6920530.620 ) );
mAtlasMap->setAtlasFixedScale( true );
mAtlasMap->setAtlasHideCoverage( true );

QgsAtlasRendering atlasRender( mComposition );

atlasRender.begin();

for ( size_t fit = 0; fit < 2; ++fit )
{
atlasRender.prepareForFeature( fit );
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( "Atlas hidden test", mComposition,
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
"expected_composermapatlas" + QDir::separator() +
QString( "hiding_%1.png" ).arg((int)fit) );
QVERIFY( checker.testComposition( 0 ) );
}
atlasRender.end();

}

QTEST_MAIN( TestQgsComposerMapAtlas )
#include "moc_testqgscomposermapatlas.cxx"

0 comments on commit c85ad5a

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