Skip to content
Permalink
Browse files

[tests] Update composer map tests, add anomoly images

  • Loading branch information
nyalldawson committed Dec 28, 2013
1 parent ab42edc commit afbd2ac2ce5a4d5681871c22f761d8b2bcffa736
Showing with 33 additions and 21 deletions.
  1. +33 −21 tests/src/core/testqgscomposermap.cpp
  2. BIN ...mposermap/composermap_landsat_grid.png → expected_composermap_grid/expected_composermap_grid.png}
  3. BIN tests/testdata/control_images/expected_composermap_grid/ubuntu_13.04.anomaly.png
  4. BIN tests/testdata/control_images/expected_composermap_grid/ubuntu_13.10.anomaly.png
  5. BIN ...mposermap_landsat_overview.png → expected_composermap_overview/expected_composermap_overview.png}
  6. BIN tests/testdata/control_images/expected_composermap_overview/ubuntu_13.04.anomaly.png
  7. BIN ...ew_blend.png → expected_composermap_overview_blending/expected_composermap_overview_blending.png}
  8. BIN tests/testdata/control_images/expected_composermap_overview_blending/ubuntu_13.04.anomaly.png
  9. BIN ...rview_center.png → expected_composermap_overview_center/expected_composermap_overview_center.png}
  10. BIN tests/testdata/control_images/expected_composermap_overview_center/ubuntu_13.04.anomaly.png
  11. BIN ...rview_invert.png → expected_composermap_overview_invert/expected_composermap_overview_invert.png}
  12. BIN tests/testdata/control_images/expected_composermap_overview_invert/ubuntu_13.04.anomaly.png
  13. BIN ...map/composermap_landsat_render.png → expected_composermap_render/expected_composermap_render.png}
  14. BIN tests/testdata/control_images/expected_composermap_render/ubuntu_13.04.anomaly.png
  15. BIN ...omposermap_zebra_style.png → expected_composermap_zebrastyle/expected_composermap_zebrastyle.png}
@@ -49,6 +49,7 @@ class TestQgsComposerMap: public QObject
QgsComposerMap* mComposerMap;
QgsMapRenderer* mMapRenderer;
QgsRasterLayer* mRasterLayer;
QString mReport;
};

void TestQgsComposerMap::initTestCase()
@@ -74,13 +75,24 @@ void TestQgsComposerMap::initTestCase()
mComposerMap = new QgsComposerMap( mComposition, 20, 20, 200, 100 );
mComposerMap->setFrameEnabled( true );
mComposition->addComposerMap( mComposerMap );

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

void TestQgsComposerMap::cleanupTestCase()
{
delete mComposition;
delete mMapRenderer;
delete mRasterLayer;

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 TestQgsComposerMap::init()
@@ -95,9 +107,9 @@ void TestQgsComposerMap::cleanup()
void TestQgsComposerMap::render()
{
mComposerMap->setNewExtent( QgsRectangle( 781662.375, 3339523.125, 793062.375, 3345223.125 ) );
QgsCompositionChecker checker( "Composer map render", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composermap" + QDir::separator() + "composermap_landsat_render.png" ) );
QVERIFY( checker.testComposition() );
QgsCompositionChecker checker( "composermap_render", mComposition );

QVERIFY( checker.testComposition( mReport ) );
}

void TestQgsComposerMap::grid()
@@ -119,9 +131,9 @@ void TestQgsComposerMap::grid()
mComposerMap->setAnnotationFontColor( QColor( 255, 0, 0, 150 ) );
mComposerMap->setGridBlendMode( QPainter::CompositionMode_Overlay );
qWarning() << "grid annotation font: " << mComposerMap->gridAnnotationFont().toString() << " exactMatch:" << mComposerMap->gridAnnotationFont().exactMatch();
QgsCompositionChecker checker( "Composer map grid", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composermap" + QDir::separator() + "composermap_landsat_grid.png" ) );
bool testResult = checker.testComposition();
QgsCompositionChecker checker( "composermap_grid", mComposition );
bool testResult = checker.testComposition( mReport);
mComposerMap->setGridEnabled( false );
mComposerMap->setShowGridAnnotation( false );
QVERIFY( testResult );
@@ -135,9 +147,9 @@ void TestQgsComposerMap::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() + "expected_composermap" + QDir::separator() + "composermap_landsat_overview.png" ) );
bool testResult = checker.testComposition();
QgsCompositionChecker checker( "composermap_overview", mComposition );

bool testResult = checker.testComposition( mReport);
mComposition->removeComposerItem( overviewMap );
QVERIFY( testResult );
}
@@ -152,9 +164,9 @@ void TestQgsComposerMap::overviewMapBlending()
overviewMapBlend->setOverviewFrameMap( mComposerMap->id() );
overviewMapBlend->setOverviewBlendMode( QPainter::CompositionMode_Multiply );

QgsCompositionChecker checker( "Composer map overview blending", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composermap" + QDir::separator() + "composermap_landsat_overview_blend.png" ) );
bool testResult = checker.testComposition();
QgsCompositionChecker checker( "composermap_overview_blending", mComposition );

bool testResult = checker.testComposition( mReport);
mComposition->removeComposerItem( overviewMapBlend );
QVERIFY( testResult );
}
@@ -169,9 +181,9 @@ void TestQgsComposerMap::overviewMapInvert()
overviewMapInvert->setOverviewFrameMap( mComposerMap->id() );
overviewMapInvert->setOverviewInverted( true );

QgsCompositionChecker checker( "Composer map overview invert", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composermap" + QDir::separator() + "composermap_landsat_overview_invert.png" ) );
bool testResult = checker.testComposition();
QgsCompositionChecker checker( "composermap_overview_invert", mComposition );

bool testResult = checker.testComposition( mReport);
mComposition->removeComposerItem( overviewMapInvert );
QVERIFY( testResult );
}
@@ -212,9 +224,9 @@ void TestQgsComposerMap::zebraStyle()
mComposerMap->setGridFrameStyle( QgsComposerMap::Zebra );
mComposerMap->setGridEnabled( true );

QgsCompositionChecker checker( "Composer map zebra", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composermap" + QDir::separator() + "composermap_zebra_style.png" ) );
bool testResult = checker.testComposition();
QgsCompositionChecker checker( "composermap_zebrastyle", mComposition );

bool testResult = checker.testComposition( mReport);
QVERIFY( testResult );
}

@@ -229,9 +241,9 @@ void TestQgsComposerMap::overviewMapCenter()
overviewMapCenter->setOverviewFrameMap( mComposerMap->id() );
overviewMapCenter->setOverviewCentered( true );

QgsCompositionChecker checker( "Composer map overview center", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composermap" + QDir::separator() + "composermap_landsat_overview_center.png" ) );
bool testResult = checker.testComposition();
QgsCompositionChecker checker( "composermap_overview_center", mComposition );

bool testResult = checker.testComposition( mReport);
mComposition->removeComposerItem( overviewMapCenter );
QVERIFY( testResult );
}
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 afbd2ac

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