Skip to content

Commit

Permalink
[tests] Update atlas tests, add exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 28, 2013
1 parent ac63769 commit 089fbe9
Show file tree
Hide file tree
Showing 19 changed files with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions tests/src/core/testqgsatlascomposition.cpp
Expand Up @@ -60,6 +60,7 @@ class TestQgsAtlasComposition: public QObject
QgsMapRenderer* mMapRenderer;
QgsVectorLayer* mVectorLayer;
QgsAtlasComposition* mAtlas;
QString mReport;
};

void TestQgsAtlasComposition::initTestCase()
Expand All @@ -73,6 +74,8 @@ void TestQgsAtlasComposition::initTestCase()
vectorFileInfo.completeBaseName(),
"ogr" );

mVectorLayer->setSimplifyDrawingHints( QgsVectorLayer::NoSimplification );

QgsMapLayerRegistry::instance()->addMapLayers( QList<QgsMapLayer*>() << mVectorLayer );

//create composition with composer map
Expand Down Expand Up @@ -132,13 +135,24 @@ void TestQgsAtlasComposition::initTestCase()

qWarning() << "header label font: " << mLabel1->font().toString() << " exactMatch:" << mLabel1->font().exactMatch();
qWarning() << "feature number label font: " << mLabel2->font().toString() << " exactMatch:" << mLabel2->font().exactMatch();

mReport = "<h1>Composer Atlas Tests</h1>\n";
}

void TestQgsAtlasComposition::cleanupTestCase()
{
delete mComposition;
delete mMapRenderer;
delete mVectorLayer;

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
{
QTextStream myQTextStream( &myFile );
myQTextStream << mReport;
myFile.close();
}
}

void TestQgsAtlasComposition::init()
Expand Down Expand Up @@ -175,11 +189,8 @@ void TestQgsAtlasComposition::autoscale_render()
mAtlas->prepareForFeature( fit );
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( "Atlas autoscale test", mComposition,
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
"expected_composermapatlas" + QDir::separator() +
QString( "autoscale_%1.png" ).arg(( int )fit ) );
QVERIFY( checker.testComposition( 0 ) );
QgsCompositionChecker checker( QString( "atlas_autoscale%1" ).arg((( int )fit ) + 1 ), mComposition );
QVERIFY( checker.testComposition( mReport, 0 ) );
}
mAtlas->endRender();
}
Expand All @@ -196,11 +207,8 @@ void TestQgsAtlasComposition::fixedscale_render()
mAtlas->prepareForFeature( fit );
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( "Atlas fixedscale test", mComposition,
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
"expected_composermapatlas" + QDir::separator() +
QString( "fixedscale_%1.png" ).arg(( int )fit ) );
QVERIFY( checker.testComposition( 0 ) );
QgsCompositionChecker checker( QString( "atlas_fixedscale%1" ).arg((( int )fit ) + 1 ), mComposition );
QVERIFY( checker.testComposition( mReport, 0 ) );
}
mAtlas->endRender();

Expand All @@ -219,11 +227,8 @@ void TestQgsAtlasComposition::hiding_render()
mAtlas->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 ) );
QgsCompositionChecker checker( QString( "atlas_hiding%1" ).arg((( int )fit ) + 1 ), mComposition );
QVERIFY( checker.testComposition( mReport, 0 ) );
}
mAtlas->endRender();
}
Expand All @@ -245,11 +250,8 @@ void TestQgsAtlasComposition::sorting_render()
mAtlas->prepareForFeature( fit );
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( "Atlas sorting test", mComposition,
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
"expected_composermapatlas" + QDir::separator() +
QString( "sorting_%1.png" ).arg(( int )fit ) );
QVERIFY( checker.testComposition( 0 ) );
QgsCompositionChecker checker( QString( "atlas_sorting%1" ).arg((( int )fit ) + 1 ), mComposition );
QVERIFY( checker.testComposition( mReport, 0 ) );
}
mAtlas->endRender();
}
Expand All @@ -272,11 +274,8 @@ void TestQgsAtlasComposition::filtering_render()
mAtlas->prepareForFeature( fit );
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( "Atlas filtering test", mComposition,
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
"expected_composermapatlas" + QDir::separator() +
QString( "filtering_%1.png" ).arg(( int )fit ) );
QVERIFY( checker.testComposition( 0 ) );
QgsCompositionChecker checker( QString( "atlas_filtering%1" ).arg((( int )fit ) + 1 ), mComposition );
QVERIFY( checker.testComposition( mReport, 0 ) );
}
mAtlas->endRender();
}
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 089fbe9

Please sign in to comment.