Navigation Menu

Skip to content

Commit

Permalink
Add small caps tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 8, 2021
1 parent 5875253 commit 00554ef
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions tests/src/python/test_qgstextrenderer.py
Expand Up @@ -14,10 +14,11 @@

import qgis # NOQA
from PyQt5.QtSvg import QSvgGenerator
from qgis.PyQt.QtCore import (Qt, QSizeF, QPointF, QRectF, QDir, QSize)
from qgis.PyQt.QtCore import (Qt, QT_VERSION_STR, QSizeF, QPointF, QRectF, QDir, QSize)
from qgis.PyQt.QtGui import (QColor, QPainter, QFont, QImage, QBrush, QPen)
from qgis.PyQt.QtXml import QDomDocument
from qgis.core import (QgsTextBufferSettings,
from qgis.core import (Qgis,
QgsTextBufferSettings,
QgsTextMaskSettings,
QgsTextBackgroundSettings,
QgsTextShadowSettings,
Expand Down Expand Up @@ -1506,6 +1507,24 @@ def checkRenderPoint(self, format, name, part=None, angle=0, alignment=QgsTextRe
painter.end()
return self.imageCheck(name, name, image)

@unittest.skipIf(int(QT_VERSION_STR.split('.')[0]) < 6 or (int(QT_VERSION_STR.split('.')[0]) == 6 and int(QT_VERSION_STR.split('.')[1]) < 3), 'Too old Qt')
def testDrawSmallCaps(self):
format = QgsTextFormat()
format.setFont(getTestFont('bold'))
format.setCapitalization(Qgis.Capitalization.SmallCaps)
format.setSize(30)
assert self.checkRender(format, 'mixed_small_caps', text=['Small Caps'])
assert False

@unittest.skipIf(int(QT_VERSION_STR.split('.')[0]) < 6 or (int(QT_VERSION_STR.split('.')[0]) == 6 and int(QT_VERSION_STR.split('.')[1]) < 3), 'Too old Qt')
def testDrawAllSmallCaps(self):
format = QgsTextFormat()
format.setFont(getTestFont('bold'))
format.setSize(30)
format.setCapitalization(Qgis.Capitalization.AllSmallCaps)
assert self.checkRender(format, 'all_small_caps', text=['Small Caps'])
assert False

def testDrawBackgroundDisabled(self):
format = QgsTextFormat()
format.setFont(getTestFont('bold'))
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 00554ef

Please sign in to comment.