summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qtextlayout
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-09-13 17:35:08 +0200
committerQt by Nokia <qt-info@nokia.com>2011-11-04 01:54:33 +0100
commitc30ebdeac028a3fe4a820cd5fe8360d11d14868d (patch)
tree80578d8757369499060d1764c0653af121606969 /tests/auto/gui/text/qtextlayout
parent75a2b9eef203b20584b4d0ac1589b4a3398afe08 (diff)
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 Change-Id: Ia0a25931f4043359f72a6c0c14a74b905e40b93e Reviewed-by: Eskil Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'tests/auto/gui/text/qtextlayout')
-rw-r--r--tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
index 17955b36f2..348547b5b8 100644
--- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
@@ -139,6 +139,7 @@ private slots:
void textWidthWithLineSeparator();
void cursorInLigatureWithMultipleLines();
void xToCursorForLigatures();
+ void cursorInNonStopChars();
private:
QFont testFont;
@@ -1472,7 +1473,7 @@ void tst_QTextLayout::textWidthWithLineSeparator()
void tst_QTextLayout::cursorInLigatureWithMultipleLines()
{
#if !defined(Q_WS_MAC)
- QSKIP("This test can not be run on Mac");
+ QSKIP("This test can only be run on Mac");
#endif
QTextLayout layout("first line finish", QFont("Times", 20));
layout.beginLayout();
@@ -1488,7 +1489,7 @@ void tst_QTextLayout::cursorInLigatureWithMultipleLines()
void tst_QTextLayout::xToCursorForLigatures()
{
#if !defined(Q_WS_MAC)
- QSKIP("This test can not be run on Mac");
+ QSKIP("This test can only be run on Mac");
#endif
QTextLayout layout("fi", QFont("Times", 20));
layout.beginLayout();
@@ -1509,5 +1510,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("\xE0\xA4\xA4\xE0\xA5\x8D\xE0\xA4\xA8"));
+ 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"