Skip to content
Permalink
Browse files

Explicitly set dpi for test images, should help tests pass on OSX

  • Loading branch information
nyalldawson committed Jun 23, 2015
1 parent f29b55a commit c855e9833371fc426c61a3a6c3087325bedc4262
@@ -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 );
@@ -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 );
@@ -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 );
@@ -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 );
@@ -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 );
@@ -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 );
@@ -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 );
@@ -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 );
@@ -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 );
@@ -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
@@ -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."""

0 comments on commit c855e98

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