def testRelativePosition(self): """ test rendering an annotation without map point""" a = QgsHtmlAnnotation() a.setFrameSize(QSizeF(400, 250)) a.setHasFixedMapPosition(False) html = TEST_DATA_DIR + "/test_html.html" a.setSourceFile(html) im = self.renderAnnotation(a, QPointF(20, 30)) self.assertTrue(self.imageCheck('relative_style', 'relative_style', im))
def testMargins(self): """ test rendering an annotation with margins""" a = QgsHtmlAnnotation() a.setFrameSize(QSizeF(400, 250)) a.setHasFixedMapPosition(False) a.setContentsMargin(QgsMargins(15, 10, 30, 20)) html = TEST_DATA_DIR + "/test_html.html" a.setSourceFile(html) im = self.renderAnnotation(a, QPointF(20, 30)) self.assertTrue(self.imageCheck('annotation_margins', 'annotation_margins', im))
def testRelativePosition(self): """ test rendering an annotation without map point""" a = QgsHtmlAnnotation() a.fillSymbol().symbolLayer(0).setStrokeColor(QColor(0, 0, 0)) a.setFrameSizeMm(QSizeF(400 / 3.7795275, 250 / 3.7795275)) a.setHasFixedMapPosition(False) html = TEST_DATA_DIR + "/test_html.html" a.setSourceFile(html) im = self.renderAnnotation(a, QPointF(20, 30)) self.assertTrue(self.imageCheck('relative_style', 'relative_style', im))
def testMargins(self): """ test rendering an annotation with margins""" a = QgsHtmlAnnotation() a.fillSymbol().symbolLayer(0).setStrokeColor(QColor(0, 0, 0)) a.setFrameSizeMm(QSizeF(400 / 3.7795275, 250 / 3.7795275)) a.setHasFixedMapPosition(False) a.setContentsMargin(QgsMargins(15, 10, 30, 20)) html = TEST_DATA_DIR + "/test_html.html" a.setSourceFile(html) im = self.renderAnnotation(a, QPointF(20, 30)) self.assertTrue(self.imageCheck('annotation_margins', 'annotation_margins', im))
def testRelativePosition(self): """ test rendering an annotation without map point""" a = QgsHtmlAnnotation() a.fillSymbol().symbolLayer(0).setStrokeColor(QColor(0, 0, 0)) a.setFrameSize(QSizeF(400, 250)) a.setHasFixedMapPosition(False) html = TEST_DATA_DIR + "/test_html.html" a.setSourceFile(html) im = self.renderAnnotation(a, QPointF(20, 30)) self.assertTrue(self.imageCheck('relative_style', 'relative_style', im))
def testMargins(self): """ test rendering an annotation with margins""" a = QgsHtmlAnnotation() a.fillSymbol().symbolLayer(0).setStrokeColor(QColor(0, 0, 0)) a.setFrameSize(QSizeF(400, 250)) a.setHasFixedMapPosition(False) a.setContentsMargin(QgsMargins(15, 10, 30, 20)) html = TEST_DATA_DIR + "/test_html.html" a.setSourceFile(html) im = self.renderAnnotation(a, QPointF(20, 30)) self.assertTrue(self.imageCheck('annotation_margins', 'annotation_margins', im))