Skip to content
Permalink
Browse files

Add unit test for world file generation

  • Loading branch information
mhugo authored and mhugent committed Jun 12, 2013
1 parent 387c88d commit 50f86c89deb83f7591495d351befae2560bcf774
Showing with 21 additions and 1 deletion.
  1. +21 −1 tests/src/core/testqgscomposermap.cpp
@@ -42,6 +42,7 @@ class TestQgsComposerMap: public QObject
void uniqueId(); //test if map id is adapted when doing copy paste
void zebraStyle(); //test zebra map border style
void overviewMapCenter(); //test if centering of overview map frame works
void worldFileGeneration(); // test world file generation

private:
QgsComposition* mComposition;
@@ -84,7 +85,6 @@ void TestQgsComposerMap::cleanupTestCase()

void TestQgsComposerMap::init()
{

}

void TestQgsComposerMap::cleanup()
@@ -235,5 +235,25 @@ void TestQgsComposerMap::overviewMapCenter()
mComposition->removeComposerItem( overviewMapCenter );
QVERIFY( testResult );
}

void TestQgsComposerMap::worldFileGeneration()
{
mComposerMap->setNewExtent( QgsRectangle( 781662.375, 3339523.125, 793062.375, 3345223.125 ) );
mComposerMap->setRotation( 30.0 );

mComposition->setGenerateWorldFile( true );
mComposition->setWorldFileMap( mComposerMap );

double params[6];
mComposition->computeWorldFileParameters( params );

QVERIFY( fabs(params[0] - 4.18048) < 0.001 );
QVERIFY( fabs(params[1] - 2.41331) < 0.001 );
QVERIFY( fabs(params[2] - 779444) < 1 );
QVERIFY( fabs(params[3] - 2.4136) < 0.001 );
QVERIFY( fabs(params[4] + 4.17997) < 0.001 );
QVERIFY( fabs(params[5] - 3.34241e+06) < 1e+03 );
}

QTEST_MAIN( TestQgsComposerMap )
#include "moc_testqgscomposermap.cxx"

0 comments on commit 50f86c8

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