aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Zagorodniy <[email protected]>2018-10-16 19:19:17 +0300
committerVlad Zagorodniy <[email protected]>2019-01-01 17:29:14 +0200
commit48d13379c39692a040755cc3c4f813e97a6e00d2 (patch)
treeb906625efda63b0077cfdd9ef3f50e31d0555905
parent1ca2aec77fee3ba0d82fa8ef71efe1290028f7d7 (diff)
[autotests] Add tests for keep-above and keep-below states
Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D16252
-rw-r--r--autotests/integration/stacking_order_test.cpp94
1 files changed, 94 insertions, 0 deletions
diff --git a/autotests/integration/stacking_order_test.cpp b/autotests/integration/stacking_order_test.cpp
index 8015166..ecc584e 100644
--- a/autotests/integration/stacking_order_test.cpp
+++ b/autotests/integration/stacking_order_test.cpp
@@ -59,6 +59,9 @@ private Q_SLOTS:
void testDeletedGroupTransient();
void testDontKeepAboveNonModalDialogGroupTransients();
+ void testKeepAbove();
+ void testKeepBelow();
+
};
void StackingOrderTest::initTestCase()
@@ -813,5 +816,96 @@ void StackingOrderTest::testDontKeepAboveNonModalDialogGroupTransients()
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2, transient}));
}
+void StackingOrderTest::testKeepAbove()
+{
+ // This test verifies that "keep-above" windows are kept above other windows.
+
+ // Create the first client.
+ KWayland::Client::Surface *clientASurface =
+ Test::createSurface(Test::waylandCompositor());
+ QVERIFY(clientASurface);
+ KWayland::Client::ShellSurface *clientAShellSurface =
+ Test::createShellSurface(clientASurface, clientASurface);
+ QVERIFY(clientAShellSurface);
+ ShellClient *clientA = Test::renderAndWaitForShown(clientASurface, QSize(128, 128), Qt::green);
+ QVERIFY(clientA);
+ QVERIFY(clientA->isActive());
+ QVERIFY(!clientA->keepAbove());
+
+ QCOMPARE(workspace()->stackingOrder(), (ToplevelList{clientA}));
+
+ // Create the second client.
+ KWayland::Client::Surface *clientBSurface =
+ Test::createSurface(Test::waylandCompositor());
+ QVERIFY(clientBSurface);
+ KWayland::Client::ShellSurface *clientBShellSurface =
+ Test::createShellSurface(clientBSurface, clientBSurface);
+ QVERIFY(clientBShellSurface);
+ ShellClient *clientB = Test::renderAndWaitForShown(clientBSurface, QSize(128, 128), Qt::green);
+ QVERIFY(clientB);
+ QVERIFY(clientB->isActive());
+ QVERIFY(!clientB->keepAbove());
+
+ QCOMPARE(workspace()->stackingOrder(), (ToplevelList{clientA, clientB}));
+
+ // Go to the initial test position.
+ workspace()->activateClient(clientA);
+ QTRY_VERIFY(clientA->isActive());
+ QCOMPARE(workspace()->stackingOrder(), (ToplevelList{clientB, clientA}));
+
+ // Set the "keep-above" flag on the client B, it should go above other clients.
+ {
+ StackingUpdatesBlocker blocker(workspace());
+ clientB->setKeepAbove(true);
+ }
+
+ QVERIFY(clientB->keepAbove());
+ QVERIFY(!clientB->isActive());
+ QCOMPARE(workspace()->stackingOrder(), (ToplevelList{clientA, clientB}));
+}
+
+void StackingOrderTest::testKeepBelow()
+{
+ // This test verifies that "keep-below" windows are kept below other windows.
+
+ // Create the first client.
+ KWayland::Client::Surface *clientASurface =
+ Test::createSurface(Test::waylandCompositor());
+ QVERIFY(clientASurface);
+ KWayland::Client::ShellSurface *clientAShellSurface =
+ Test::createShellSurface(clientASurface, clientASurface);
+ QVERIFY(clientAShellSurface);
+ ShellClient *clientA = Test::renderAndWaitForShown(clientASurface, QSize(128, 128), Qt::green);
+ QVERIFY(clientA);
+ QVERIFY(clientA->isActive());
+ QVERIFY(!clientA->keepBelow());
+
+ QCOMPARE(workspace()->stackingOrder(), (ToplevelList{clientA}));
+
+ // Create the second client.
+ KWayland::Client::Surface *clientBSurface =
+ Test::createSurface(Test::waylandCompositor());
+ QVERIFY(clientBSurface);
+ KWayland::Client::ShellSurface *clientBShellSurface =
+ Test::createShellSurface(clientBSurface, clientBSurface);
+ QVERIFY(clientBShellSurface);
+ ShellClient *clientB = Test::renderAndWaitForShown(clientBSurface, QSize(128, 128), Qt::green);
+ QVERIFY(clientB);
+ QVERIFY(clientB->isActive());
+ QVERIFY(!clientB->keepBelow());
+
+ QCOMPARE(workspace()->stackingOrder(), (ToplevelList{clientA, clientB}));
+
+ // Set the "keep-below" flag on the client B, it should go below other clients.
+ {
+ StackingUpdatesBlocker blocker(workspace());
+ clientB->setKeepBelow(true);
+ }
+
+ QVERIFY(clientB->isActive());
+ QVERIFY(clientB->keepBelow());
+ QCOMPARE(workspace()->stackingOrder(), (ToplevelList{clientB, clientA}));
+}
+
WAYLANDTEST_MAIN(StackingOrderTest)
#include "stacking_order_test.moc"