Skip to content
Permalink
Browse files

[tests] Update atlas tests, add exceptions

  • Loading branch information
nyalldawson committed Dec 28, 2013
1 parent ac63769 commit 089fbe95b66c53d9b3cf9711086a680339499a35
Showing with 24 additions and 25 deletions.
  1. +24 −25 tests/src/core/testqgsatlascomposition.cpp
  2. BIN ...ected_composermapatlas/autoscale_0.png → expected_atlas_autoscale1/expected_atlas_autoscale1.png}
  3. BIN tests/testdata/control_images/expected_atlas_autoscale1/ubuntu_13.04.anomaly.png
  4. BIN ...ected_composermapatlas/autoscale_1.png → expected_atlas_autoscale2/expected_atlas_autoscale2.png}
  5. BIN tests/testdata/control_images/expected_atlas_autoscale2/ubuntu_13.04.anomaly.png
  6. BIN ...ected_composermapatlas/filtering_0.png → expected_atlas_filtering1/expected_atlas_filtering1.png}
  7. BIN tests/testdata/control_images/expected_atlas_filtering1/ubuntu_13.04.anomaly.png
  8. BIN ...ed_composermapatlas/fixedscale_0.png → expected_atlas_fixedscale1/expected_atlas_fixedscale1.png}
  9. BIN tests/testdata/control_images/expected_atlas_fixedscale1/ubuntu_13.04.anomaly.png
  10. BIN ...ed_composermapatlas/fixedscale_1.png → expected_atlas_fixedscale2/expected_atlas_fixedscale2.png}
  11. BIN tests/testdata/control_images/expected_atlas_fixedscale2/ubuntu_13.04.anomaly.png
  12. BIN ...ages/{expected_composermapatlas/hiding_0.png → expected_atlas_hiding1/expected_atlas_hiding1.png}
  13. BIN tests/testdata/control_images/expected_atlas_hiding1/ubuntu_13.04.anomaly.png
  14. BIN ...ages/{expected_composermapatlas/hiding_1.png → expected_atlas_hiding2/expected_atlas_hiding2.png}
  15. BIN tests/testdata/control_images/expected_atlas_hiding2/ubuntu_13.04.anomaly.png
  16. BIN ...s/{expected_composermapatlas/sorting_0.png → expected_atlas_sorting1/expected_atlas_sorting1.png}
  17. BIN tests/testdata/control_images/expected_atlas_sorting1/ubuntu_13.04.anomaly.png
  18. BIN ...s/{expected_composermapatlas/sorting_1.png → expected_atlas_sorting2/expected_atlas_sorting2.png}
  19. BIN tests/testdata/control_images/expected_atlas_sorting2/ubuntu_13.04.anomaly.png
@@ -60,6 +60,7 @@ class TestQgsAtlasComposition: public QObject
QgsMapRenderer* mMapRenderer;
QgsVectorLayer* mVectorLayer;
QgsAtlasComposition* mAtlas;
QString mReport;
};

void TestQgsAtlasComposition::initTestCase()
@@ -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
@@ -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()
@@ -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();
}
@@ -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();

@@ -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();
}
@@ -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();
}
@@ -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();
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 089fbe9

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