[autotests] Add test case for double click on window decoration

Shows that currently a tripple-click triggers two double click events.
icc-effect-5.14.5
Martin Gräßlin 2016-02-04 11:56:45 +01:00
parent 938a0ff7fc
commit 749ec28e23
1 changed files with 32 additions and 2 deletions

View File

@ -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)