diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-29 15:33:44 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-29 15:33:44 (GMT) |
commit | 564d2a31a1fd7dfff9a4f6cc2ae814d9307e88a9 (patch) | |
tree | 6e35b7c0091c5cc7514b8740cfaf90234a48bbca /tests | |
parent | 6469ed030a0edbb08b7856c9292fcceb155dff86 (diff) | |
parent | f8560717dd56514269cfb081c7f4b94e231e10d7 (diff) | |
download | Qt-564d2a31a1fd7dfff9a4f6cc2ae814d9307e88a9.zip Qt-564d2a31a1fd7dfff9a4f6cc2ae814d9307e88a9.tar.gz Qt-564d2a31a1fd7dfff9a4f6cc2ae814d9307e88a9.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Fix text color in some cases of QML and QStaticText
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qstatictext/tst_qstatictext.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index b6f06d3..66a2dd4 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -93,6 +93,9 @@ private slots: void drawUnderlinedText(); void unprintableCharacter_qtbug12614(); + + void underlinedColor_qtbug20159(); + void textDocumentColor(); }; void tst_QStaticText::init() @@ -764,5 +767,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" |