summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@nokia.com>2011-07-01 07:00:13 (GMT)
committerLiang Qi <liang.qi@nokia.com>2011-07-01 07:00:13 (GMT)
commit3dc0c38389670d6adddd972c532af98dd6b5deb5 (patch)
tree779945938b51cc6290bc6dcee1cb34f696f42242 /tests
parent73f0d9534b593c65e4facf9a975e2c2e63608f03 (diff)
parentf5feea56fc7202ab64a1b9c5f9b05391c2b88238 (diff)
downloadQt-3dc0c38389670d6adddd972c532af98dd6b5deb5.zip
Qt-3dc0c38389670d6adddd972c532af98dd6b5deb5.tar.gz
Qt-3dc0c38389670d6adddd972c532af98dd6b5deb5.tar.bz2
Merge remote-tracking branch 'origin/4.7' into qt-4.8-from-4.7
Conflicts: src/s60installs/s60installs.pro
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qstatictext/tst_qstatictext.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp
index e14c9db..704f19b 100644
--- a/tests/auto/qstatictext/tst_qstatictext.cpp
+++ b/tests/auto/qstatictext/tst_qstatictext.cpp
@@ -96,6 +96,9 @@ private slots:
void drawUnderlinedText();
void unprintableCharacter_qtbug12614();
+
+ void underlinedColor_qtbug20159();
+ void textDocumentColor();
};
void tst_QStaticText::init()
@@ -783,5 +786,42 @@ void tst_QStaticText::unprintableCharacter_qtbug12614()
QVERIFY(staticText.size().isValid()); // Force layout. Should not crash.
}
+void tst_QStaticText::underlinedColor_qtbug20159()
+{
+ QString multiScriptText;
+ multiScriptText += QChar(0x0410); // Cyrillic 'A'
+ multiScriptText += QLatin1Char('A');
+
+ QStaticText staticText(multiScriptText);
+
+ QFont font;
+ font.setUnderline(true);
+
+ staticText.prepare(QTransform(), font);
+
+ QStaticTextPrivate *d = QStaticTextPrivate::get(&staticText);
+ QCOMPARE(d->itemCount, 2);
+
+ // The pen should not be marked as dirty when drawing the underline
+ QVERIFY(!d->items[0].color.isValid());
+ QVERIFY(!d->items[1].color.isValid());
+}
+
+void tst_QStaticText::textDocumentColor()
+{
+ QStaticText staticText("A<font color=\"red\">B</font>");
+ staticText.setTextFormat(Qt::RichText);
+ staticText.prepare();
+
+ QStaticTextPrivate *d = QStaticTextPrivate::get(&staticText);
+ QCOMPARE(d->itemCount, 2);
+
+ // The pen should not be marked as dirty when drawing the underline
+ QVERIFY(!d->items[0].color.isValid());
+ QVERIFY(d->items[1].color.isValid());
+
+ QCOMPARE(d->items[1].color, QColor(Qt::red));
+}
+
QTEST_MAIN(tst_QStaticText)
#include "tst_qstatictext.moc"