summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtextlayout
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-01-14 14:14:33 +0100
committerJiang Jiang <jiang.jiang@nokia.com>2011-01-14 14:55:43 +0100
commit90046a56e8dbf1ee3931ce0caeb606a6f7d2dc45 (patch)
tree0d821f9b05b990f7becb059e6b74968cf85dbc27 /tests/auto/qtextlayout
parent099f9a6c56fb82e5df188f401aa3619fec0722ff (diff)
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/auto/qtextlayout')
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index d6cf54c22a..0f1ff66259 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"