summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlineedit/tst_qlineedit.cpp
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2009-03-27 10:51:40 (GMT)
committerjasplin <qt-info@nokia.com>2009-03-27 10:59:36 (GMT)
commitf9796f295e3fa42e4855f386b5663b1c2b957d10 (patch)
treeaad54733c3a3e5d603d9976e71892c638c23bdca /tests/auto/qlineedit/tst_qlineedit.cpp
parent4b3d81c629167a24424119ca4f296a85b78eab05 (diff)
downloadQt-f9796f295e3fa42e4855f386b5663b1c2b957d10.zip
Qt-f9796f295e3fa42e4855f386b5663b1c2b957d10.tar.gz
Qt-f9796f295e3fa42e4855f386b5663b1c2b957d10.tar.bz2
Clear QLineEdit selection when redoing a delete operation.
Deleting text in a QLineEdit should never leave a non-empty selection. This is now reflected properly in the redo function. Reviewed-by: janarve Task-number: 248948
Diffstat (limited to 'tests/auto/qlineedit/tst_qlineedit.cpp')
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 87e966f..8779831 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -257,6 +257,7 @@ private slots:
void task233101_cursorPosAfterInputMethod_data();
void task233101_cursorPosAfterInputMethod();
void task241436_passwordEchoOnEditRestoreEchoMode();
+ void task248948_redoRemovedSelection();
protected slots:
#ifdef QT3_SUPPORT
@@ -3487,5 +3488,17 @@ void tst_QLineEdit::task241436_passwordEchoOnEditRestoreEchoMode()
testWidget->setEchoMode(QLineEdit::Normal);
}
+void tst_QLineEdit::task248948_redoRemovedSelection()
+{
+ testWidget->setText("a");
+ testWidget->selectAll();
+ QTest::keyPress(testWidget, Qt::Key_Delete);
+ testWidget->undo();
+ testWidget->redo();
+ QTest::keyPress(testWidget, 'a');
+ QTest::keyPress(testWidget, 'b');
+ QCOMPARE(testWidget->text(), QLatin1String("ab"));
+}
+
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"