Skip to content

Commit

Permalink
Explicitly set dpi for test images, should help tests pass on OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 23, 2015
1 parent f29b55a commit c855e98
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/src/core/testqgsblendmodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ bool TestQgsBlendModes::imageCheck( QString theTestType )
{
//use the QgsRenderChecker test utility class to
//ensure the rendered output matches our control image
mMapSettings.setOutputDpi( 96 );
QgsMultiRenderChecker myChecker;
myChecker.setControlName( "expected_" + theTestType );
myChecker.setMapSettings( mMapSettings );
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgsdiagram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ bool TestQgsDiagram::imageCheck( QString theTestType )
QgsRectangle extent( -126, 23, -70, 47 );
mMapSettings.setExtent( extent );
mMapSettings.setFlag( QgsMapSettings::ForceVectorOutput );
mMapSettings.setOutputDpi( 96 );
QgsMultiRenderChecker myChecker;
myChecker.setControlName( "expected_" + theTestType );
myChecker.setMapSettings( mMapSettings );
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgsinvertedpolygonrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ bool TestQgsInvertedPolygon::imageCheck( QString theTestType, const QgsRectangle
{
mMapSettings.setExtent( *extent );
}
mMapSettings.setOutputDpi( 96 );
QgsMultiRenderChecker myChecker;
myChecker.setControlName( "expected_" + theTestType );
myChecker.setMapSettings( mMapSettings );
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgsmaprotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ void TestQgsMapRotation::linesLayer()
bool TestQgsMapRotation::render( QString theTestType )
{
mReport += "<h2>" + theTestType + "</h2>\n";
mMapSettings.setOutputDpi( 96 );
QgsRenderChecker checker;
checker.setControlPathPrefix( "maprotation" );
checker.setControlName( "expected_" + theTestType );
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgspainteffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,7 @@ bool TestQgsPaintEffect::imageCheck( QString testName, QImage &image, int mismat
bool TestQgsPaintEffect::mapRenderCheck( QString testName, QgsMapSettings& mapSettings, int mismatchCount )
{
QgsMultiRenderChecker checker;
mapSettings.setOutputDpi( 96 );
checker.setControlName( "expected_" + testName );
checker.setMapSettings( mapSettings );
checker.setColorTolerance( 20 );
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgsrasterfill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ bool TestQgsRasterFill::imageCheck( QString theTestType )
//use the QgsRenderChecker test utility class to
//ensure the rendered output matches our control image
mMapSettings.setExtent( mpPolysLayer->extent() );
mMapSettings.setOutputDpi( 96 );
QgsMultiRenderChecker myChecker;
myChecker.setControlName( "expected_" + theTestType );
myChecker.setMapSettings( mMapSettings );
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgsrenderers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ bool TestQgsRenderers::imageCheck( QString theTestType )
QgsRectangle extent( -118.8888888888887720, 22.8002070393376783, -83.3333333333331581, 46.8719806763287536 );
mMapSettings.setExtent( extent );
mMapSettings.setFlag( QgsMapSettings::ForceVectorOutput );
mMapSettings.setOutputDpi( 96 );
QgsMultiRenderChecker myChecker;
myChecker.setControlName( "expected_" + theTestType );
myChecker.setMapSettings( mMapSettings );
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgsshapeburst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ bool TestQgsShapeburst::imageCheck( QString theTestType )
//use the QgsRenderChecker test utility class to
//ensure the rendered output matches our control image
mMapSettings.setExtent( mpPolysLayer->extent() );
mMapSettings.setOutputDpi( 96 );
QgsMultiRenderChecker myChecker;
myChecker.setControlName( "expected_" + theTestType );
myChecker.setMapSettings( mMapSettings );
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgsstylev2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ void TestStyleV2::cleanupTestCase()
bool TestStyleV2::imageCheck( QgsMapSettings& ms, const QString& testName )
{
QgsMultiRenderChecker checker;
ms.setOutputDpi( 96 );
checker.setControlName( "expected_" + testName );
checker.setMapSettings( ms );
bool result = checker.runTest( testName, 0 );
Expand Down
10 changes: 8 additions & 2 deletions tests/src/gui/testqgsmapcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,20 @@ void TestQgsMapCanvas::testMapRendererInteraction()
QgsRectangle r1( 10, 10, 20, 20 );
mr->setExtent( r1 );
QgsRectangle r2 = mr->extent();
QCOMPARE( mCanvas->extent(), r2 );
QVERIFY( qgsDoubleNear( mCanvas->extent().xMinimum(), r2.xMinimum(), 0.0000000001 ) );
QVERIFY( qgsDoubleNear( mCanvas->extent().yMinimum(), r2.yMinimum(), 0.0000000001 ) );
QVERIFY( qgsDoubleNear( mCanvas->extent().xMaximum(), r2.xMaximum(), 0.0000000001 ) );
QVERIFY( qgsDoubleNear( mCanvas->extent().yMaximum(), r2.yMaximum(), 0.0000000001 ) );
QCOMPARE( spy2.count(), 1 );

QgsRectangle r3( 100, 100, 200, 200 );
QSignalSpy spy3( mr, SIGNAL( extentsChanged() ) );
mCanvas->setExtent( r3 );
QgsRectangle r4 = mCanvas->extent();
QCOMPARE( mr->extent(), r4 );
QVERIFY( qgsDoubleNear( mr->extent().xMinimum(), r4.xMinimum(), 0.0000000001 ) );
QVERIFY( qgsDoubleNear( mr->extent().yMinimum(), r4.yMinimum(), 0.0000000001 ) );
QVERIFY( qgsDoubleNear( mr->extent().xMaximum(), r4.xMaximum(), 0.0000000001 ) );
QVERIFY( qgsDoubleNear( mr->extent().yMaximum(), r4.yMaximum(), 0.0000000001 ) );
QCOMPARE( spy3.count(), 1 );

// Destination CRS
Expand Down
1 change: 1 addition & 0 deletions tests/src/python/test_qgsblendmodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def __init__(self, methodName):
self.mMap.resize(QSize(400, 400))
self.mapSettings = self.mCanvas.mapSettings()
self.mapSettings.setOutputSize(QSize(400, 400))
self.mapSettings.setOutputDpi( 96 )

def testVectorBlending(self):
"""Test that blend modes work for vector layers."""
Expand Down

0 comments on commit c855e98

Please sign in to comment.