Skip to content
Permalink
Browse files

Add label svg background unit tests and control images

  • Loading branch information
dakcarto committed Feb 22, 2014
1 parent 7e33fde commit 0a9b857177d944c3d165680e3ea14425e0d786f9
@@ -140,7 +140,14 @@ class TestComposerVsCanvasPoint(TestComposerPoint):
def setUpClass(cls):
TestComposerPoint.setUpClass()
cls._CheckGroup = 'pal_canvas'
cls._CheckMismatch = 2700 # rounding errors on composer output?
# rounding errors in composer; antialiasing?
cls._CheckMismatch = 2700
# cls._CheckMismatch = 0 # uncomment to PAL_REPORT actual difference

def setUp(self):
super(TestComposerVsCanvasPoint, self).setUp()
if 'test_background_svg' in self.id():
self._CheckMismatch = 3600


if __name__ == '__main__':
@@ -21,6 +21,9 @@

from qgis.core import *

from utilities import (
svgSymbolsPath
)

# noinspection PyPep8Naming
class TestPointBase(object):
@@ -77,6 +80,45 @@ def test_background_rect_w_offset(self):
self.lyr.shapeOffset = QPointF(-2900.0, -450.0 )
self.checkTest()

def test_background_svg(self):
# Label SVG background
# NOTE: this has higher _CheckMismatch (3600) in ComposerVsCanvasPoint
self.lyr.fontSizeInMapUnits = True
font = QFont(self._TestFont)
font.setPointSizeF(460)
self.lyr.textFont = font

self.lyr.shapeDraw = True
self.lyr.shapeType = QgsPalLayerSettings.ShapeSVG
svg = os.path.join(
svgSymbolsPath(), 'backgrounds', 'background_square.svg')
self.lyr.shapeSVGFile = svg
self.lyr.shapeSizeUnits = QgsPalLayerSettings.MapUnits
self.lyr.shapeSizeType = QgsPalLayerSettings.SizeBuffer
self.lyr.shapeSize = QPointF(100.0, 0.0)
self.checkTest()

def test_background_svg_w_offset(self):
# Label SVG background
# NOTE: this has higher _CheckMismatch (3600) in ComposerVsCanvasPoint
self.lyr.fontSizeInMapUnits = True
font = QFont(self._TestFont)
font.setPointSizeF(460)
self.lyr.textFont = font

self.lyr.shapeDraw = True
self.lyr.shapeType = QgsPalLayerSettings.ShapeSVG
svg = os.path.join(
svgSymbolsPath(), 'backgrounds', 'background_square.svg')
self.lyr.shapeSVGFile = svg
self.lyr.shapeSizeUnits = QgsPalLayerSettings.MapUnits
self.lyr.shapeSizeType = QgsPalLayerSettings.SizeBuffer
self.lyr.shapeSize = QPointF(100.0, 0.0)

self.lyr.shapeOffsetUnits = QgsPalLayerSettings.MapUnits
self.lyr.shapeOffset = QPointF(-2850.0, 500.0 )
self.checkTest()

def test_partials_labels_enabled(self):
# Set Big font size
font = QFont(self._TestFont)
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 0a9b857

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