From 749ec28e237274579487fd0d5cae25837592c7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 4 Feb 2016 11:56:45 +0100 Subject: [PATCH] [autotests] Add test case for double click on window decoration Shows that currently a tripple-click triggers two double click events. --- autotests/wayland/decoration_input_test.cpp | 34 +++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/autotests/wayland/decoration_input_test.cpp b/autotests/wayland/decoration_input_test.cpp index 07aa3569cc..11e367e6d7 100644 --- a/autotests/wayland/decoration_input_test.cpp +++ b/autotests/wayland/decoration_input_test.cpp @@ -54,6 +54,7 @@ private Q_SLOTS: void init(); void cleanup(); void testAxis(); + void testDoubleClick(); private: AbstractClient *showWindow(); @@ -100,10 +101,10 @@ AbstractClient *DecorationInputTest::showWindow() VERIFY(decoSpy.wait()); COMPARE(deco->mode(), ServerSideDecoration::Mode::Server); // let's render - QImage img(QSize(100, 50), QImage::Format_ARGB32); + QImage img(QSize(500, 50), QImage::Format_ARGB32); img.fill(Qt::blue); surface->attachBuffer(m_shm->createBuffer(img)); - surface->damage(QRect(0, 0, 100, 50)); + surface->damage(QRect(0, 0, 500, 50)); surface->commit(Surface::CommitFlag::None); m_connection->flush(); @@ -131,6 +132,8 @@ void DecorationInputTest::initTestCase() // change some options KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); config->group(QStringLiteral("MouseBindings")).writeEntry("CommandTitlebarWheel", QStringLiteral("above/below")); + config->group(QStringLiteral("Windows")).writeEntry("TitlebarDoubleClickCommand", QStringLiteral("OnAllDesktops")); + config->group(QStringLiteral("Desktops")).writeEntry("Number", 2); config->sync(); kwinApp()->setConfig(config); @@ -257,6 +260,33 @@ void DecorationInputTest::testAxis() QVERIFY(c->keepAbove()); } +void KWin::DecorationInputTest::testDoubleClick() +{ + AbstractClient *c = showWindow(); + QVERIFY(c); + QVERIFY(c->isDecorated()); + QVERIFY(!c->noBorder()); + QVERIFY(!c->isOnAllDesktops()); + quint32 timestamp = 1; + MOTION(QPoint(c->geometry().center().x(), c->clientPos().y() / 2)); + + // double click + PRESS; + RELEASE; + PRESS; + RELEASE; + QVERIFY(c->isOnAllDesktops()); + // double click again + PRESS; + RELEASE; + QEXPECT_FAIL("", "Tripple click triggers another double click", Continue); + QVERIFY(c->isOnAllDesktops()); + PRESS; + RELEASE; + QEXPECT_FAIL("", "Tripple click triggers another double click", Continue); + QVERIFY(!c->isOnAllDesktops()); +} + } WAYLANTEST_MAIN(KWin::DecorationInputTest)