diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2011-01-14 13:14:33 (GMT) |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2011-01-14 13:55:43 (GMT) |
commit | 90046a56e8dbf1ee3931ce0caeb606a6f7d2dc45 (patch) | |
tree | 0d821f9b05b990f7becb059e6b74968cf85dbc27 /tests | |
parent | 099f9a6c56fb82e5df188f401aa3619fec0722ff (diff) | |
download | Qt-90046a56e8dbf1ee3931ce0caeb606a6f7d2dc45.zip Qt-90046a56e8dbf1ee3931ce0caeb606a6f7d2dc45.tar.gz Qt-90046a56e8dbf1ee3931ce0caeb606a6f7d2dc45.tar.bz2 |
Fix out of bounds handling in Mac shaper
After ensure space, local QGlyphLayout variable should be updated to
the moved address.
stringToCMap returns true for success, so stringToCMapFailed should
be the reverse of the return value.
Out of bounds happened quite often in all situations using the
QStackedTextEngine, because the memory allocated at the first time
is usually not much, making it easier to trigger out of bounds in
shaping. But it can also happen when using normal QTextLayout.
Test it by comparing the width returned by normal QTextLayout and
the width returned by QTextLayout created from QStackedTextEngine
via QFontMetricsF.
Task-number: QTBUG-16648
Reviewed-by: Eskil
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qtextlayout/tst_qtextlayout.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index d6cf54c..0f1ff66 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -123,7 +123,7 @@ private slots: void testLineBreakingAllSpaces(); void lineWidthFromBOM(); void textWidthVsWIdth(); - + void textWidthWithStackedTextEngine(); private: QFont testFont; @@ -1388,6 +1388,16 @@ void tst_QTextLayout::textWidthVsWIdth() } } +void tst_QTextLayout::textWidthWithStackedTextEngine() +{ + QString text = QString::fromUtf8("คลิก ถัดไป เพื่อดำเนินการต่อ"); + QTextLayout layout(text); + layout.beginLayout(); + QTextLine line = layout.createLine(); + layout.endLayout(); + QFontMetricsF fm(layout.font()); + QCOMPARE(line.naturalTextWidth(), fm.width(text)); +} QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" |