diff options
-rw-r--r-- | src/gui/text/qstatictext.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qstatictext/tst_qstatictext.cpp | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index b950b13..7a5dec4 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -448,7 +448,6 @@ namespace { currentItem.font = ti.font(); currentItem.charOffset = m_chars.size(); currentItem.numChars = ti.num_chars; - currentItem.numGlyphs = ti.glyphs.numGlyphs; currentItem.glyphOffset = m_glyphs.size(); // Store offset into glyph pool currentItem.positionOffset = m_glyphs.size(); // Offset into position pool currentItem.useBackendOptimizations = m_useBackendOptimizations; @@ -463,8 +462,8 @@ namespace { ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); int size = glyphs.size(); - Q_ASSERT(size == ti.glyphs.numGlyphs); Q_ASSERT(size == positions.size()); + currentItem.numGlyphs = size; m_glyphs.resize(m_glyphs.size() + size); m_positions.resize(m_glyphs.size()); 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" |