def test_background_svg_w_offset(self): # Label SVG background format = self.lyr.format() format.setSizeUnit(QgsUnitTypes.RenderMapUnits) format.setSize(460) font = QFont(self._TestFont) format.setFont(font) format.background().setEnabled(True) format.background().setType(QgsTextBackgroundSettings.ShapeSVG) svg = os.path.join( svgSymbolsPath(), 'backgrounds', 'background_square.svg') format.background().setSvgFile(svg) format.background().setSizeUnit(QgsUnitTypes.RenderMapUnits) format.background().setSizeType(QgsTextBackgroundSettings.SizeBuffer) format.background().setSize(QSizeF(100.0, 0.0)) format.background().setOffsetUnit(QgsUnitTypes.RenderMapUnits) format.background().setOffset(QPointF(-2850.0, 500.0)) self.lyr.setFormat(format) self._Mismatches['TestComposerPdfVsComposerPoint'] = 760 self._Mismatches['TestCanvasPoint'] = 776 self._ColorTols['TestComposerPdfPoint'] = 2 self.checkTest()
def test_background_svg(self): # Label SVG background 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._Mismatches["TestComposerPdfVsComposerPoint"] = 580 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 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_background_svg(self): # Label SVG background format = self.lyr.format() format.setSizeUnit(QgsUnitTypes.RenderMapUnits) format.setSize(460) font = QFont(self._TestFont) format.setFont(font) format.background().setEnabled(True) format.background().setType(QgsTextBackgroundSettings.ShapeSVG) svg = os.path.join(svgSymbolsPath(), 'backgrounds', 'background_square.svg') format.background().setSvgFile(svg) format.background().setSizeUnit(QgsUnitTypes.RenderMapUnits) format.background().setSizeType(QgsTextBackgroundSettings.SizeBuffer) format.background().setSize(QSizeF(100.0, 0.0)) self.lyr.setFormat(format) self._Mismatches['TestComposerPdfVsComposerPoint'] = 580 self._Mismatches['TestCanvasPoint'] = 776 self._ColorTols['TestComposerPdfPoint'] = 2 self.checkTest()
def test_background_svg_w_offset(self): # Label SVG background 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._Mismatches['TestComposerPdfVsComposerPoint'] = 760 self._Mismatches['TestCanvasPoint'] = 776 self._ColorTols['TestComposerPdfPoint'] = 2 self.checkTest()