summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorC. Boemann <cbo@boemann.dk>2012-01-02 14:42:57 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-11 09:24:07 +0100
commitd060b6f04f956ab3a6358f826dc6928b3353f5f7 (patch)
tree74574afd291f73896f9b5945c375153df0d11c73 /tests/auto
parent59d5c26075724a581ed276d62d884b44d2ca4489 (diff)
Add methods for font stretch and absolute letter spacing
We basicaly just rely on the methods in QFont Change-Id: Iaf8cbf4d90d0c5b10b3a85983de7ca58763e0371 Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/gui/text/qtextformat/tst_qtextformat.cpp37
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 {