diff options
Diffstat (limited to 'tests/auto/gui/text/qtextformat/tst_qtextformat.cpp')
-rw-r--r-- | tests/auto/gui/text/qtextformat/tst_qtextformat.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp index 096ea2dade..166b5d7c82 100644 --- a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp +++ b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp @@ -63,6 +63,8 @@ private slots: void testUnderlinePropertyPrecedence(); void toFormat(); void resolveFont(); + void testLetterSpacing(); + void testFontStretch(); void getSetTabs(); void testTabsUsed(); void testFontStyleSetters(); @@ -277,6 +279,41 @@ void tst_QTextFormat::resolveFont() QVERIFY(fmt.font().strikeOut()); } + +void tst_QTextFormat::testLetterSpacing() +{ + QTextCharFormat format; + + QCOMPARE(format.hasProperty(QTextFormat::FontLetterSpacing), false); + QCOMPARE(format.hasProperty(QTextFormat::FontAbsoluteLetterSpacing), false); + + format.setFontAbsoluteLetterSpacing(10.0); + + QCOMPARE(format.hasProperty(QTextFormat::FontLetterSpacing), false); + QCOMPARE(format.property(QTextFormat::FontAbsoluteLetterSpacing).toDouble(), 10.0); + + format.setFontLetterSpacing(110.0); + + QCOMPARE(format.property(QTextFormat::FontLetterSpacing).toDouble(), 110.0); + QCOMPARE(format.hasProperty(QTextFormat::FontAbsoluteLetterSpacing), false); + + format.setFontAbsoluteLetterSpacing(10.0); + + QCOMPARE(format.hasProperty(QTextFormat::FontLetterSpacing), false); + QCOMPARE(format.property(QTextFormat::FontAbsoluteLetterSpacing).toDouble(), 10.0); +} + +void tst_QTextFormat::testFontStretch() +{ + QTextCharFormat format; + + QCOMPARE(format.hasProperty(QTextFormat::FontStretch), false); + + format.setFontStretch(130.0); + + QCOMPARE(format.property(QTextFormat::FontStretch).toInt(), 130); +} + void tst_QTextFormat::getSetTabs() { class Comparator { |