From 67dcf53e807a78af55a61064ad530f154c9b7395 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 8 Sep 2023 12:01:06 +0300 Subject: [PATCH] autotests: Add more test cases in LayerShellV1WindowTest::testPlacementArea --- .../integration/layershellv1window_test.cpp | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/autotests/integration/layershellv1window_test.cpp b/autotests/integration/layershellv1window_test.cpp index 6863b8437e..4aaf86ae40 100644 --- a/autotests/integration/layershellv1window_test.cpp +++ b/autotests/integration/layershellv1window_test.cpp @@ -353,13 +353,24 @@ void LayerShellV1WindowTest::testChangeLayer() void LayerShellV1WindowTest::testPlacementArea_data() { QTest::addColumn("anchor"); + QTest::addColumn("margins"); QTest::addColumn("exclusiveZone"); QTest::addColumn("placementArea"); - QTest::addRow("left") << int(Test::LayerSurfaceV1::anchor_left) << 300 << QRectF(300, 0, 980, 1024); - QTest::addRow("top") << int(Test::LayerSurfaceV1::anchor_top) << 300 << QRectF(0, 300, 1280, 724); - QTest::addRow("right") << int(Test::LayerSurfaceV1::anchor_right) << 300 << QRectF(0, 0, 980, 1024); - QTest::addRow("bottom") << int(Test::LayerSurfaceV1::anchor_bottom) << 300 << QRectF(0, 0, 1280, 724); + QTest::addRow("left") << int(Test::LayerSurfaceV1::anchor_left) << QMargins(0, 0, 0, 0) << 300 << QRectF(300, 0, 980, 1024); + QTest::addRow("top") << int(Test::LayerSurfaceV1::anchor_top) << QMargins(0, 0, 0, 0) << 300 << QRectF(0, 300, 1280, 724); + QTest::addRow("right") << int(Test::LayerSurfaceV1::anchor_right) << QMargins(0, 0, 0, 0) << 300 << QRectF(0, 0, 980, 1024); + QTest::addRow("bottom") << int(Test::LayerSurfaceV1::anchor_bottom) << QMargins(0, 0, 0, 0) << 300 << QRectF(0, 0, 1280, 724); + + QTest::addRow("left, negative margin") << int(Test::LayerSurfaceV1::anchor_left) << QMargins(-5, 0, 0, 0) << 300 << QRectF(295, 0, 985, 1024); + QTest::addRow("top, negative margin") << int(Test::LayerSurfaceV1::anchor_top) << QMargins(0, -5, 0, 0) << 300 << QRectF(0, 295, 1280, 729); + QTest::addRow("right, negative margin") << int(Test::LayerSurfaceV1::anchor_right) << QMargins(0, 0, -5, 0) << 300 << QRectF(0, 0, 985, 1024); + QTest::addRow("bottom, negative margin") << int(Test::LayerSurfaceV1::anchor_bottom) << QMargins(0, 0, 0, -5) << 300 << QRectF(0, 0, 1280, 729); + + QTest::addRow("left, positive margin") << int(Test::LayerSurfaceV1::anchor_left) << QMargins(5, 0, 0, 0) << 300 << QRectF(305, 0, 975, 1024); + QTest::addRow("top, positive margin") << int(Test::LayerSurfaceV1::anchor_top) << QMargins(0, 5, 0, 0) << 300 << QRectF(0, 305, 1280, 719); + QTest::addRow("right, positive margin") << int(Test::LayerSurfaceV1::anchor_right) << QMargins(0, 0, 5, 0) << 300 << QRectF(0, 0, 975, 1024); + QTest::addRow("bottom, positive margin") << int(Test::LayerSurfaceV1::anchor_bottom) << QMargins(0, 0, 0, 5) << 300 << QRectF(0, 0, 1280, 719); } void LayerShellV1WindowTest::testPlacementArea() @@ -370,8 +381,10 @@ void LayerShellV1WindowTest::testPlacementArea() // Set the initial state of the layer surface. QFETCH(int, anchor); + QFETCH(QMargins, margins); QFETCH(int, exclusiveZone); shellSurface->set_anchor(anchor); + shellSurface->set_margin(margins.top(), margins.right(), margins.bottom(), margins.left()); shellSurface->set_exclusive_zone(exclusiveZone); shellSurface->set_size(280, 124); surface->commit(KWayland::Client::Surface::CommitFlag::None);