Skip to content

Commit e96b204

Browse files
committed
Fix failing pal labeling canvas test
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.
1 parent 5273889 commit e96b204

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ install:
2525
- cmake -DWITH_SERVER=ON -DWITH_STAGED_PLUGINS=OFF -DWITH_GRASS=OFF \
2626
-DSUPPRESS_QT_WARNINGS=ON -DENABLE_MODELTEST=ON -DWITH_QWTPOLAR=OFF -DWITH_APIDOC=ON ..
2727

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

src/core/qgsmaprenderersequentialjob.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ QgsMapRendererSequentialJob::QgsMapRendererSequentialJob( const QgsMapSettings&
2929
QgsDebugMsg( "SEQUENTIAL construct" );
3030

3131
mImage = QImage( mSettings.outputSize(), mSettings.outputImageFormat() );
32+
mImage.setDotsPerMeterX( 1000 * settings.outputDpi() / 25.4 );
33+
mImage.setDotsPerMeterY( 1000 * settings.outputDpi() / 25.4 );
3234
}
3335

3436
QgsMapRendererSequentialJob::~QgsMapRendererSequentialJob()

tests/src/python/test_qgspallabeling_canvas.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
# This will get replaced with a git SHA1 when you do a git archive
1818
__revision__ = '$Format:%H$'
1919

20+
import qgis
2021
import sys
2122
import os
22-
from PyQt4.QtCore import qDebug
23+
from PyQt4.QtCore import qDebug, QThreadPool
2324

2425
from utilities import (
2526
getTempfilePath,
@@ -49,6 +50,8 @@ def tearDownClass(cls):
4950
TestQgsPalLabeling.tearDownClass()
5051
cls.removeMapLayer(cls.layer)
5152
cls.layer = None
53+
#avoid crash on finish, probably related to https://bugreports.qt.io/browse/QTBUG-35760
54+
QThreadPool.globalInstance().waitForDone()
5255

5356
def setUp(self):
5457
"""Run before each test."""

0 commit comments

Comments
 (0)