[autotests] Test ScriptedEffects stackingOrder

stackingOrder is an interesting property which needed
special handling in the port. Add an explicit test.

Test Plan: #kwin

Reviewers: broulik

Reviewed By: broulik

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D14533
This commit is contained in:
David Edmundson 2018-08-20 17:39:36 +01:00
parent 0a31feb321
commit 1238c7bc47
2 changed files with 10 additions and 8 deletions

View file

@ -180,9 +180,9 @@ void ScriptedEffectsTest::testEffectsHandler()
auto *effect = new ScriptedEffectWithDebugSpy; // cleaned up in ::clean
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
auto waitFor = [&effectOutputSpy, this](const QString &expected) {
QVERIFY(effectOutputSpy.count() == 1 || effectOutputSpy.wait());
QCOMPARE(effectOutputSpy.last().first(), expected);
effectOutputSpy.clear();
QVERIFY(effectOutputSpy.count() > 0 || effectOutputSpy.wait());
QCOMPARE(effectOutputSpy.first().first(), expected);
effectOutputSpy.removeFirst();
};
QVERIFY(effect->load("effectsHandler"));
@ -194,22 +194,23 @@ void ScriptedEffectsTest::testEffectsHandler()
QVERIFY(surface);
auto *shellSurface = Test::createXdgShellV6Surface(surface, surface);
QVERIFY(shellSurface);
shellSurface->setTitle("Window 1");
shellSurface->setTitle("WindowA");
auto *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
QVERIFY(c);
QCOMPARE(workspace()->activeClient(), c);
waitFor("windowAdded - Window 1");
waitFor("windowAdded - WindowA");
waitFor("stackingOrder - 1 WindowA");
// windowMinimsed
c->minimize();
waitFor("windowMinimized - Window 1");
waitFor("windowMinimized - WindowA");
c->unminimize();
waitFor("windowUnminimized - Window 1");
waitFor("windowUnminimized - WindowA");
surface->deleteLater();
waitFor("windowClosed - Window 1");
waitFor("windowClosed - WindowA");
// desktop management
KWin::VirtualDesktopManager::self()->setCurrent(2);

View file

@ -1,5 +1,6 @@
effects.windowAdded.connect(function(window) {
sendTestResponse("windowAdded - " + window.caption);
sendTestResponse("stackingOrder - " + effects.stackingOrder.length + " " + effects.stackingOrder[0].caption);
});
effects.windowClosed.connect(function(window) {
sendTestResponse("windowClosed - " + window.caption);