Skip to content

Commit e6d7eb6

Browse files
committed
Test for composer overview map
1 parent 75d68cd commit e6d7eb6

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

tests/src/core/testqgscomposermap.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class TestQgsComposerMap: public QObject
3636
void cleanup();// will be called after every testfunction.
3737
void render(); //test if rendering of the composition with composr map is correct
3838
void grid(); //test if grid and grid annotation works
39+
void overviewMap(); //test if overview map frame works
3940

4041
private:
4142
QgsComposition* mComposition;
@@ -110,7 +111,24 @@ void TestQgsComposerMap::grid()
110111
mComposerMap->setGridAnnotationDirection( QgsComposerMap::Horizontal, QgsComposerMap::Bottom );
111112
QgsCompositionChecker checker( "Composer map grid", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
112113
"control_images" + QDir::separator() + "composermap_landsat_grid.png" ) );
113-
QVERIFY( checker.testComposition() );
114+
bool testResult = checker.testComposition();
115+
mComposerMap->setGridEnabled( false );
116+
mComposerMap->setShowGridAnnotation( false );
117+
QVERIFY( testResult );
118+
}
119+
120+
void TestQgsComposerMap::overviewMap()
121+
{
122+
QgsComposerMap* overviewMap = new QgsComposerMap( mComposition, 20, 130, 70, 70 );
123+
mComposition->addComposerMap( overviewMap );
124+
mComposerMap->setNewExtent( QgsRectangle( 785462.375, 3341423.125, 789262.375, 3343323.125 ) ); //zoom in
125+
overviewMap->setNewExtent( QgsRectangle( 781662.375, 3339523.125, 793062.375, 3350923.125 ) );
126+
overviewMap->setOverviewFrameMap( mComposerMap->id() );
127+
QgsCompositionChecker checker( "Composer map overview", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
128+
"control_images" + QDir::separator() + "composermap_landsat_overview.png" ) );
129+
bool testResult = checker.testComposition();
130+
mComposition->removeComposerItem( overviewMap );
131+
QVERIFY( testResult );
114132
}
115133

116134
QTEST_MAIN( TestQgsComposerMap )
175 KB
Loading

0 commit comments

Comments
 (0)