17#include <KWayland/Client/output.h>
18#include <KWayland/Client/surface.h>
26static const QString s_socketName = QStringLiteral(
"wayland_test_kwin_layershellv1window-0");
36 void testOutput_data();
38 void testAnchor_data();
40 void testMargins_data();
42 void testLayer_data();
44 void testChangeLayer();
45 void testPlacementArea_data();
46 void testPlacementArea();
50 void testKeyboardInteractivityNone();
51 void testKeyboardInteractivityOnDemand();
52 void testActivate_data();
55 void testScreenEdge_data();
56 void testScreenEdge();
59void LayerShellV1WindowTest::initTestCase()
64 QRect(0, 0, 1280, 1024),
65 QRect(1280, 0, 1280, 1024),
69 QVERIFY(applicationStartedSpy.wait());
71 QCOMPARE(outputs.count(), 2);
72 QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
73 QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
76void LayerShellV1WindowTest::init()
84void LayerShellV1WindowTest::cleanup()
89void LayerShellV1WindowTest::testOutput_data()
91 QTest::addColumn<int>(
"screenId");
93 QTest::addRow(
"first output") << 0;
94 QTest::addRow(
"second output") << 1;
97void LayerShellV1WindowTest::testOutput()
100 QFETCH(
int, screenId);
106 std::unique_ptr<Test::LayerSurfaceV1> shellSurface(
Test::createLayerSurfaceV1(surface.get(), QStringLiteral(
"test"), output));
109 shellSurface->set_size(280, 124);
110 surface->commit(KWayland::Client::Surface::CommitFlag::None);
114 QVERIFY(configureRequestedSpy.wait());
115 const QSize requestedSize = configureRequestedSpy.last().at(1).toSize();
118 shellSurface->ack_configure(configureRequestedSpy.last().at(0).toUInt());
123 QVERIFY(output->geometry().contains(window->frameGeometry().toRect()));
126 shellSurface.reset();
130void LayerShellV1WindowTest::testAnchor_data()
132 QTest::addColumn<int>(
"anchor");
133 QTest::addColumn<QRectF>(
"expectedGeometry");
135 QTest::addRow(
"left") << int(Test::LayerSurfaceV1::anchor_left)
136 << QRectF(0, 450, 280, 124);
138 QTest::addRow(
"top left") << (Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_left)
139 << QRectF(0, 0, 280, 124);
141 QTest::addRow(
"top") << int(Test::LayerSurfaceV1::anchor_top)
142 << QRectF(500, 0, 280, 124);
144 QTest::addRow(
"top right") << (Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_right)
145 << QRectF(1000, 0, 280, 124);
147 QTest::addRow(
"right") << int(Test::LayerSurfaceV1::anchor_right)
148 << QRectF(1000, 450, 280, 124);
150 QTest::addRow(
"bottom right") << (Test::LayerSurfaceV1::anchor_bottom | Test::LayerSurfaceV1::anchor_right)
151 << QRectF(1000, 900, 280, 124);
153 QTest::addRow(
"bottom") << int(Test::LayerSurfaceV1::anchor_bottom)
154 << QRectF(500, 900, 280, 124);
156 QTest::addRow(
"bottom left") << (Test::LayerSurfaceV1::anchor_bottom | Test::LayerSurfaceV1::anchor_left)
157 << QRectF(0, 900, 280, 124);
160void LayerShellV1WindowTest::testAnchor()
168 shellSurface->set_anchor(anchor);
169 shellSurface->set_size(280, 124);
170 surface->commit(KWayland::Client::Surface::CommitFlag::None);
174 QVERIFY(configureRequestedSpy.wait());
175 const QSize requestedSize = configureRequestedSpy.last().at(1).toSize();
176 QCOMPARE(requestedSize, QSize(280, 124));
179 shellSurface->ack_configure(configureRequestedSpy.last().at(0).toUInt());
184 QTEST(window->frameGeometry(),
"expectedGeometry");
187 shellSurface.reset();
191void LayerShellV1WindowTest::testMargins_data()
193 QTest::addColumn<int>(
"anchor");
194 QTest::addColumn<QMargins>(
"margins");
195 QTest::addColumn<QRectF>(
"expectedGeometry");
197 QTest::addRow(
"left") << int(Test::LayerSurfaceV1::anchor_left)
198 << QMargins(100, 0, 0, 0)
199 << QRectF(100, 450, 280, 124);
201 QTest::addRow(
"top left") << (Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_left)
202 << QMargins(100, 200, 0, 0)
203 << QRectF(100, 200, 280, 124);
205 QTest::addRow(
"top") << int(Test::LayerSurfaceV1::anchor_top)
206 << QMargins(0, 200, 0, 0)
207 << QRectF(500, 200, 280, 124);
209 QTest::addRow(
"top right") << (Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_right)
210 << QMargins(0, 200, 300, 0)
211 << QRectF(700, 200, 280, 124);
213 QTest::addRow(
"right") << int(Test::LayerSurfaceV1::anchor_right)
214 << QMargins(0, 0, 300, 0)
215 << QRectF(700, 450, 280, 124);
217 QTest::addRow(
"bottom right") << (Test::LayerSurfaceV1::anchor_bottom | Test::LayerSurfaceV1::anchor_right)
218 << QMargins(0, 0, 300, 400)
219 << QRectF(700, 500, 280, 124);
221 QTest::addRow(
"bottom") << int(Test::LayerSurfaceV1::anchor_bottom)
222 << QMargins(0, 0, 0, 400)
223 << QRectF(500, 500, 280, 124);
225 QTest::addRow(
"bottom left") << (Test::LayerSurfaceV1::anchor_bottom | Test::LayerSurfaceV1::anchor_left)
226 << QMargins(100, 0, 0, 400)
227 << QRectF(100, 500, 280, 124);
230void LayerShellV1WindowTest::testMargins()
237 QFETCH(QMargins, margins);
239 shellSurface->set_anchor(anchor);
240 shellSurface->set_margin(margins.top(), margins.right(), margins.bottom(), margins.left());
241 shellSurface->set_size(280, 124);
242 surface->commit(KWayland::Client::Surface::CommitFlag::None);
246 QVERIFY(configureRequestedSpy.wait());
247 const QSize requestedSize = configureRequestedSpy.last().at(1).toSize();
250 shellSurface->ack_configure(configureRequestedSpy.last().at(0).toUInt());
255 QTEST(window->frameGeometry(),
"expectedGeometry");
258 shellSurface.reset();
262void LayerShellV1WindowTest::testLayer_data()
264 QTest::addColumn<int>(
"protocolLayer");
265 QTest::addColumn<Layer>(
"compositorLayer");
267 QTest::addRow(
"overlay") << int(Test::LayerShellV1::layer_overlay) <<
OverlayLayer;
268 QTest::addRow(
"top") << int(Test::LayerShellV1::layer_top) <<
AboveLayer;
269 QTest::addRow(
"bottom") << int(Test::LayerShellV1::layer_bottom) <<
BelowLayer;
270 QTest::addRow(
"background") << int(Test::LayerShellV1::layer_background) <<
DesktopLayer;
273void LayerShellV1WindowTest::testLayer()
280 QFETCH(
int, protocolLayer);
281 shellSurface->set_layer(protocolLayer);
282 shellSurface->set_size(280, 124);
283 surface->commit(KWayland::Client::Surface::CommitFlag::None);
287 QVERIFY(configureRequestedSpy.wait());
288 const QSize requestedSize = configureRequestedSpy.last().at(1).toSize();
291 shellSurface->ack_configure(configureRequestedSpy.last().at(0).toUInt());
296 QTEST(window->layer(),
"compositorLayer");
299 shellSurface.reset();
303void LayerShellV1WindowTest::testChangeLayer()
311 shellSurface1->set_layer(Test::LayerShellV1::layer_bottom);
312 shellSurface1->set_size(200, 100);
313 surface1->commit(KWayland::Client::Surface::CommitFlag::None);
317 shellSurface2->set_layer(Test::LayerShellV1::layer_bottom);
318 shellSurface2->set_size(200, 100);
319 surface2->commit(KWayland::Client::Surface::CommitFlag::None);
324 QVERIFY(configureRequestedSpy2.wait());
325 const QSize requestedSize1 = configureRequestedSpy1.last().at(1).toSize();
326 const QSize requestedSize2 = configureRequestedSpy2.last().at(1).toSize();
329 shellSurface1->ack_configure(configureRequestedSpy1.last().at(0).toUInt());
332 shellSurface2->ack_configure(configureRequestedSpy2.last().at(0).toUInt());
337 QCOMPARE(
workspace()->stackingOrder(), (QList<Window *>{window1, window2}));
341 shellSurface1->set_layer(Test::LayerShellV1::layer_top);
342 surface1->commit(KWayland::Client::Surface::CommitFlag::None);
343 QVERIFY(stackingOrderChangedSpy.wait());
346 QCOMPARE(
workspace()->stackingOrder(), (QList<Window *>{window2, window1}));
349 shellSurface1.reset();
351 shellSurface2.reset();
355void LayerShellV1WindowTest::testPlacementArea_data()
357 QTest::addColumn<int>(
"anchor");
358 QTest::addColumn<QMargins>(
"margins");
359 QTest::addColumn<int>(
"exclusiveZone");
360 QTest::addColumn<int>(
"exclusiveEdge");
361 QTest::addColumn<QRectF>(
"placementArea");
363 QTest::addRow(
"left") << int(Test::LayerSurfaceV1::anchor_left) << QMargins(0, 0, 0, 0) << 300 << 0 << QRectF(300, 0, 980, 1024);
364 QTest::addRow(
"top") << int(Test::LayerSurfaceV1::anchor_top) << QMargins(0, 0, 0, 0) << 300 << 0 << QRectF(0, 300, 1280, 724);
365 QTest::addRow(
"right") << int(Test::LayerSurfaceV1::anchor_right) << QMargins(0, 0, 0, 0) << 300 << 0 << QRectF(0, 0, 980, 1024);
366 QTest::addRow(
"bottom") << int(Test::LayerSurfaceV1::anchor_bottom) << QMargins(0, 0, 0, 0) << 300 << 0 << QRectF(0, 0, 1280, 724);
368 QTest::addRow(
"top | left") << int(Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_left) << QMargins(0, 0, 0, 0) << 300 << 0 << QRectF(0, 0, 1280, 1024);
369 QTest::addRow(
"top | right") << int(Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_right) << QMargins(0, 0, 0, 0) << 300 << 0 << QRectF(0, 0, 1280, 1024);
370 QTest::addRow(
"bottom | left") << int(Test::LayerSurfaceV1::anchor_bottom | Test::LayerSurfaceV1::anchor_left) << QMargins(0, 0, 0, 0) << 300 << 0 << QRectF(0, 0, 1280, 1024);
371 QTest::addRow(
"bottom | right") << int(Test::LayerSurfaceV1::anchor_bottom | Test::LayerSurfaceV1::anchor_right) << QMargins(0, 0, 0, 0) << 300 << 0 << QRectF(0, 0, 1280, 1024);
373 QTest::addRow(
"left, negative margin") << int(Test::LayerSurfaceV1::anchor_left) << QMargins(-5, 0, 0, 0) << 300 << 0 << QRectF(295, 0, 985, 1024);
374 QTest::addRow(
"top, negative margin") << int(Test::LayerSurfaceV1::anchor_top) << QMargins(0, -5, 0, 0) << 300 << 0 << QRectF(0, 295, 1280, 729);
375 QTest::addRow(
"right, negative margin") << int(Test::LayerSurfaceV1::anchor_right) << QMargins(0, 0, -5, 0) << 300 << 0 << QRectF(0, 0, 985, 1024);
376 QTest::addRow(
"bottom, negative margin") << int(Test::LayerSurfaceV1::anchor_bottom) << QMargins(0, 0, 0, -5) << 300 << 0 << QRectF(0, 0, 1280, 729);
378 QTest::addRow(
"left, positive margin") << int(Test::LayerSurfaceV1::anchor_left) << QMargins(5, 0, 0, 0) << 300 << 0 << QRectF(305, 0, 975, 1024);
379 QTest::addRow(
"top, positive margin") << int(Test::LayerSurfaceV1::anchor_top) << QMargins(0, 5, 0, 0) << 300 << 0 << QRectF(0, 305, 1280, 719);
380 QTest::addRow(
"right, positive margin") << int(Test::LayerSurfaceV1::anchor_right) << QMargins(0, 0, 5, 0) << 300 << 0 << QRectF(0, 0, 975, 1024);
381 QTest::addRow(
"bottom, positive margin") << int(Test::LayerSurfaceV1::anchor_bottom) << QMargins(0, 0, 0, 5) << 300 << 0 << QRectF(0, 0, 1280, 719);
383 QTest::addRow(
"left + left exclusive edge") << int(Test::LayerSurfaceV1::anchor_left) << QMargins(0, 0, 0, 0) << 300 << int(Test::LayerSurfaceV1::anchor_left) << QRectF(300, 0, 980, 1024);
384 QTest::addRow(
"top + top exclusive edge") << int(Test::LayerSurfaceV1::anchor_top) << QMargins(0, 0, 0, 0) << 300 << int(Test::LayerSurfaceV1::anchor_top) << QRectF(0, 300, 1280, 724);
385 QTest::addRow(
"right + right exclusive edge") << int(Test::LayerSurfaceV1::anchor_right) << QMargins(0, 0, 0, 0) << 300 << int(Test::LayerSurfaceV1::anchor_right) << QRectF(0, 0, 980, 1024);
386 QTest::addRow(
"bottom + bottom exclusive edge") << int(Test::LayerSurfaceV1::anchor_bottom) << QMargins(0, 0, 0, 0) << 300 << int(Test::LayerSurfaceV1::anchor_bottom) << QRectF(0, 0, 1280, 724);
388 QTest::addRow(
"top | left + top exclusive edge") << int(Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_left) << QMargins(0, 0, 0, 0) << 300 << int(Test::LayerSurfaceV1::anchor_top) << QRectF(0, 300, 1280, 724);
389 QTest::addRow(
"top | left + left exclusive edge") << int(Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_left) << QMargins(0, 0, 0, 0) << 300 << int(Test::LayerSurfaceV1::anchor_left) << QRectF(300, 0, 980, 1024);
390 QTest::addRow(
"top | right + top exclusive edge") << int(Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_right) << QMargins(0, 0, 0, 0) << 300 << int(Test::LayerSurfaceV1::anchor_top) << QRectF(0, 300, 1280, 724);
391 QTest::addRow(
"top | right + right exclusive edge") << int(Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_right) << QMargins(0, 0, 0, 0) << 300 << int(Test::LayerSurfaceV1::anchor_right) << QRectF(0, 0, 980, 1024);
392 QTest::addRow(
"bottom | left + bottom exclusive edge") << int(Test::LayerSurfaceV1::anchor_bottom | Test::LayerSurfaceV1::anchor_left) << QMargins(0, 0, 0, 0) << 300 << int(Test::LayerSurfaceV1::anchor_bottom) << QRectF(0, 0, 1280, 724);
393 QTest::addRow(
"bottom | left + left exclusive edge") << int(Test::LayerSurfaceV1::anchor_bottom | Test::LayerSurfaceV1::anchor_left) << QMargins(0, 0, 0, 0) << 300 << int(Test::LayerSurfaceV1::anchor_left) << QRectF(300, 0, 980, 1024);
394 QTest::addRow(
"bottom | right + bottom exclusive edge") << int(Test::LayerSurfaceV1::anchor_bottom | Test::LayerSurfaceV1::anchor_right) << QMargins(0, 0, 0, 0) << 300 << int(Test::LayerSurfaceV1::anchor_bottom) << QRectF(0, 0, 1280, 724);
395 QTest::addRow(
"bottom | right + right exclusive edge") << int(Test::LayerSurfaceV1::anchor_bottom | Test::LayerSurfaceV1::anchor_right) << QMargins(0, 0, 0, 0) << 300 << int(Test::LayerSurfaceV1::anchor_right) << QRectF(0, 0, 980, 1024);
398void LayerShellV1WindowTest::testPlacementArea()
406 QFETCH(QMargins, margins);
407 QFETCH(
int, exclusiveZone);
408 QFETCH(
int, exclusiveEdge);
409 shellSurface->set_anchor(anchor);
410 shellSurface->set_margin(margins.top(), margins.right(), margins.bottom(), margins.left());
411 shellSurface->set_exclusive_zone(exclusiveZone);
412 shellSurface->set_exclusive_edge(exclusiveEdge);
413 shellSurface->set_size(280, 124);
414 surface->commit(KWayland::Client::Surface::CommitFlag::None);
418 QVERIFY(configureRequestedSpy.wait());
419 const QSize requestedSize = configureRequestedSpy.last().at(1).toSize();
422 shellSurface->ack_configure(configureRequestedSpy.last().at(0).toUInt());
430 shellSurface.reset();
434void LayerShellV1WindowTest::testFill_data()
436 QTest::addColumn<int>(
"anchor");
437 QTest::addColumn<QSize>(
"desiredSize");
438 QTest::addColumn<QRectF>(
"expectedGeometry");
440 QTest::addRow(
"horizontal") << (Test::LayerSurfaceV1::anchor_left | Test::LayerSurfaceV1::anchor_right)
442 << QRectF(0, 450, 1280, 124);
444 QTest::addRow(
"vertical") << (Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_bottom)
446 << QRectF(500, 0, 280, 1024);
448 QTest::addRow(
"all") << (Test::LayerSurfaceV1::anchor_left | Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_right | Test::LayerSurfaceV1::anchor_bottom)
450 << QRectF(0, 0, 1280, 1024);
453void LayerShellV1WindowTest::testFill()
461 QFETCH(QSize, desiredSize);
462 shellSurface->set_anchor(anchor);
463 shellSurface->set_size(desiredSize.width(), desiredSize.height());
464 surface->commit(KWayland::Client::Surface::CommitFlag::None);
468 QVERIFY(configureRequestedSpy.wait());
469 const QSize requestedSize = configureRequestedSpy.last().at(1).toSize();
472 shellSurface->ack_configure(configureRequestedSpy.last().at(0).toUInt());
477 QTEST(window->frameGeometry(),
"expectedGeometry");
480 shellSurface.reset();
484void LayerShellV1WindowTest::testStack()
494 shellSurface1->set_anchor(Test::LayerSurfaceV1::anchor_left);
495 shellSurface1->set_size(80, 124);
496 shellSurface1->set_exclusive_zone(80);
497 surface1->commit(KWayland::Client::Surface::CommitFlag::None);
499 shellSurface2->set_anchor(Test::LayerSurfaceV1::anchor_left);
500 shellSurface2->set_size(200, 124);
501 shellSurface2->set_exclusive_zone(200);
502 surface2->commit(KWayland::Client::Surface::CommitFlag::None);
507 QVERIFY(configureRequestedSpy2.wait());
508 const QSize requestedSize1 = configureRequestedSpy1.last().at(1).toSize();
509 const QSize requestedSize2 = configureRequestedSpy2.last().at(1).toSize();
512 shellSurface1->ack_configure(configureRequestedSpy1.last().at(0).toUInt());
516 shellSurface2->ack_configure(configureRequestedSpy2.last().at(0).toUInt());
521 QCOMPARE(window1->frameGeometry(), QRect(0, 450, 80, 124));
522 QCOMPARE(window2->frameGeometry(), QRect(80, 450, 200, 124));
529 shellSurface1.reset();
531 shellSurface2.reset();
535void LayerShellV1WindowTest::testKeyboardInteractivityNone()
542 shellSurface->set_keyboard_interactivity(0);
543 shellSurface->set_size(100, 50);
544 surface->commit(KWayland::Client::Surface::CommitFlag::None);
548 QVERIFY(configureRequestedSpy.wait());
549 const QSize requestedSize = configureRequestedSpy.last().at(1).toSize();
552 shellSurface->ack_configure(configureRequestedSpy.last().at(0).toUInt());
555 QVERIFY(!window->isActive());
559 QVERIFY(!window->isActive());
562 shellSurface.reset();
566void LayerShellV1WindowTest::testKeyboardInteractivityOnDemand()
571 shellSurface1->set_keyboard_interactivity(1);
572 shellSurface1->set_size(280, 124);
573 surface1->commit(KWayland::Client::Surface::CommitFlag::None);
576 QVERIFY(configureRequestedSpy1.wait());
577 const QSize requestedSize1 = configureRequestedSpy1.last().at(1).toSize();
578 shellSurface1->ack_configure(configureRequestedSpy1.last().at(0).toUInt());
581 QVERIFY(window1->isActive());
586 shellSurface2->set_keyboard_interactivity(1);
587 shellSurface2->set_size(280, 124);
588 surface2->commit(KWayland::Client::Surface::CommitFlag::None);
591 QVERIFY(configureRequestedSpy2.wait());
592 const QSize requestedSize2 = configureRequestedSpy2.last().at(1).toSize();
593 shellSurface2->ack_configure(configureRequestedSpy2.last().at(0).toUInt());
596 QVERIFY(window2->isActive());
597 QVERIFY(!window1->isActive());
601 QVERIFY(window1->isActive());
602 QVERIFY(!window2->isActive());
605 shellSurface1.reset();
607 shellSurface2.reset();
611void LayerShellV1WindowTest::testActivate_data()
613 QTest::addColumn<int>(
"layer");
614 QTest::addColumn<bool>(
"active");
616 QTest::addRow(
"overlay") << int(Test::LayerShellV1::layer_overlay) <<
true;
617 QTest::addRow(
"top") << int(Test::LayerShellV1::layer_top) <<
true;
618 QTest::addRow(
"bottom") << int(Test::LayerShellV1::layer_bottom) <<
false;
619 QTest::addRow(
"background") << int(Test::LayerShellV1::layer_background) <<
false;
622void LayerShellV1WindowTest::testActivate()
630 shellSurface->set_layer(layer);
631 shellSurface->set_size(280, 124);
632 surface->commit(KWayland::Client::Surface::CommitFlag::None);
636 QVERIFY(configureRequestedSpy.wait());
637 const QSize requestedSize = configureRequestedSpy.last().at(1).toSize();
640 shellSurface->ack_configure(configureRequestedSpy.last().at(0).toUInt());
643 QVERIFY(!window->isActive());
646 shellSurface->set_keyboard_interactivity(1);
647 surface->commit(KWayland::Client::Surface::CommitFlag::None);
650 QTEST(activeChangedSpy.wait(1000),
"active");
653 shellSurface.reset();
657void LayerShellV1WindowTest::testUnmap()
664 shellSurface->set_size(280, 124);
665 surface->commit(KWayland::Client::Surface::CommitFlag::None);
669 QVERIFY(configureRequestedSpy.wait());
672 shellSurface->ack_configure(configureRequestedSpy.last().at(0).toUInt());
677 surface->attachBuffer(KWayland::Client::Buffer::Ptr());
678 surface->commit(KWayland::Client::Surface::CommitFlag::None);
682 shellSurface->set_size(280, 124);
683 surface->commit(KWayland::Client::Surface::CommitFlag::None);
686 QVERIFY(configureRequestedSpy.wait());
689 shellSurface->ack_configure(configureRequestedSpy.last().at(0).toUInt());
694 shellSurface.reset();
698void LayerShellV1WindowTest::testScreenEdge_data()
700 QTest::addColumn<QMargins>(
"margins");
702 QTest::addRow(
"normal") << QMargins(0, 0, 0, 0);
703 QTest::addRow(
"with margin") << QMargins(0, 0, 0, 10);
706void LayerShellV1WindowTest::testScreenEdge()
708 auto config = kwinApp()->config();
709 config->group(QStringLiteral(
"Windows")).writeEntry(
"ElectricBorderDelay", 75);
719 QFETCH(QMargins, margins);
720 shellSurface->set_layer(Test::LayerShellV1::layer_top);
721 shellSurface->set_anchor(Test::LayerSurfaceV1::anchor_bottom);
722 shellSurface->set_size(100, 50);
723 shellSurface->set_margin(margins.top(), margins.right(), margins.bottom(), margins.left());
724 surface->commit(KWayland::Client::Surface::CommitFlag::None);
728 QVERIFY(configureRequestedSpy.wait());
729 const QSize requestedSize = configureRequestedSpy.last().at(1).toSize();
732 shellSurface->ack_configure(configureRequestedSpy.last().at(0).toUInt());
735 QVERIFY(!window->isActive());
739 quint32 timestamp = 0;
743 screenEdge->activate();
744 QVERIFY(windowHiddenSpy.wait());
745 QVERIFY(!window->isShown());
747 screenEdge->deactivate();
748 QVERIFY(windowShowSpy.wait());
749 QVERIFY(window->isShown());
754 screenEdge->activate();
755 QVERIFY(windowHiddenSpy.wait());
756 QVERIFY(!window->isShown());
763 QVERIFY(windowShowSpy.wait());
764 QVERIFY(window->isShown());
770 screenEdge->activate();
771 QVERIFY(windowHiddenSpy.wait());
772 QVERIFY(!window->isShown());
775 QVERIFY(approachingSpy.last().at(1).toReal() == 0.0);
777 QVERIFY(approachingSpy.last().at(1).toReal() != 0.0);
779 screenEdge->deactivate();
780 QVERIFY(windowShowSpy.wait());
781 QVERIFY(window->isShown());
782 QVERIFY(approachingSpy.last().at(1).toReal() == 0.0);
789 screenEdge->activate();
790 QVERIFY(windowHiddenSpy.wait());
791 QVERIFY(!window->isShown());
794 QVERIFY(windowShowSpy.wait());
795 QVERIFY(window->isShown());
802#include "layershellv1window_test.moc"
void approaching(ElectricBorder border, qreal factor, const QRect &geometry)
void configureRequested(quint32 serial, const QSize &size)
void windowShown(KWin::Window *window)
void windowHidden(KWin::Window *window)
void activateWindow(Window *window, bool force=false)
void stackingOrderChanged()
QList< Output * > outputs() const
void setActiveOutput(Output *output)
#define WAYLANDTEST_MAIN(TestObject)
Window * renderAndWaitForShown(KWayland::Client::Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format=QImage::Format_ARGB32, int timeout=5000)
void destroyWaylandConnection()
void setOutputConfig(const QList< QRect > &geometries)
bool setupWaylandConnection(AdditionalWaylandInterfaces flags=AdditionalWaylandInterfaces())
LayerSurfaceV1 * createLayerSurfaceV1(KWayland::Client::Surface *surface, const QString &scope, KWayland::Client::Output *output=nullptr, LayerShellV1::layer layer=LayerShellV1::layer_top)
AutoHideScreenEdgeV1 * createAutoHideScreenEdgeV1(KWayland::Client::Surface *surface, uint32_t border)
QList< KWayland::Client::Output * > waylandOutputs()
void pointerMotion(const QPointF &position, quint32 time)
std::unique_ptr< KWayland::Client::Surface > createSurface()
bool waitForWindowClosed(Window *window)
WaylandServer * waylandServer()
InputRedirection * input()