Changeset View
Standalone View
autotests/integration/xdgshellclient_test.cpp
Show First 20 Lines • Show All 424 Lines • ▼ Show 20 Line(s) | 421 | { | |||
---|---|---|---|---|---|
425 | QTest::newRow("xdgShellWmBase") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Client; | 425 | QTest::newRow("xdgShellWmBase") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Client; | ||
426 | 426 | | |||
427 | QTest::newRow("xdgShellWmBase - deco") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Server; | 427 | QTest::newRow("xdgShellWmBase - deco") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Server; | ||
428 | } | 428 | } | ||
429 | 429 | | |||
430 | void TestXdgShellClient::testFullscreen() | 430 | void TestXdgShellClient::testFullscreen() | ||
431 | { | 431 | { | ||
432 | // this test verifies that a window can be properly fullscreened | 432 | // this test verifies that a window can be properly fullscreened | ||
433 | | ||||
434 | XdgShellSurface::States states; | ||||
435 | | ||||
433 | QScopedPointer<Surface> surface(Test::createSurface()); | 436 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
434 | QFETCH(Test::XdgShellSurfaceType, type); | 437 | QFETCH(Test::XdgShellSurfaceType, type); | ||
435 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | 438 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | ||
436 | QVERIFY(shellSurface); | 439 | QVERIFY(shellSurface); | ||
437 | 440 | | |||
438 | // create deco | 441 | // create deco | ||
439 | QScopedPointer<ServerSideDecoration> deco(Test::waylandServerSideDecoration()->create(surface.data())); | 442 | QScopedPointer<ServerSideDecoration> deco(Test::waylandServerSideDecoration()->create(surface.data())); | ||
440 | QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged); | 443 | QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged); | ||
441 | QVERIFY(decoSpy.isValid()); | 444 | QVERIFY(decoSpy.isValid()); | ||
442 | QVERIFY(decoSpy.wait()); | 445 | QVERIFY(decoSpy.wait()); | ||
443 | QFETCH(ServerSideDecoration::Mode, decoMode); | 446 | QFETCH(ServerSideDecoration::Mode, decoMode); | ||
444 | deco->requestMode(decoMode); | 447 | deco->requestMode(decoMode); | ||
445 | QVERIFY(decoSpy.wait()); | 448 | QVERIFY(decoSpy.wait()); | ||
446 | QCOMPARE(deco->mode(), decoMode); | 449 | QCOMPARE(deco->mode(), decoMode); | ||
447 | 450 | | |||
448 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 451 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
449 | QVERIFY(c); | 452 | QVERIFY(client); | ||
450 | QVERIFY(c->isActive()); | 453 | QVERIFY(client->isActive()); | ||
451 | QCOMPARE(c->layer(), NormalLayer); | 454 | QCOMPARE(client->layer(), NormalLayer); | ||
452 | QVERIFY(!c->isFullScreen()); | 455 | QVERIFY(!client->isFullScreen()); | ||
453 | QCOMPARE(c->clientSize(), QSize(100, 50)); | 456 | QCOMPARE(client->clientSize(), QSize(100, 50)); | ||
454 | QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | 457 | QCOMPARE(client->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | ||
455 | QCOMPARE(c->clientSizeToFrameSize(c->clientSize()), c->frameGeometry().size()); | 458 | QCOMPARE(client->clientSizeToFrameSize(client->clientSize()), client->size()); | ||
456 | QSignalSpy fullscreenChangedSpy(c, &AbstractClient::fullScreenChanged); | 459 | | ||
457 | QVERIFY(fullscreenChangedSpy.isValid()); | 460 | QSignalSpy fullScreenChangedSpy(client, &AbstractClient::fullScreenChanged); | ||
458 | QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); | 461 | QVERIFY(fullScreenChangedSpy.isValid()); | ||
462 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | ||||
459 | QVERIFY(frameGeometryChangedSpy.isValid()); | 463 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
460 | QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); | | |||
461 | QVERIFY(sizeChangeRequestedSpy.isValid()); | | |||
462 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 464 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
463 | QVERIFY(configureRequestedSpy.isValid()); | 465 | QVERIFY(configureRequestedSpy.isValid()); | ||
464 | 466 | | |||
467 | // Wait for the compositor to send a configure event with the Activated state. | ||||
468 | QVERIFY(configureRequestedSpy.wait()); | ||||
469 | QCOMPARE(configureRequestedSpy.count(), 1); | ||||
470 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||||
471 | QVERIFY(states & XdgShellSurface::State::Activated); | ||||
472 | | ||||
473 | // Ask the compositor to show the window in full screen mode. | ||||
465 | shellSurface->setFullscreen(true); | 474 | shellSurface->setFullscreen(true); | ||
466 | QVERIFY(fullscreenChangedSpy.wait()); | 475 | QVERIFY(configureRequestedSpy.wait()); | ||
467 | QVERIFY(sizeChangeRequestedSpy.wait()); | 476 | QCOMPARE(configureRequestedSpy.count(), 2); | ||
468 | QCOMPARE(sizeChangeRequestedSpy.count(), 1); | 477 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
469 | QCOMPARE(sizeChangeRequestedSpy.first().first().toSize(), QSize(screens()->size(0))); | 478 | QVERIFY(states & XdgShellSurface::State::Fullscreen); | ||
470 | // TODO: should switch to fullscreen once it's updated | 479 | QCOMPARE(configureRequestedSpy.last().at(0).value<QSize>(), screens()->size(0)); | ||
471 | QVERIFY(c->isFullScreen()); | | |||
472 | QCOMPARE(c->clientSize(), QSize(100, 50)); | | |||
473 | QVERIFY(frameGeometryChangedSpy.isEmpty()); | | |||
474 | 480 | | |||
475 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 481 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
476 | Test::render(surface.data(), sizeChangeRequestedSpy.first().first().toSize(), Qt::red); | 482 | Test::render(surface.data(), configureRequestedSpy.last().at(0).value<QSize>(), Qt::red); | ||
483 | | ||||
484 | #if 0 // TODO: Uncomment when full screen state updates are truly asynchronous. | ||||
485 | QVERIFY(fullScreenChangedSpy.wait()); | ||||
486 | QCOMPARE(fullScreenChangedSpy.count(), 1); | ||||
487 | #else | ||||
477 | QVERIFY(frameGeometryChangedSpy.wait()); | 488 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
478 | QCOMPARE(frameGeometryChangedSpy.count(), 1); | 489 | QCOMPARE(fullScreenChangedSpy.count(), 1); | ||
479 | QVERIFY(c->isFullScreen()); | 490 | #endif | ||
480 | QVERIFY(!c->isDecorated()); | 491 | QVERIFY(client->isFullScreen()); | ||
481 | QCOMPARE(c->frameGeometry(), QRect(QPoint(0, 0), sizeChangeRequestedSpy.first().first().toSize())); | 492 | QVERIFY(!client->isDecorated()); | ||
482 | QCOMPARE(c->layer(), ActiveLayer); | 493 | QCOMPARE(client->layer(), ActiveLayer); | ||
494 | QCOMPARE(client->frameGeometry(), QRect(QPoint(0, 0), screens()->size(0))); | ||||
483 | 495 | | |||
484 | // swap back to normal | 496 | // Ask the compositor to show the window in normal mode. | ||
485 | shellSurface->setFullscreen(false); | 497 | shellSurface->setFullscreen(false); | ||
486 | QVERIFY(fullscreenChangedSpy.wait()); | 498 | QVERIFY(configureRequestedSpy.wait()); | ||
487 | QVERIFY(sizeChangeRequestedSpy.wait()); | 499 | QCOMPARE(configureRequestedSpy.count(), 3); | ||
488 | QCOMPARE(sizeChangeRequestedSpy.count(), 2); | 500 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
489 | QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(100, 50)); | 501 | QVERIFY(!(states & XdgShellSurface::State::Fullscreen)); | ||
490 | // TODO: should switch to fullscreen once it's updated | 502 | QCOMPARE(configureRequestedSpy.last().at(0).value<QSize>(), QSize(100, 50)); | ||
491 | QVERIFY(!c->isFullScreen()); | 503 | | ||
492 | QCOMPARE(c->layer(), NormalLayer); | 504 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
493 | QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | 505 | Test::render(surface.data(), configureRequestedSpy.last().at(0).value<QSize>(), Qt::blue); | ||
506 | | ||||
507 | #if 0 // TODO: Uncomment when full screen state updates are truly asynchronous. | ||||
508 | QVERIFY(fullScreenChangedSpy.wait()); | ||||
509 | QCOMPARE(fullScreenChangedSpy.count(), 2); | ||||
510 | #else | ||||
511 | QVERIFY(frameGeometryChangedSpy.wait()); | ||||
512 | QCOMPARE(fullScreenChangedSpy.count(), 2); | ||||
513 | #endif | ||||
514 | QCOMPARE(client->clientSize(), QSize(100, 50)); | ||||
515 | QVERIFY(!client->isFullScreen()); | ||||
516 | QCOMPARE(client->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | ||||
517 | QCOMPARE(client->layer(), NormalLayer); | ||||
518 | | ||||
519 | // Destroy the client. | ||||
520 | shellSurface.reset(); | ||||
521 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
494 | } | 522 | } | ||
495 | 523 | | |||
496 | void TestXdgShellClient::testFullscreenRestore_data() | 524 | void TestXdgShellClient::testFullscreenRestore_data() | ||
497 | { | 525 | { | ||
498 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | 526 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
499 | 527 | | |||
500 | QTest::newRow("xdgShellWmBase") << Test::XdgShellSurfaceType::XdgShellStable; | 528 | QTest::newRow("xdgShellWmBase") << Test::XdgShellSurfaceType::XdgShellStable; | ||
501 | } | 529 | } | ||
▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Line(s) | 665 | { | |||
641 | QTest::newRow("xdgShellWmBase") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Client; | 669 | QTest::newRow("xdgShellWmBase") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Client; | ||
642 | 670 | | |||
643 | QTest::newRow("xdgShellWmBase - deco") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Server; | 671 | QTest::newRow("xdgShellWmBase - deco") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Server; | ||
644 | } | 672 | } | ||
645 | 673 | | |||
646 | void TestXdgShellClient::testMaximizedToFullscreen() | 674 | void TestXdgShellClient::testMaximizedToFullscreen() | ||
647 | { | 675 | { | ||
648 | // this test verifies that a window can be properly fullscreened after maximizing | 676 | // this test verifies that a window can be properly fullscreened after maximizing | ||
677 | | ||||
678 | XdgShellSurface::States states; | ||||
679 | | ||||
649 | QScopedPointer<Surface> surface(Test::createSurface()); | 680 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
650 | QFETCH(Test::XdgShellSurfaceType, type); | 681 | QFETCH(Test::XdgShellSurfaceType, type); | ||
651 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | 682 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | ||
652 | QVERIFY(shellSurface); | 683 | QVERIFY(shellSurface); | ||
653 | 684 | | |||
654 | // create deco | 685 | // create deco | ||
655 | QScopedPointer<ServerSideDecoration> deco(Test::waylandServerSideDecoration()->create(surface.data())); | 686 | QScopedPointer<ServerSideDecoration> deco(Test::waylandServerSideDecoration()->create(surface.data())); | ||
656 | QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged); | 687 | QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged); | ||
657 | QVERIFY(decoSpy.isValid()); | 688 | QVERIFY(decoSpy.isValid()); | ||
658 | QVERIFY(decoSpy.wait()); | 689 | QVERIFY(decoSpy.wait()); | ||
659 | QFETCH(ServerSideDecoration::Mode, decoMode); | 690 | QFETCH(ServerSideDecoration::Mode, decoMode); | ||
660 | deco->requestMode(decoMode); | 691 | deco->requestMode(decoMode); | ||
661 | QVERIFY(decoSpy.wait()); | 692 | QVERIFY(decoSpy.wait()); | ||
662 | QCOMPARE(deco->mode(), decoMode); | 693 | QCOMPARE(deco->mode(), decoMode); | ||
663 | 694 | | |||
664 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 695 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
665 | QVERIFY(c); | 696 | QVERIFY(client); | ||
666 | QVERIFY(c->isActive()); | 697 | QVERIFY(client->isActive()); | ||
667 | QVERIFY(!c->isFullScreen()); | 698 | QVERIFY(!client->isFullScreen()); | ||
668 | QCOMPARE(c->clientSize(), QSize(100, 50)); | 699 | QCOMPARE(client->clientSize(), QSize(100, 50)); | ||
669 | QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | 700 | QCOMPARE(client->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | ||
670 | QSignalSpy fullscreenChangedSpy(c, &AbstractClient::fullScreenChanged); | 701 | | ||
702 | QSignalSpy fullscreenChangedSpy(client, &AbstractClient::fullScreenChanged); | ||||
671 | QVERIFY(fullscreenChangedSpy.isValid()); | 703 | QVERIFY(fullscreenChangedSpy.isValid()); | ||
672 | QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); | 704 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | ||
673 | QVERIFY(frameGeometryChangedSpy.isValid()); | 705 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
674 | QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); | | |||
675 | QVERIFY(sizeChangeRequestedSpy.isValid()); | | |||
676 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 706 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
677 | QVERIFY(configureRequestedSpy.isValid()); | 707 | QVERIFY(configureRequestedSpy.isValid()); | ||
708 | | ||||
709 | // Wait for the compositor to send a configure event with the Activated state. | ||||
710 | QVERIFY(configureRequestedSpy.wait()); | ||||
711 | QCOMPARE(configureRequestedSpy.count(), 1); | ||||
712 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||||
713 | QVERIFY(states & XdgShellSurface::State::Activated); | ||||
714 | | ||||
715 | // Ask the compositor to maximize the window. | ||||
678 | shellSurface->setMaximized(true); | 716 | shellSurface->setMaximized(true); | ||
679 | QVERIFY(sizeChangeRequestedSpy.wait()); | 717 | QVERIFY(configureRequestedSpy.wait()); | ||
680 | QCOMPARE(sizeChangeRequestedSpy.count(), 1); | 718 | QCOMPARE(configureRequestedSpy.count(), 2); | ||
719 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||||
720 | QVERIFY(states & XdgShellSurface::State::Maximized); | ||||
681 | 721 | | |||
682 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 722 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
683 | Test::render(surface.data(), sizeChangeRequestedSpy.last().first().toSize(), Qt::red); | 723 | Test::render(surface.data(), configureRequestedSpy.last().at(0).value<QSize>(), Qt::red); | ||
684 | QVERIFY(frameGeometryChangedSpy.wait()); | 724 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
725 | QCOMPARE(client->maximizeMode(), MaximizeFull); | ||||
685 | 726 | | |||
686 | QCOMPARE(c->maximizeMode(), MaximizeFull); | 727 | // Ask the compositor to show the window in full screen mode. | ||
687 | QCOMPARE(frameGeometryChangedSpy.isEmpty(), false); | | |||
688 | frameGeometryChangedSpy.clear(); | | |||
689 | | ||||
690 | // fullscreen the window | | |||
691 | shellSurface->setFullscreen(true); | 728 | shellSurface->setFullscreen(true); | ||
692 | QVERIFY(fullscreenChangedSpy.wait()); | 729 | QVERIFY(configureRequestedSpy.wait()); | ||
693 | if (decoMode == ServerSideDecoration::Mode::Server) { | 730 | QCOMPARE(configureRequestedSpy.count(), 3); | ||
694 | QVERIFY(sizeChangeRequestedSpy.wait()); | 731 | QCOMPARE(configureRequestedSpy.last().at(0).value<QSize>(), screens()->size(0)); | ||
695 | QCOMPARE(sizeChangeRequestedSpy.count(), 2); | 732 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
696 | } | 733 | QVERIFY(states & XdgShellSurface::State::Maximized); | ||
697 | QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(screens()->size(0))); | 734 | QVERIFY(states & XdgShellSurface::State::Fullscreen); | ||
698 | // TODO: should switch to fullscreen once it's updated | | |||
699 | QVERIFY(c->isFullScreen()); | | |||
700 | 735 | | |||
701 | // render at the new size | | |||
702 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 736 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
703 | Test::render(surface.data(), sizeChangeRequestedSpy.last().first().toSize(), Qt::red); | 737 | Test::render(surface.data(), configureRequestedSpy.last().at(0).value<QSize>(), Qt::red); | ||
704 | 738 | | |||
705 | QVERIFY(c->isFullScreen()); | 739 | #if 0 // TODO: Uncomment when full screen changes are truly asynchronous. | ||
706 | QVERIFY(!c->isDecorated()); | 740 | QVERIFY(fullScreenChangedSpy.wait()); | ||
707 | QCOMPARE(c->frameGeometry(), QRect(QPoint(0, 0), sizeChangeRequestedSpy.last().first().toSize())); | 741 | QCOMPARE(fullScreenChangedSpy.count(), 1); | ||
708 | sizeChangeRequestedSpy.clear(); | 742 | #else | ||
743 | QTRY_COMPARE(fullscreenChangedSpy.count(), 1); | ||||
744 | #endif | ||||
745 | QCOMPARE(client->maximizeMode(), MaximizeFull); | ||||
746 | QVERIFY(client->isFullScreen()); | ||||
747 | QVERIFY(!client->isDecorated()); | ||||
709 | 748 | | |||
710 | // swap back to normal | 749 | // Switch back to normal mode. | ||
711 | shellSurface->setFullscreen(false); | 750 | shellSurface->setFullscreen(false); | ||
712 | shellSurface->setMaximized(false); | 751 | shellSurface->setMaximized(false); | ||
713 | QVERIFY(fullscreenChangedSpy.wait()); | 752 | QVERIFY(configureRequestedSpy.wait()); | ||
714 | if (decoMode == ServerSideDecoration::Mode::Server) { | 753 | QCOMPARE(configureRequestedSpy.count(), 4); | ||
715 | QVERIFY(sizeChangeRequestedSpy.wait()); | 754 | QCOMPARE(configureRequestedSpy.last().at(0).value<QSize>(), QSize(100, 50)); | ||
716 | // XDG will legitimately get two updates. They might be batched | 755 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
717 | if (shellSurface && sizeChangeRequestedSpy.count() == 1) { | 756 | QVERIFY(!(states & XdgShellSurface::State::Maximized)); | ||
718 | QVERIFY(sizeChangeRequestedSpy.wait()); | 757 | QVERIFY(!(states & XdgShellSurface::State::Fullscreen)); | ||
719 | } | 758 | | ||
720 | QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(100, 50)); | 759 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
721 | } | 760 | Test::render(surface.data(), configureRequestedSpy.last().at(0).value<QSize>(), Qt::red); | ||
722 | // TODO: should switch to fullscreen once it's updated | 761 | | ||
723 | QVERIFY(!c->isFullScreen()); | 762 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
724 | QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | 763 | QVERIFY(!client->isFullScreen()); | ||
764 | QCOMPARE(client->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | ||||
765 | QCOMPARE(client->maximizeMode(), MaximizeRestore); | ||||
766 | | ||||
767 | // Destroy the client. | ||||
768 | shellSurface.reset(); | ||||
769 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
725 | } | 770 | } | ||
726 | 771 | | |||
727 | void TestXdgShellClient::testWindowOpensLargerThanScreen_data() | 772 | void TestXdgShellClient::testWindowOpensLargerThanScreen_data() | ||
728 | { | 773 | { | ||
729 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | 774 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
730 | 775 | | |||
731 | QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; | 776 | QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; | ||
732 | } | 777 | } | ||
Show All 15 Lines | 780 | { | |||
748 | QVERIFY(decoSpy.wait()); | 793 | QVERIFY(decoSpy.wait()); | ||
749 | deco->requestMode(ServerSideDecoration::Mode::Server); | 794 | deco->requestMode(ServerSideDecoration::Mode::Server); | ||
750 | QVERIFY(decoSpy.wait()); | 795 | QVERIFY(decoSpy.wait()); | ||
751 | QCOMPARE(deco->mode(), ServerSideDecoration::Mode::Server); | 796 | QCOMPARE(deco->mode(), ServerSideDecoration::Mode::Server); | ||
752 | 797 | | |||
753 | auto c = Test::renderAndWaitForShown(surface.data(), screens()->size(0), Qt::blue); | 798 | auto c = Test::renderAndWaitForShown(surface.data(), screens()->size(0), Qt::blue); | ||
754 | QVERIFY(c); | 799 | QVERIFY(c); | ||
755 | QVERIFY(c->isActive()); | 800 | QVERIFY(c->isActive()); | ||
756 | QCOMPARE(c->clientSize(), screens()->size(0)); | | |||
757 | QVERIFY(c->isDecorated()); | 801 | QVERIFY(c->isDecorated()); | ||
758 | QEXPECT_FAIL("", "BUG 366632", Continue); | 802 | QEXPECT_FAIL("", "BUG 366632", Continue); | ||
759 | QVERIFY(sizeChangeRequestedSpy.wait(10)); | 803 | QCOMPARE(c->frameGeometry(), QRect(QPoint(0, 0), screens()->size(0))); | ||
760 | } | 804 | } | ||
761 | 805 | | |||
762 | void TestXdgShellClient::testHidden_data() | 806 | void TestXdgShellClient::testHidden_data() | ||
763 | { | 807 | { | ||
764 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | 808 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
765 | 809 | | |||
766 | QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; | 810 | QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; | ||
767 | } | 811 | } | ||
▲ Show 20 Lines • Show All 579 Lines • ▼ Show 20 Line(s) | 1369 | { | |||
1347 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | 1391 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | ||
1348 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); | 1392 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); | ||
1349 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1393 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1350 | 1394 | | |||
1351 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | 1395 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | ||
1352 | QVERIFY(frameGeometryChangedSpy.wait()); | 1396 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1353 | QCOMPARE(frameGeometryChangedSpy.count(), 2); | 1397 | QCOMPARE(frameGeometryChangedSpy.count(), 2); | ||
1354 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | 1398 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | ||
1355 | QCOMPARE(client->frameGeometry().size(), QSize(100, 50)); | 1399 | QCOMPARE(client->frameGeometry().size(), QSize(90, 40)); | ||
davidedmundson: This needs explanation.
The one thing that makes such a big change somewhat safe is the… | |||||
Urgh, I made a mistake in the window geometry patch series. The current window geometry is QRect(10, 10, 180, 80) and the current bounding rect is QRect(0, 0, 100, 50). Their intersection produces QRect(10, 10, 90, 40). zzag: Urgh, I made a mistake in the window geometry patch series.
The current window geometry is… | |||||
why is it only coming up now? The change in placement.cpp? Can they be standalone? davidedmundson: why is it only coming up now?
The change in placement.cpp?
Can they be standalone? | |||||
Actually, I did not make a mistake. Originally, the window geometry patch series assumed that we have to compute the effective window geometry when the pending state of xdg_surface is applied. Then D26233, changed when the window geometry is clamped. It's worth to point out that we didn't take into account the frame geometry in D26233. So, it's quite possible that the frame geometry and the client size may diverge from time to time. Given that XdgSurfaceClient clamps the window geometry when the main surface has been committed, the frame geometry and the client size cannot diverge anymore. So, this test must be adjusted. zzag: > Urgh, I made a mistake in the window geometry patch series.
Actually, I did not make a… | |||||
1356 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); | 1400 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); | ||
1357 | QCOMPARE(client->bufferGeometry().size(), QSize(100, 50)); | 1401 | QCOMPARE(client->bufferGeometry().size(), QSize(100, 50)); | ||
1358 | 1402 | | |||
1359 | shellSurface->setWindowGeometry(QRect(5, 5, 90, 40)); | 1403 | shellSurface->setWindowGeometry(QRect(0, 0, 100, 50)); | ||
1360 | surface->commit(Surface::CommitFlag::None); | 1404 | surface->commit(Surface::CommitFlag::None); | ||
1361 | QVERIFY(frameGeometryChangedSpy.wait()); | 1405 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1362 | QCOMPARE(frameGeometryChangedSpy.count(), 3); | 1406 | QCOMPARE(frameGeometryChangedSpy.count(), 3); | ||
1363 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | 1407 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | ||
1364 | QCOMPARE(client->frameGeometry().size(), QSize(90, 40)); | 1408 | QCOMPARE(client->frameGeometry().size(), QSize(100, 50)); | ||
1365 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(5, 5)); | 1409 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition); | ||
1366 | QCOMPARE(client->bufferGeometry().size(), QSize(100, 50)); | 1410 | QCOMPARE(client->bufferGeometry().size(), QSize(100, 50)); | ||
1367 | 1411 | | |||
1368 | shellSurface.reset(); | 1412 | shellSurface.reset(); | ||
1369 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1413 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1370 | } | 1414 | } | ||
1371 | 1415 | | |||
1372 | void TestXdgShellClient::testXdgWindowGeometryAttachSubSurface() | 1416 | void TestXdgShellClient::testXdgWindowGeometryAttachSubSurface() | ||
1373 | { | 1417 | { | ||
▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Line(s) | 1462 | { | |||
1492 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 2); | 1536 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 2); | ||
1493 | QCOMPARE(client->bufferGeometry().size(), QSize(208, 108)); | 1537 | QCOMPARE(client->bufferGeometry().size(), QSize(208, 108)); | ||
1494 | QCOMPARE(client->frameGeometry().size(), QSize(188, 88)); | 1538 | QCOMPARE(client->frameGeometry().size(), QSize(188, 88)); | ||
1495 | 1539 | | |||
1496 | // Finish resizing the client. | 1540 | // Finish resizing the client. | ||
1497 | client->keyPressEvent(Qt::Key_Enter); | 1541 | client->keyPressEvent(Qt::Key_Enter); | ||
1498 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); | 1542 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); | ||
1499 | QCOMPARE(workspace()->moveResizeClient(), nullptr); | 1543 | QCOMPARE(workspace()->moveResizeClient(), nullptr); | ||
1500 | #if 0 | | |||
1501 | QEXPECT_FAIL("", "XdgShellClient currently doesn't send final configure event", Abort); | | |||
1502 | QVERIFY(configureRequestedSpy.wait()); | 1544 | QVERIFY(configureRequestedSpy.wait()); | ||
1503 | QCOMPARE(configureRequestedSpy.count(), 5); | 1545 | QCOMPARE(configureRequestedSpy.count(), 5); | ||
1504 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | 1546 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
1505 | QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); | 1547 | QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); | ||
1506 | #endif | | |||
1507 | 1548 | | |||
1508 | shellSurface.reset(); | 1549 | shellSurface.reset(); | ||
1509 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1550 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1510 | } | 1551 | } | ||
1511 | 1552 | | |||
1512 | void TestXdgShellClient::testXdgWindowGeometryFullScreen() | 1553 | void TestXdgShellClient::testXdgWindowGeometryFullScreen() | ||
1513 | { | 1554 | { | ||
1514 | // This test verifies that an xdg-shell receives correct window geometry when | 1555 | // This test verifies that an xdg-shell receives correct window geometry when | ||
▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines |
This needs explanation.
The one thing that makes such a big change somewhat safe is the extensive unit tests.
If we change them at the same time, then we've lost all that.