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

Shows that currently a tripple-click triggers two double click events.
This commit is contained in:
Martin Gräßlin 2016-02-04 11:56:45 +01:00
parent 938a0ff7fc
commit 749ec28e23

View file

@ -54,6 +54,7 @@ private Q_SLOTS:
void init(); void init();
void cleanup(); void cleanup();
void testAxis(); void testAxis();
void testDoubleClick();
private: private:
AbstractClient *showWindow(); AbstractClient *showWindow();
@ -100,10 +101,10 @@ AbstractClient *DecorationInputTest::showWindow()
VERIFY(decoSpy.wait()); VERIFY(decoSpy.wait());
COMPARE(deco->mode(), ServerSideDecoration::Mode::Server); COMPARE(deco->mode(), ServerSideDecoration::Mode::Server);
// let's render // let's render
QImage img(QSize(100, 50), QImage::Format_ARGB32); QImage img(QSize(500, 50), QImage::Format_ARGB32);
img.fill(Qt::blue); img.fill(Qt::blue);
surface->attachBuffer(m_shm->createBuffer(img)); 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); surface->commit(Surface::CommitFlag::None);
m_connection->flush(); m_connection->flush();
@ -131,6 +132,8 @@ void DecorationInputTest::initTestCase()
// change some options // change some options
KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
config->group(QStringLiteral("MouseBindings")).writeEntry("CommandTitlebarWheel", QStringLiteral("above/below")); 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(); config->sync();
kwinApp()->setConfig(config); kwinApp()->setConfig(config);
@ -257,6 +260,33 @@ void DecorationInputTest::testAxis()
QVERIFY(c->keepAbove()); 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) WAYLANTEST_MAIN(KWin::DecorationInputTest)