summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlineedit
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-02-08 13:08:29 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2010-02-08 13:11:31 (GMT)
commit95f8f814f2f77654d846660644f0e8a5c48eeb26 (patch)
tree925f1f41f6e0e86aa16ea48da02909492a36f129 /tests/auto/qlineedit
parent466ac1c7d93d3f5dea35f1a6e214907899772ae3 (diff)
downloadQt-95f8f814f2f77654d846660644f0e8a5c48eeb26.zip
Qt-95f8f814f2f77654d846660644f0e8a5c48eeb26.tar.gz
Qt-95f8f814f2f77654d846660644f0e8a5c48eeb26.tar.bz2
QLineEdit: regression: read-only line edits would eat shortcuts.
Restore Qt 4.5 behaviour. Task-number: QTBUG-7395 Reviewed-by: Thierry
Diffstat (limited to 'tests/auto/qlineedit')
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 7283916..69e7699 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -271,6 +271,7 @@ private slots:
void taskQTBUG_4401_enterKeyClearsPassword();
void taskQTBUG_4679_moveToStartEndOfBlock();
void taskQTBUG_4679_selectToStartEndOfBlock();
+ void taskQTBUG_7395_readOnlyShortcut();
protected slots:
#ifdef QT3_SUPPORT
@@ -3638,5 +3639,25 @@ void tst_QLineEdit::taskQTBUG_4679_selectToStartEndOfBlock()
#endif // Q_OS_MAC
}
+void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut()
+{
+ //ReadOnly QLineEdit should not intercept shortcut.
+ QLineEdit le;
+ le.setReadOnly(true);
+
+ QAction action(QString::fromLatin1("hello"), &le);
+ action.setShortcut(QString::fromLatin1("p"));
+ QSignalSpy spy(&action, SIGNAL(triggered()));
+ le.addAction(&action);
+
+ le.show();
+ QApplication::setActiveWindow(&le);
+ QTest::qWaitForWindowShown(&le);
+ le.setFocus();
+ QTRY_VERIFY(le.hasFocus());
+ QTest::keyClick(0, Qt::Key_P);
+ QCOMPARE(spy.count(), 1);
+}
+
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"