diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2010-11-02 11:36:27 (GMT) |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2010-11-15 12:55:43 (GMT) |
commit | e084fbbe18d771702312d7db65030aaaf18b596b (patch) | |
tree | 537c81578ae773c7c05d7a09b82e376c0015a3bf /tests/auto/qcomplextext | |
parent | 0b338187627f874ff27b452fcd67e285cee128c3 (diff) | |
download | Qt-e084fbbe18d771702312d7db65030aaaf18b596b.zip Qt-e084fbbe18d771702312d7db65030aaaf18b596b.tar.gz Qt-e084fbbe18d771702312d7db65030aaaf18b596b.tar.bz2 |
Fix cursor position of one digit after RTL text
A single digit after RTL text will be considered as RTL because it
was treated as Other Neutral (DirON), it can be solved by changing
it to DirAN.
Task-number: QTBUG-2795
Reviewed-by: Lars Knoll
Diffstat (limited to 'tests/auto/qcomplextext')
-rw-r--r-- | tests/auto/qcomplextext/tst_qcomplextext.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qcomplextext/tst_qcomplextext.cpp b/tests/auto/qcomplextext/tst_qcomplextext.cpp index 4a96725..fa8a2d1 100644 --- a/tests/auto/qcomplextext/tst_qcomplextext.cpp +++ b/tests/auto/qcomplextext/tst_qcomplextext.cpp @@ -68,6 +68,7 @@ public slots: private slots: void bidiReorderString_data(); void bidiReorderString(); + void bidiCursor_qtbug2795(); }; tst_QComplexText::tst_QComplexText() @@ -159,6 +160,28 @@ void tst_QComplexText::bidiReorderString() QTEST(visual, "VISUAL"); } +void tst_QComplexText::bidiCursor_qtbug2795() +{ + QString str = QString::fromUtf8("الجزيرة نت"); + QTextLayout l1(str); + + l1.beginLayout(); + QTextLine line1 = l1.createLine(); + l1.endLayout(); + + qreal x1 = line1.cursorToX(0) - line1.cursorToX(str.size()); + + str.append("1"); + QTextLayout l2(str); + l2.beginLayout(); + QTextLine line2 = l2.createLine(); + l2.endLayout(); + + qreal x2 = line2.cursorToX(0) - line2.cursorToX(str.size()); + + // The cursor should remain at the same position after a digit is appended + QVERIFY(x1 == x2); +} QTEST_MAIN(tst_QComplexText) #include "tst_qcomplextext.moc" |