Skip to content

Commit

Permalink
Test for composer overview map
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jul 12, 2012
1 parent 75d68cd commit e6d7eb6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/src/core/testqgscomposermap.cpp
Expand Up @@ -36,6 +36,7 @@ class TestQgsComposerMap: public QObject
void cleanup();// will be called after every testfunction.
void render(); //test if rendering of the composition with composr map is correct
void grid(); //test if grid and grid annotation works
void overviewMap(); //test if overview map frame works

private:
QgsComposition* mComposition;
Expand Down Expand Up @@ -110,7 +111,24 @@ void TestQgsComposerMap::grid()
mComposerMap->setGridAnnotationDirection( QgsComposerMap::Horizontal, QgsComposerMap::Bottom );
QgsCompositionChecker checker( "Composer map grid", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "composermap_landsat_grid.png" ) );
QVERIFY( checker.testComposition() );
bool testResult = checker.testComposition();
mComposerMap->setGridEnabled( false );
mComposerMap->setShowGridAnnotation( false );
QVERIFY( testResult );
}

void TestQgsComposerMap::overviewMap()
{
QgsComposerMap* overviewMap = new QgsComposerMap( mComposition, 20, 130, 70, 70 );
mComposition->addComposerMap( overviewMap );
mComposerMap->setNewExtent( QgsRectangle( 785462.375, 3341423.125, 789262.375, 3343323.125 ) ); //zoom in
overviewMap->setNewExtent( QgsRectangle( 781662.375, 3339523.125, 793062.375, 3350923.125 ) );
overviewMap->setOverviewFrameMap( mComposerMap->id() );
QgsCompositionChecker checker( "Composer map overview", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "composermap_landsat_overview.png" ) );
bool testResult = checker.testComposition();
mComposition->removeComposerItem( overviewMap );
QVERIFY( testResult );
}

QTEST_MAIN( TestQgsComposerMap )
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e6d7eb6

Please sign in to comment.