summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlineedit/tst_qlineedit.cpp
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-07-25 16:28:07 +1000
committerQt by Nokia <qt-info@nokia.com>2011-07-26 01:35:40 +0200
commitef2384ad57c7e7ea40937cced6e6210fd371a978 (patch)
tree678c6c1234db7feda2dc2476d6ab930fb16ce5e7 /tests/auto/qlineedit/tst_qlineedit.cpp
parentf7acedb0887fe0980a325303cd86f54d70eabead (diff)
Update cursor position when selection is reversed.
A reversed selection will have the same resolved start and end positions but a different cursor position so testing the end points alone doesn't guarantee the selection is the same. Task-number: QTBUG-19456 Reviewed-by: Martin Jones Change-Id: I516e5a501ec878d673f21e54d688fd2d21b624ef Reviewed-on: http://codereview.qt.nokia.com/2080 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Diffstat (limited to 'tests/auto/qlineedit/tst_qlineedit.cpp')
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index d178e26476..72b402f69d 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -289,6 +289,8 @@ private slots:
void bidiLogicalMovement_data();
void bidiLogicalMovement();
+ void selectAndCursorPosition();
+
protected slots:
void editingFinished();
@@ -3871,5 +3873,15 @@ void tst_QLineEdit::bidiLogicalMovement()
} while (moved && i >= 0);
}
+void tst_QLineEdit::selectAndCursorPosition()
+{
+ testWidget->setText("This is a long piece of text");
+
+ testWidget->setSelection(0, 5);
+ QCOMPARE(testWidget->cursorPosition(), 5);
+ testWidget->setSelection(5, -5);
+ QCOMPARE(testWidget->cursorPosition(), 0);
+}
+
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"