Changeset View
Changeset View
Standalone View
Standalone View
autotests/client/test_wayland_windowmanagement.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 50 | private Q_SLOTS: | |||
---|---|---|---|---|---|
59 | void testCreateAfterUnmap(); | 59 | void testCreateAfterUnmap(); | ||
60 | void testRequests_data(); | 60 | void testRequests_data(); | ||
61 | void testRequests(); | 61 | void testRequests(); | ||
62 | void testRequestsBoolean_data(); | 62 | void testRequestsBoolean_data(); | ||
63 | void testRequestsBoolean(); | 63 | void testRequestsBoolean(); | ||
64 | void testShowingDesktop(); | 64 | void testShowingDesktop(); | ||
65 | void testRequestShowingDesktop_data(); | 65 | void testRequestShowingDesktop_data(); | ||
66 | void testRequestShowingDesktop(); | 66 | void testRequestShowingDesktop(); | ||
67 | void testParentWindow(); | ||||
67 | 68 | | |||
68 | void cleanup(); | 69 | void cleanup(); | ||
69 | 70 | | |||
70 | private: | 71 | private: | ||
71 | KWayland::Server::Display *m_display; | 72 | KWayland::Server::Display *m_display; | ||
72 | KWayland::Server::CompositorInterface *m_compositorInterface; | 73 | KWayland::Server::CompositorInterface *m_compositorInterface; | ||
73 | KWayland::Server::PlasmaWindowManagementInterface *m_windowManagementInterface; | 74 | KWayland::Server::PlasmaWindowManagementInterface *m_windowManagementInterface; | ||
74 | KWayland::Server::PlasmaWindowInterface *m_windowInterface; | 75 | KWayland::Server::PlasmaWindowInterface *m_windowInterface; | ||
▲ Show 20 Lines • Show All 390 Lines • ▼ Show 20 Line(s) | 462 | { | |||
465 | QVERIFY(requestSpy.isValid()); | 466 | QVERIFY(requestSpy.isValid()); | ||
466 | QFETCH(bool, value); | 467 | QFETCH(bool, value); | ||
467 | m_windowManagement->setShowingDesktop(value); | 468 | m_windowManagement->setShowingDesktop(value); | ||
468 | QVERIFY(requestSpy.wait()); | 469 | QVERIFY(requestSpy.wait()); | ||
469 | QCOMPARE(requestSpy.count(), 1); | 470 | QCOMPARE(requestSpy.count(), 1); | ||
470 | QTEST(requestSpy.first().first().value<PlasmaWindowManagementInterface::ShowingDesktopState>(), "expectedValue"); | 471 | QTEST(requestSpy.first().first().value<PlasmaWindowManagementInterface::ShowingDesktopState>(), "expectedValue"); | ||
471 | } | 472 | } | ||
472 | 473 | | |||
474 | void TestWindowManagement::testParentWindow() | ||||
475 | { | ||||
476 | using namespace KWayland::Client; | ||||
477 | // this test verifies the functionality of ParentWindows | ||||
478 | QCOMPARE(m_windowManagement->windows().count(), 1); | ||||
479 | auto parentWindow = m_windowManagement->windows().first(); | ||||
480 | QVERIFY(parentWindow); | ||||
481 | QVERIFY(parentWindow->parentWindow().isNull()); | ||||
482 | | ||||
483 | // now let's create a second window | ||||
484 | QSignalSpy windowAddedSpy(m_windowManagement, &PlasmaWindowManagement::windowCreated); | ||||
485 | QVERIFY(windowAddedSpy.isValid()); | ||||
486 | auto serverTransient = m_windowManagementInterface->createWindow(this); | ||||
487 | serverTransient->setParentWindow(m_windowInterface); | ||||
488 | QVERIFY(windowAddedSpy.wait()); | ||||
489 | auto transient = windowAddedSpy.first().first().value<PlasmaWindow*>(); | ||||
490 | QCOMPARE(transient->parentWindow().data(), parentWindow); | ||||
491 | | ||||
492 | // let's unset the parent | ||||
493 | QSignalSpy parentWindowChangedSpy(transient, &PlasmaWindow::parentWindowChanged); | ||||
494 | QVERIFY(parentWindowChangedSpy.isValid()); | ||||
495 | serverTransient->setParentWindow(nullptr); | ||||
496 | QVERIFY(parentWindowChangedSpy.wait()); | ||||
497 | QVERIFY(transient->parentWindow().isNull()); | ||||
498 | | ||||
499 | // and set it again | ||||
500 | serverTransient->setParentWindow(m_windowInterface); | ||||
501 | QVERIFY(parentWindowChangedSpy.wait()); | ||||
502 | QCOMPARE(transient->parentWindow().data(), parentWindow); | ||||
503 | | ||||
504 | // now let's try to unmap the parent | ||||
505 | m_windowInterface->unmap(); | ||||
506 | m_window = nullptr; | ||||
507 | m_windowInterface = nullptr; | ||||
508 | QVERIFY(parentWindowChangedSpy.wait()); | ||||
509 | QVERIFY(transient->parentWindow().isNull()); | ||||
510 | } | ||||
511 | | ||||
473 | QTEST_GUILESS_MAIN(TestWindowManagement) | 512 | QTEST_GUILESS_MAIN(TestWindowManagement) | ||
474 | #include "test_wayland_windowmanagement.moc" | 513 | #include "test_wayland_windowmanagement.moc" |