Commit ee5e92fe authored by Martin Flöser's avatar Martin Flöser
Browse files

[autotests] Add test for PlasmaShellSurface::setSkipTaskbar

Test exposes that the changed signal gets emitted even if the value
did not change.
parent 19f8ca83
......@@ -46,6 +46,7 @@ private Q_SLOTS:
void testRole_data();
void testRole();
void testPosition();
void testSkipTaskbar();
void testDisconnect();
private:
......@@ -247,6 +248,41 @@ void TestPlasmaShell::testPosition()
QCOMPARE(sps->position(), QPoint(3, 4));
}
void TestPlasmaShell::testSkipTaskbar()
{
// this test verifies that sip taskbar is properly passed to server
QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated);
QVERIFY(plasmaSurfaceCreatedSpy.isValid());
QScopedPointer<Surface> s(m_compositor->createSurface());
QScopedPointer<PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.data()));
QVERIFY(plasmaSurfaceCreatedSpy.wait());
QCOMPARE(plasmaSurfaceCreatedSpy.count(), 1);
// verify that we got a plasma shell surface
auto sps = plasmaSurfaceCreatedSpy.first().first().value<PlasmaShellSurfaceInterface*>();
QVERIFY(sps);
QVERIFY(sps->surface());
QVERIFY(!sps->skipTaskbar());
// now change
QSignalSpy skipTaskbarChangedSpy(sps, &PlasmaShellSurfaceInterface::skipTaskbarChanged);
QVERIFY(skipTaskbarChangedSpy.isValid());
ps->setSkipTaskbar(true);
QVERIFY(skipTaskbarChangedSpy.wait());
QVERIFY(sps->skipTaskbar());
// setting to same again should not emit the signal
ps->setSkipTaskbar(true);
QEXPECT_FAIL("", "Should not be emitted if not changed", Continue);
QVERIFY(!skipTaskbarChangedSpy.wait(100));
QVERIFY(sps->skipTaskbar());
// setting to false should change again
ps->setSkipTaskbar(false);
QVERIFY(skipTaskbarChangedSpy.wait());
QVERIFY(!sps->skipTaskbar());
}
void TestPlasmaShell::testDisconnect()
{
// this test verifies that a disconnect cleans up
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment