diff options
Diffstat (limited to 'tests/auto/qlineedit/tst_qlineedit.cpp')
-rw-r--r-- | tests/auto/qlineedit/tst_qlineedit.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index fcca58a..2be68e6 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(); #ifndef QT_NO_CONTEXTMENU void taskQTBUG_7902_contextMenuCrash(); #endif @@ -3457,10 +3458,8 @@ void tst_QLineEdit::task210502_caseInsensitiveInlineCompletion() completer.setCompletionMode(QCompleter::InlineCompletion); lineEdit.setCompleter(&completer); lineEdit.show(); -#ifdef Q_WS_X11 - // to be safe and avoid failing setFocus with window managers - qt_x11_wait_for_window_manager(&lineEdit); -#endif + QTest::qWaitForWindowShown(&lineEdit); + QApplication::setActiveWindow(&lineEdit); lineEdit.setFocus(); QTRY_VERIFY(lineEdit.hasFocus()); QTest::keyPress(&lineEdit, 'a'); @@ -3641,6 +3640,27 @@ 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(); + QTest::qWaitForWindowShown(&le); + QApplication::setActiveWindow(&le); + le.setFocus(); + QTRY_VERIFY(le.hasFocus()); + + QTest::keyClick(0, Qt::Key_P); + QCOMPARE(spy.count(), 1); +} + #ifndef QT_NO_CONTEXTMENU void tst_QLineEdit::taskQTBUG_7902_contextMenuCrash() { |