diff options
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" |