[autotests] Add test for PlasmaShellSurface::setSkipTaskbar

Test exposes that the changed signal gets emitted even if the value
did not change.
This commit is contained in:
Martin Gräßlin 2016-06-13 11:32:05 +02:00
parent 19f8ca8376
commit ee5e92fe14

View file

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