From 1238c7bc4736d859119cf5c3ecda93f70515b33a Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 20 Aug 2018 17:39:36 +0100 Subject: [PATCH] [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 --- .../effects/scripted_effects_test.cpp | 17 +++++++++-------- .../effects/scripts/effectsHandler.js | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/autotests/integration/effects/scripted_effects_test.cpp b/autotests/integration/effects/scripted_effects_test.cpp index ab0ca986bd..45083c51d7 100644 --- a/autotests/integration/effects/scripted_effects_test.cpp +++ b/autotests/integration/effects/scripted_effects_test.cpp @@ -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); diff --git a/autotests/integration/effects/scripts/effectsHandler.js b/autotests/integration/effects/scripts/effectsHandler.js index 2893ce6863..661b181d90 100644 --- a/autotests/integration/effects/scripts/effectsHandler.js +++ b/autotests/integration/effects/scripts/effectsHandler.js @@ -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);