def testTextAnnotationInLayout(self): """ test rendering a text annotation""" a = QgsTextAnnotation() 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)) doc = QTextDocument() doc.setHtml('<p style="font-family: arial; font-weight: bold; font-size: 40px;">test annotation</p>') a.setDocument(doc) self.assertTrue(self.renderAnnotationInLayout('text_annotation_in_layout', a))
def testTextAnnotation(self): """ test rendering a text annotation""" a = QgsTextAnnotation() 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)) doc = QTextDocument() doc.setHtml('<p style="font-family: arial; font-weight: bold; font-size: 40px;">test annotation</p>') a.setDocument(doc) im = self.renderAnnotation(a, QPointF(20, 30)) self.assertTrue(self.imageCheck('text_annotation', 'text_annotation', im)) # check clone clone = a.clone() im = self.renderAnnotation(a, QPointF(20, 30)) self.assertTrue(self.imageCheck('text_annotation', 'text_annotation', im))