on xenial help sign in
add a test
commit4b2a4637a966c44bad466098c1938a6d2d6c0539 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 21 Feb 2017, 18:45 (10 years ago) parent6cb6025
2 files changed+37−3
plugins/Utils/WindowInputMonitor.cpp+3−3 tests/plugins/Utils/WindowInputMonitorTest.cpp+34
plugins/Utils/WindowInputMonitor.cpp+3−3
@@ -73,9 +73,9 @@ void WindowInputMonitor::update(QEvent *event)
7373 && m_windowLastTouchedTimer->elapsed() >= msecsWithoutTouches) {
7474 m_pressedHomeKey = keyEvent->key();
7575 m_activationTimer->start();
76− } else if (m_pressedHomeKey != 0) {
77− // something else came in... cancel activation
78− m_activationTimer->stop();
76+// } else if (m_pressedHomeKey != 0 && !m_homeKeys.contains(keyEvent->key())) {
77+// // something else came in... cancel activation
78+// m_activationTimer->stop();
7979 }
8080
8181 } else if (event->type() == QEvent::KeyRelease) {
tests/plugins/Utils/WindowInputMonitorTest.cpp+34
@@ -89,6 +89,8 @@ private Q_SLOTS:
8989 void tapWhileTouching();
9090 void multipleHomeKeys();
9191
92+ void keyComboInvolvingHome();
93+
9294 void repeatedSuperPress();
9395
9496private:
@@ -197,6 +199,38 @@ void WindowInputMonitorTest::touchTapTouch()
197199 QCOMPARE(activatedSpy.count(), expectedActivatedCount);
198200}
199201
202+void WindowInputMonitorTest::keyComboInvolvingHome()
203+{
204+ WindowInputMonitor homeKeyWatcher(m_fakeTimerFactory->create(this), new FakeElapsedTimer);
205+ QSignalSpy activatedSpy(&homeKeyWatcher, &WindowInputMonitor::homeKeyActivated);
206+ QVERIFY(activatedSpy.isValid());
207+
208+ passTime(1000);
209+ {
210+ QKeyEvent keyEvent(QEvent::KeyPress, Qt::Key_Super_L, Qt::NoModifier);
211+ homeKeyWatcher.update(&keyEvent);
212+ }
213+ passTime(100);
214+
215+ {
216+ QKeyEvent keyEvent(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier);
217+ homeKeyWatcher.update(&keyEvent);
218+ }
219+ passTime(100);
220+ {
221+ QKeyEvent keyEvent(QEvent::KeyRelease, Qt::Key_A, Qt::NoModifier);
222+ homeKeyWatcher.update(&keyEvent);
223+ }
224+ passTime(100);
225+ {
226+ QKeyEvent keyEvent(QEvent::KeyRelease, Qt::Key_Super_L, Qt::NoModifier);
227+ homeKeyWatcher.update(&keyEvent);
228+ }
229+ passTime(1000);
230+
231+ QCOMPARE(activatedSpy.count(), 0);
232+}
233+
200234void WindowInputMonitorTest::tapWhileTouching()
201235{
202236 WindowInputMonitor homeKeyWatcher(m_fakeTimerFactory->create(this), new FakeElapsedTimer);