diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-11-03 14:09:09 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-11-03 14:38:02 (GMT) |
commit | 9bd330756bc8e0fac9919da0b1068096ee91cb24 (patch) | |
tree | d258725a5659e196eb38b780e957059020157a0a /tests/auto/qlineedit | |
parent | a3b84f683e0baae34dc37c85a40dcae3e5306419 (diff) | |
download | Qt-9bd330756bc8e0fac9919da0b1068096ee91cb24.zip Qt-9bd330756bc8e0fac9919da0b1068096ee91cb24.tar.gz Qt-9bd330756bc8e0fac9919da0b1068096ee91cb24.tar.bz2 |
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/qlineedit')
-rw-r--r-- | tests/auto/qlineedit/tst_qlineedit.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index c676959..b4dfbba 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" |