Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/shell_client_test.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 60 | private Q_SLOTS: | |||
---|---|---|---|---|---|
67 | void testDesktopPresenceChanged(); | 67 | void testDesktopPresenceChanged(); | ||
68 | void testTransientPositionAfterRemap(); | 68 | void testTransientPositionAfterRemap(); | ||
69 | void testWindowOutputs_data(); | 69 | void testWindowOutputs_data(); | ||
70 | void testWindowOutputs(); | 70 | void testWindowOutputs(); | ||
71 | void testMinimizeActiveWindow_data(); | 71 | void testMinimizeActiveWindow_data(); | ||
72 | void testMinimizeActiveWindow(); | 72 | void testMinimizeActiveWindow(); | ||
73 | void testFullscreen_data(); | 73 | void testFullscreen_data(); | ||
74 | void testFullscreen(); | 74 | void testFullscreen(); | ||
75 | void testFullscreenRestore_data(); | ||||
76 | void testFullscreenRestore(); | ||||
75 | void testUserCanSetFullscreen_data(); | 77 | void testUserCanSetFullscreen_data(); | ||
76 | void testUserCanSetFullscreen(); | 78 | void testUserCanSetFullscreen(); | ||
77 | void testUserSetFullscreenWlShell(); | 79 | void testUserSetFullscreenWlShell(); | ||
78 | void testUserSetFullscreenXdgShell_data(); | 80 | void testUserSetFullscreenXdgShell_data(); | ||
79 | void testUserSetFullscreenXdgShell(); | 81 | void testUserSetFullscreenXdgShell(); | ||
80 | void testMaximizedToFullscreenWlShell_data(); | 82 | void testMaximizedToFullscreenWlShell_data(); | ||
81 | void testMaximizedToFullscreenWlShell(); | 83 | void testMaximizedToFullscreenWlShell(); | ||
82 | void testMaximizedToFullscreenXdgShell_data(); | 84 | void testMaximizedToFullscreenXdgShell_data(); | ||
▲ Show 20 Lines • Show All 436 Lines • ▼ Show 20 Line(s) | 428 | { | |||
519 | QCOMPARE(sizeChangeRequestedSpy.count(), 2); | 521 | QCOMPARE(sizeChangeRequestedSpy.count(), 2); | ||
520 | QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(100, 50)); | 522 | QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(100, 50)); | ||
521 | // TODO: should switch to fullscreen once it's updated | 523 | // TODO: should switch to fullscreen once it's updated | ||
522 | QVERIFY(!c->isFullScreen()); | 524 | QVERIFY(!c->isFullScreen()); | ||
523 | QCOMPARE(c->layer(), NormalLayer); | 525 | QCOMPARE(c->layer(), NormalLayer); | ||
524 | QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | 526 | QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | ||
525 | } | 527 | } | ||
526 | 528 | | |||
529 | void TestShellClient::testFullscreenRestore_data() | ||||
530 | { | ||||
531 | QTest::addColumn<Test::ShellSurfaceType>("type"); | ||||
532 | | ||||
533 | QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; | ||||
534 | QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; | ||||
535 | QTest::newRow("xdgShellWmBase") << Test::ShellSurfaceType::XdgShellStable; | ||||
536 | } | ||||
537 | | ||||
538 | void TestShellClient::testFullscreenRestore() | ||||
539 | { | ||||
540 | // this test verifies that windows created fullscreen can be later properly restored | ||||
541 | QScopedPointer<Surface> surface(Test::createSurface()); | ||||
542 | QFETCH(Test::ShellSurfaceType, type); | ||||
543 | QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data())); | ||||
544 | | ||||
545 | XdgShellSurface *xdgShellSurface = nullptr; | ||||
546 | // fullscreen the window | ||||
547 | xdgShellSurface = qobject_cast<XdgShellSurface*>(shellSurface.data()); | ||||
548 | xdgShellSurface->setFullscreen(true); | ||||
549 | | ||||
550 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(screens()->size(0)), Qt::blue); | ||||
551 | QVERIFY(c); | ||||
552 | QVERIFY(c->isFullScreen()); | ||||
553 | | ||||
554 | QSignalSpy fullscreenChangedSpy(c, &ShellClient::fullScreenChanged); | ||||
555 | QVERIFY(fullscreenChangedSpy.isValid()); | ||||
556 | QSignalSpy geometryChangedSpy(c, &ShellClient::geometryChanged); | ||||
557 | QVERIFY(geometryChangedSpy.isValid()); | ||||
558 | QSignalSpy configureRequestedSpy(shellSurface.data(), SIGNAL(configureRequested(QSize, KWayland::Client::XdgShellSurface::States, quint32))); | ||||
559 | QVERIFY(configureRequestedSpy.isValid()); | ||||
560 | | ||||
561 | // swap back to normal | ||||
562 | xdgShellSurface->setFullscreen(false); | ||||
563 | | ||||
564 | QVERIFY(fullscreenChangedSpy.wait()); | ||||
565 | QVERIFY(configureRequestedSpy.wait()); | ||||
566 | QCOMPARE(configureRequestedSpy.last().first().toSize(), QSize(0, 0)); | ||||
567 | QVERIFY(!c->isFullScreen()); | ||||
568 | | ||||
davidedmundson: why should it be 4?
| |||||
569 | for (const auto &it: configureRequestedSpy) { | ||||
570 | xdgShellSurface->ackConfigure(it[2].toInt()); | ||||
571 | } | ||||
572 | | ||||
573 | Test::render(surface.data(), QSize(100, 50), Qt::red); | ||||
574 | QVERIFY(geometryChangedSpy.wait()); | ||||
575 | QCOMPARE(geometryChangedSpy.count(), 1); | ||||
576 | QVERIFY(!c->isFullScreen()); | ||||
577 | QCOMPARE(c->geometry().size(), QSize(100, 50)); | ||||
578 | } | ||||
579 | | ||||
527 | void TestShellClient::testUserCanSetFullscreen_data() | 580 | void TestShellClient::testUserCanSetFullscreen_data() | ||
I don't see why the top left should always be 0,0. That's writing tests for what the current code happens to do, not testing for what things should be doing. Arguably the window could be placed according to the placement algorithm. Lets just check the size. davidedmundson: I don't see why the top left should always be 0,0.
That's writing tests for what the current… | |||||
528 | { | 581 | { | ||
529 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 582 | QTest::addColumn<Test::ShellSurfaceType>("type"); | ||
530 | QTest::addColumn<bool>("expected"); | 583 | QTest::addColumn<bool>("expected"); | ||
531 | 584 | | |||
532 | QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell << false; | 585 | QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell << false; | ||
533 | QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << true; | 586 | QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << true; | ||
534 | QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6 << true; | 587 | QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6 << true; | ||
535 | QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable << true; | 588 | QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable << true; | ||
▲ Show 20 Lines • Show All 770 Lines • Show Last 20 Lines |
why should it be 4?