Skip to content

Commit

Permalink
Add test for buffer blend mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 21, 2024
1 parent 75d4367 commit 06daa6e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/src/python/test_qgstextrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3169,6 +3169,25 @@ def testDrawTextWithBuffer(self):
format.buffer().setSizeUnit(QgsUnitTypes.RenderUnit.RenderMillimeters)
self.assertTrue(self.checkRender(format, 'text_with_buffer', text=['test'], rect=QRectF(100, 100, 200, 100)))

def testDrawTextWithBufferBlendMode(self):
format = QgsTextFormat()
format.setFont(getTestFont('bold'))
format.setSize(60)
format.setSizeUnit(QgsUnitTypes.RenderUnit.RenderPoints)
format.background().setEnabled(True)
format.background().setType(QgsTextBackgroundSettings.ShapeType.ShapeRectangle)
format.background().setSize(QSizeF(20, 10))
format.background().setSizeType(QgsTextBackgroundSettings.SizeType.SizeFixed)
format.background().setSizeUnit(QgsUnitTypes.RenderUnit.RenderMapUnits)
format.background().setFillColor(QColor(200, 100, 150))
format.buffer().setEnabled(True)
format.buffer().setSize(4)
format.buffer().setColor(QColor(100, 255, 100))
format.buffer().setSizeUnit(QgsUnitTypes.RenderUnit.RenderMillimeters)
format.buffer().setBlendMode(QPainter.CompositionMode.CompositionMode_Multiply)
self.assertTrue(self.checkRender(format, 'text_with_buffer_blend_mode', text=['test'],
rect=QRectF(100, 100, 200, 100)))

def testDrawTextWithBackground(self):
format = QgsTextFormat()
format.setFont(getTestFont('bold'))
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 06daa6e

Please sign in to comment.