[autotests] Add test case for touch down triggers a mouse action

This commit is contained in:
Martin Gräßlin 2016-02-18 09:57:18 +01:00
parent 2a98c681d0
commit f1e3c9f191

View file

@ -49,6 +49,7 @@ private Q_SLOTS:
void cleanup();
void testMultipleTouchPoints();
void testCancel();
void testTouchMouseAction();
private:
AbstractClient *showWindow();
@ -288,6 +289,34 @@ void TouchInputTest::testCancel()
QCOMPARE(pointRemovedSpy.count(), 0);
}
void TouchInputTest::testTouchMouseAction()
{
// this test verifies that a touch down on an inactive client will activate it
using namespace KWayland::Client;
// create two windows
AbstractClient *c1 = showWindow();
QVERIFY(c1);
AbstractClient *c2 = showWindow();
QVERIFY(c2);
QVERIFY(!c1->isActive());
QVERIFY(c2->isActive());
// also create a sequence started spy as the touch event should be passed through
QSignalSpy sequenceStartedSpy(m_touch, &Touch::sequenceStarted);
QVERIFY(sequenceStartedSpy.isValid());
quint32 timestamp = 1;
waylandServer()->backend()->touchDown(1, c1->geometry().center(), timestamp++);
QVERIFY(c1->isActive());
QVERIFY(sequenceStartedSpy.wait());
QCOMPARE(sequenceStartedSpy.count(), 1);
// cleanup
waylandServer()->backend()->touchCancel();
}
}
WAYLANDTEST_MAIN(KWin::TouchInputTest)