summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qtextformat
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2017-12-21 08:30:34 +0100
committerKonstantin Ritt <ritt.ks@gmail.com>2017-12-22 05:37:55 +0000
commit67b1fa48bea4fcb8c304f1571a9431414b8dfa2f (patch)
treed934c599326d45132e6ad319eeace4ccb403f080 /tests/auto/gui/text/qtextformat
parentca47afbfaa3bccf91cab9296450940e0227c2866 (diff)
Update font when text format's letter spacing type is changed
The QTextFormat::FontLetterSpacingType property was added outside the span of the FirstFontProperty and LastFontProperty, so the fontDirty flag would not be set when it was changed. There is no binary compatible way to fix this before Qt 6, so for now, we add a special case for it. [ChangeLog][QtGui][Text] Fixed an issue where changing the letter spacing type of a QTextCharFormat would not cause its font to update. Task-number: QTBUG-65345 Change-Id: I5ab53d7f82d529b57edceacfc3fa688c6741cd17 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: C. Boemann <cbo@boemann.dk> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/gui/text/qtextformat')
-rw-r--r--tests/auto/gui/text/qtextformat/tst_qtextformat.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp
index b8afd6a447..4ab80bdcfe 100644
--- a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp
+++ b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp
@@ -283,20 +283,29 @@ void tst_QTextFormat::testLetterSpacing()
QCOMPARE(format.hasProperty(QTextFormat::FontLetterSpacingType), false);
format.setFontLetterSpacingType(QFont::AbsoluteSpacing);
+ QCOMPARE(format.font().letterSpacingType(), QFont::AbsoluteSpacing);
+
format.setFontLetterSpacing(10.0);
+ QCOMPARE(format.font().letterSpacing(), 10.0);
QCOMPARE(format.hasProperty(QTextFormat::FontLetterSpacing), true);
QCOMPARE(format.property(QTextFormat::FontLetterSpacing).toDouble(), 10.0);
QCOMPARE(format.property(QTextFormat::FontLetterSpacingType).toInt(), int(QFont::AbsoluteSpacing));
format.setFontLetterSpacingType(QFont::PercentageSpacing);
+ QCOMPARE(format.font().letterSpacingType(), QFont::PercentageSpacing);
+
format.setFontLetterSpacing(110.0);
+ QCOMPARE(format.font().letterSpacing(), 110.0);
QCOMPARE(format.property(QTextFormat::FontLetterSpacing).toDouble(), 110.0);
QCOMPARE(format.property(QTextFormat::FontLetterSpacingType).toInt(), int(QFont::PercentageSpacing));
format.setFontLetterSpacingType(QFont::AbsoluteSpacing);
+ QCOMPARE(format.font().letterSpacingType(), QFont::AbsoluteSpacing);
+
format.setFontLetterSpacing(10.0);
+ QCOMPARE(format.font().letterSpacing(), 10.0);
QCOMPARE(format.property(QTextFormat::FontLetterSpacingType).toInt(), int(QFont::AbsoluteSpacing));
QCOMPARE(format.property(QTextFormat::FontLetterSpacing).toDouble(), 10.0);