diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2011-09-13 15:35:08 (GMT) |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2011-09-14 11:10:46 (GMT) |
commit | 36045c4b68f7b3771d18da397590eee5ae4f3c6f (patch) | |
tree | a48d8422ad23434e1ec2186309025948e614f9fd /tests/auto/qtextlayout | |
parent | e453fce2731069dce993a94b0c2291307cc7806c (diff) | |
download | Qt-36045c4b68f7b3771d18da397590eee5ae4f3c6f.zip Qt-36045c4b68f7b3771d18da397590eee5ae4f3c6f.tar.gz Qt-36045c4b68f7b3771d18da397590eee5ae4f3c6f.tar.bz2 |
Do not put cursor at non-stop character positions
When moving cursors, non-stop positions are skipped, however certain
input sequences can still lead us there. In such cases we should
simply ignore those positions in cursorToX.
Task-number: QTBUG-7076
Reviewed-by: Eskil
Diffstat (limited to 'tests/auto/qtextlayout')
-rw-r--r-- | tests/auto/qtextlayout/tst_qtextlayout.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 2414ab3..6c989ac 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -129,6 +129,7 @@ private slots: void textWidthWithLineSeparator(); void cursorInLigatureWithMultipleLines(); void xToCursorForLigatures(); + void cursorInNonStopChars(); private: QFont testFont; @@ -1502,5 +1503,19 @@ void tst_QTextLayout::xToCursorForLigatures() line.xToCursor(width) == line.xToCursor(width / 2)); } +void tst_QTextLayout::cursorInNonStopChars() +{ +#if defined(Q_WS_MAC) + QSKIP("This test can not be run on Mac", SkipAll); +#endif + QTextLayout layout(QString::fromUtf8("\u0924\u094d\u0928")); + layout.beginLayout(); + QTextLine line = layout.createLine(); + layout.endLayout(); + + QVERIFY(line.cursorToX(1) == line.cursorToX(3)); + QVERIFY(line.cursorToX(2) == line.cursorToX(3)); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" |