Skip to content

Commit

Permalink
Fix failing pal labeling canvas test
Browse files Browse the repository at this point in the history
Make sure image dpi respects mapsettings dpi in
QgsMapRendererSequentialJob.

Also apply a workaround to avoid segfault on end of test. This
workaround probably should be moved to QgsApplication::exitQgis()
but I'll do that after release in case of regressions.
  • Loading branch information
nyalldawson committed Feb 12, 2015
1 parent 5273889 commit e96b204
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -25,5 +25,5 @@ install:
- cmake -DWITH_SERVER=ON -DWITH_STAGED_PLUGINS=OFF -DWITH_GRASS=OFF \
-DSUPPRESS_QT_WARNINGS=ON -DENABLE_MODELTEST=ON -DWITH_QWTPOLAR=OFF -DWITH_APIDOC=ON ..

script: xvfb-run ctest -V -E 'PyQgsPalLabelingCanvas|PyQgsPalLabelingServer|qgis_wcsprovidertest' -S ../qgis-test-travis.ctest --output-on-failure
script: xvfb-run ctest -V -E 'PyQgsPalLabelingServer|qgis_wcsprovidertest' -S ../qgis-test-travis.ctest --output-on-failure

2 changes: 2 additions & 0 deletions src/core/qgsmaprenderersequentialjob.cpp
Expand Up @@ -29,6 +29,8 @@ QgsMapRendererSequentialJob::QgsMapRendererSequentialJob( const QgsMapSettings&
QgsDebugMsg( "SEQUENTIAL construct" );

mImage = QImage( mSettings.outputSize(), mSettings.outputImageFormat() );
mImage.setDotsPerMeterX( 1000 * settings.outputDpi() / 25.4 );
mImage.setDotsPerMeterY( 1000 * settings.outputDpi() / 25.4 );
}

QgsMapRendererSequentialJob::~QgsMapRendererSequentialJob()
Expand Down
5 changes: 4 additions & 1 deletion tests/src/python/test_qgspallabeling_canvas.py
Expand Up @@ -17,9 +17,10 @@
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import qgis
import sys
import os
from PyQt4.QtCore import qDebug
from PyQt4.QtCore import qDebug, QThreadPool

from utilities import (
getTempfilePath,
Expand Down Expand Up @@ -49,6 +50,8 @@ def tearDownClass(cls):
TestQgsPalLabeling.tearDownClass()
cls.removeMapLayer(cls.layer)
cls.layer = None
#avoid crash on finish, probably related to https://bugreports.qt.io/browse/QTBUG-35760
QThreadPool.globalInstance().waitForDone()

def setUp(self):
"""Run before each test."""
Expand Down

2 comments on commit e96b204

@strk
Copy link
Contributor

@strk strk commented on e96b204 Feb 13, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this. We are closer to a 100% success on make check :)

@nyalldawson
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@strk - on ubuntu at least. See #1899 for my plans on making tests more portable -- I'd appreciate any feedback!

Please sign in to comment.