summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-11-03 15:09:09 +0100
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-11-03 15:38:02 +0100
commit9bd330756bc8e0fac9919da0b1068096ee91cb24 (patch)
treed258725a5659e196eb38b780e957059020157a0a /tests/auto
parenta3b84f683e0baae34dc37c85a40dcae3e5306419 (diff)
Pressing return in a QWizard would erase the active password entry.
When echo mode was set to PasswordEchoOnEdit in a QLineEdit, and its text selected, pressing the return key would erase the text and start editing it instead of validating the password. Auto-test included. Reviewed-by: Olivier Task-number: QTBUG-4401
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index c6769596f8..b4dfbbad47 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -260,6 +260,7 @@ private slots:
void task233101_cursorPosAfterInputMethod();
void task241436_passwordEchoOnEditRestoreEchoMode();
void task248948_redoRemovedSelection();
+ void taskQTBUG_4401_enterKeyClearsPassword();
protected slots:
#ifdef QT3_SUPPORT
@@ -3532,5 +3533,20 @@ void tst_QLineEdit::task248948_redoRemovedSelection()
QCOMPARE(testWidget->text(), QLatin1String("ab"));
}
+void tst_QLineEdit::taskQTBUG_4401_enterKeyClearsPassword()
+{
+ QString password("Wanna guess?");
+
+ testWidget->setText(password);
+ testWidget->setEchoMode(QLineEdit::PasswordEchoOnEdit);
+ testWidget->setFocus();
+ testWidget->selectAll();
+ QApplication::setActiveWindow(testWidget);
+ QTRY_VERIFY(testWidget->hasFocus());
+
+ QTest::keyPress(testWidget, Qt::Key_Enter);
+ QTRY_COMPARE(testWidget->text(), password);
+}
+
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"