def testSvgAnnotation(self): """ test rendering a svg annotation""" a = QgsSvgAnnotation() a.setFrameSize(QSizeF(300, 200)) a.setFrameOffsetFromReferencePoint(QPointF(40, 50)) svg = TEST_DATA_DIR + "/sample_svg.svg" a.setFilePath(svg) im = self.renderAnnotation(a, QPointF(20, 30)) self.assertTrue(self.imageCheck('svg_annotation', 'svg_annotation', im))
def testSvgAnnotationInLayout(self): """ test rendering a svg annotation""" a = QgsSvgAnnotation() a.fillSymbol().symbolLayer(0).setStrokeColor(QColor(0, 0, 0)) a.markerSymbol().symbolLayer(0).setStrokeColor(QColor(0, 0, 0)) a.setFrameSizeMm(QSizeF(300 / 3.7795275, 200 / 3.7795275)) a.setFrameOffsetFromReferencePointMm( QPointF(40 / 3.7795275, 50 / 3.7795275)) svg = TEST_DATA_DIR + "/sample_svg.svg" a.setFilePath(svg) self.assertTrue( self.renderAnnotationInLayout('svg_annotation_in_layout', a))
def testSvgAnnotation(self): """ test rendering a svg annotation""" a = QgsSvgAnnotation() a.fillSymbol().symbolLayer(0).setStrokeColor(QColor(0, 0, 0)) a.markerSymbol().symbolLayer(0).setStrokeColor(QColor(0, 0, 0)) a.setFrameSize(QSizeF(300, 200)) a.setFrameOffsetFromReferencePoint(QPointF(40, 50)) svg = TEST_DATA_DIR + "/sample_svg.svg" a.setFilePath(svg) im = self.renderAnnotation(a, QPointF(20, 30)) self.assertTrue(self.imageCheck('svg_annotation', 'svg_annotation', im)) # check clone clone = a.clone() im = self.renderAnnotation(a, QPointF(20, 30)) self.assertTrue(self.imageCheck('svg_annotation', 'svg_annotation', im))