diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-09-10 09:04:49 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-09-10 09:29:45 (GMT) |
commit | 5768bab92310ee553822de8a752f94b9137b23df (patch) | |
tree | b7c11c68abe7b2bb1d90553f17fa7350fa2accac /tests/auto/qstatictext | |
parent | 21a4c8f7f9ace18514f1d9fa9e203beaf6bd2844 (diff) | |
download | Qt-5768bab92310ee553822de8a752f94b9137b23df.zip Qt-5768bab92310ee553822de8a752f94b9137b23df.tar.gz Qt-5768bab92310ee553822de8a752f94b9137b23df.tar.bz2 |
Fix crash when using unprintable chars in QStaticText
The assumption that the output glyph array and input glyph array is
of equal size is wrong when unprintable characters are used (and
discarded in getGlyphPositions())
Task-number: QTBUG-12614
Reviewed-by: Jiang Jiang
Diffstat (limited to 'tests/auto/qstatictext')
-rw-r--r-- | tests/auto/qstatictext/tst_qstatictext.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index 2a60e9e..68c3ea9 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -91,6 +91,8 @@ private slots: void drawStruckOutText(); void drawOverlinedText(); void drawUnderlinedText(); + + void unprintableCharacter_qtbug12614(); }; void tst_QStaticText::init() @@ -753,5 +755,14 @@ void tst_QStaticText::drawUnderlinedText() QCOMPARE(imageDrawText, imageDrawStaticText); } +void tst_QStaticText::unprintableCharacter_qtbug12614() +{ + QString s(QChar(0x200B)); // U+200B, ZERO WIDTH SPACE + + QStaticText staticText(s); + + QVERIFY(staticText.size().isValid()); // Force layout. Should not crash. +} + QTEST_MAIN(tst_QStaticText) #include "tst_qstatictext.moc" |