Changeset View
Changeset View
Standalone View
Standalone View
autotests/client/test_wayland_subsurface.cpp
Show First 20 Lines • Show All 613 Lines • ▼ Show 20 Line(s) | 594 | { | |||
---|---|---|---|---|---|
614 | QScopedPointer<SubSurface> subSurface(m_subCompositor->createSubSurface(QPointer<Surface>(surface.data()), QPointer<Surface>(parent.data()))); | 614 | QScopedPointer<SubSurface> subSurface(m_subCompositor->createSubSurface(QPointer<Surface>(surface.data()), QPointer<Surface>(parent.data()))); | ||
615 | QVERIFY(subSurfaceTreeChangedSpy.wait()); | 615 | QVERIFY(subSurfaceTreeChangedSpy.wait()); | ||
616 | QCOMPARE(subSurfaceTreeChangedSpy.count(), 1); | 616 | QCOMPARE(subSurfaceTreeChangedSpy.count(), 1); | ||
617 | 617 | | |||
618 | // let's damage the child surface | 618 | // let's damage the child surface | ||
619 | QSignalSpy childDamagedSpy(childSurface, &SurfaceInterface::damaged); | 619 | QSignalSpy childDamagedSpy(childSurface, &SurfaceInterface::damaged); | ||
620 | QVERIFY(childDamagedSpy.isValid()); | 620 | QVERIFY(childDamagedSpy.isValid()); | ||
621 | 621 | | |||
622 | QImage image(QSize(200, 200), QImage::Format_ARGB32); | 622 | QImage image(QSize(200, 200), QImage::Format_ARGB32_Premultiplied); | ||
623 | image.fill(Qt::black); | 623 | image.fill(Qt::black); | ||
624 | surface->attachBuffer(m_shm->createBuffer(image)); | 624 | surface->attachBuffer(m_shm->createBuffer(image)); | ||
625 | surface->damage(QRect(0, 0, 200, 200)); | 625 | surface->damage(QRect(0, 0, 200, 200)); | ||
626 | surface->commit(); | 626 | surface->commit(); | ||
627 | 627 | | |||
628 | // state should be applied when the parent surface's state gets applied | 628 | // state should be applied when the parent surface's state gets applied | ||
629 | QVERIFY(!childDamagedSpy.wait(100)); | 629 | QVERIFY(!childDamagedSpy.wait(100)); | ||
630 | QVERIFY(!childSurface->buffer()); | 630 | QVERIFY(!childSurface->buffer()); | ||
631 | 631 | | |||
632 | QVERIFY(!childSurface->isMapped()); | 632 | QVERIFY(!childSurface->isMapped()); | ||
633 | QVERIFY(!parentSurface->isMapped()); | 633 | QVERIFY(!parentSurface->isMapped()); | ||
634 | 634 | | |||
635 | QImage image2(QSize(400, 400), QImage::Format_ARGB32); | 635 | QImage image2(QSize(400, 400), QImage::Format_ARGB32_Premultiplied); | ||
636 | image2.fill(Qt::red); | 636 | image2.fill(Qt::red); | ||
637 | parent->attachBuffer(m_shm->createBuffer(image2)); | 637 | parent->attachBuffer(m_shm->createBuffer(image2)); | ||
638 | parent->damage(QRect(0, 0, 400, 400)); | 638 | parent->damage(QRect(0, 0, 400, 400)); | ||
639 | parent->commit(); | 639 | parent->commit(); | ||
640 | QVERIFY(childDamagedSpy.wait()); | 640 | QVERIFY(childDamagedSpy.wait()); | ||
641 | QCOMPARE(childDamagedSpy.count(), 1); | 641 | QCOMPARE(childDamagedSpy.count(), 1); | ||
642 | QCOMPARE(subSurfaceTreeChangedSpy.count(), 2); | 642 | QCOMPARE(subSurfaceTreeChangedSpy.count(), 2); | ||
643 | QCOMPARE(childSurface->buffer()->data(), image); | 643 | QCOMPARE(childSurface->buffer()->data(), image); | ||
Show All 32 Lines | 656 | { | |||
676 | QScopedPointer<SubSurface> subSurface(m_subCompositor->createSubSurface(QPointer<Surface>(surface.data()), QPointer<Surface>(parent.data()))); | 676 | QScopedPointer<SubSurface> subSurface(m_subCompositor->createSubSurface(QPointer<Surface>(surface.data()), QPointer<Surface>(parent.data()))); | ||
677 | QVERIFY(subSurfaceTreeChangedSpy.wait()); | 677 | QVERIFY(subSurfaceTreeChangedSpy.wait()); | ||
678 | QCOMPARE(subSurfaceTreeChangedSpy.count(), 1); | 678 | QCOMPARE(subSurfaceTreeChangedSpy.count(), 1); | ||
679 | 679 | | |||
680 | // let's damage the child surface | 680 | // let's damage the child surface | ||
681 | QSignalSpy childDamagedSpy(childSurface, &SurfaceInterface::damaged); | 681 | QSignalSpy childDamagedSpy(childSurface, &SurfaceInterface::damaged); | ||
682 | QVERIFY(childDamagedSpy.isValid()); | 682 | QVERIFY(childDamagedSpy.isValid()); | ||
683 | 683 | | |||
684 | QImage image(QSize(200, 200), QImage::Format_ARGB32); | 684 | QImage image(QSize(200, 200), QImage::Format_ARGB32_Premultiplied); | ||
685 | image.fill(Qt::black); | 685 | image.fill(Qt::black); | ||
686 | surface->attachBuffer(m_shm->createBuffer(image)); | 686 | surface->attachBuffer(m_shm->createBuffer(image)); | ||
687 | surface->damage(QRect(0, 0, 200, 200)); | 687 | surface->damage(QRect(0, 0, 200, 200)); | ||
688 | surface->commit(Surface::CommitFlag::None); | 688 | surface->commit(Surface::CommitFlag::None); | ||
689 | 689 | | |||
690 | // state should be applied when the parent surface's state gets applied or when the subsurface switches to desync | 690 | // state should be applied when the parent surface's state gets applied or when the subsurface switches to desync | ||
691 | QVERIFY(!childDamagedSpy.wait(100)); | 691 | QVERIFY(!childDamagedSpy.wait(100)); | ||
692 | QVERIFY(!childSurface->isMapped()); | 692 | QVERIFY(!childSurface->isMapped()); | ||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Line(s) | 798 | { | |||
848 | // first set all subsurfaces to desync, to simplify | 848 | // first set all subsurfaces to desync, to simplify | ||
849 | subSurfaceLevel1->setMode(SubSurface::Mode::Desynchronized); | 849 | subSurfaceLevel1->setMode(SubSurface::Mode::Desynchronized); | ||
850 | subSurfaceLevel2->setMode(SubSurface::Mode::Desynchronized); | 850 | subSurfaceLevel2->setMode(SubSurface::Mode::Desynchronized); | ||
851 | subSurfaceLevel3->setMode(SubSurface::Mode::Desynchronized); | 851 | subSurfaceLevel3->setMode(SubSurface::Mode::Desynchronized); | ||
852 | 852 | | |||
853 | // first map the child, should not map it | 853 | // first map the child, should not map it | ||
854 | QSignalSpy child3DamageSpy(child3->surface().data(), &SurfaceInterface::damaged); | 854 | QSignalSpy child3DamageSpy(child3->surface().data(), &SurfaceInterface::damaged); | ||
855 | QVERIFY(child3DamageSpy.isValid()); | 855 | QVERIFY(child3DamageSpy.isValid()); | ||
856 | QImage image(QSize(200, 200), QImage::Format_ARGB32); | 856 | QImage image(QSize(200, 200), QImage::Format_ARGB32_Premultiplied); | ||
857 | image.fill(Qt::black); | 857 | image.fill(Qt::black); | ||
858 | childLevel3Surface->attachBuffer(m_shm->createBuffer(image)); | 858 | childLevel3Surface->attachBuffer(m_shm->createBuffer(image)); | ||
859 | childLevel3Surface->damage(QRect(0, 0, 200, 200)); | 859 | childLevel3Surface->damage(QRect(0, 0, 200, 200)); | ||
860 | childLevel3Surface->commit(Surface::CommitFlag::None); | 860 | childLevel3Surface->commit(Surface::CommitFlag::None); | ||
861 | QVERIFY(child3DamageSpy.wait()); | 861 | QVERIFY(child3DamageSpy.wait()); | ||
862 | QVERIFY(child3->surface()->buffer()); | 862 | QVERIFY(child3->surface()->buffer()); | ||
863 | QVERIFY(!child3->surface()->isMapped()); | 863 | QVERIFY(!child3->surface()->isMapped()); | ||
864 | 864 | | |||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Line(s) | 1012 | { | |||
1020 | QVERIFY(serverSurfaceCreated.wait()); | 1020 | QVERIFY(serverSurfaceCreated.wait()); | ||
1021 | QScopedPointer<Surface> child(m_compositor->createSurface()); | 1021 | QScopedPointer<Surface> child(m_compositor->createSurface()); | ||
1022 | QVERIFY(serverSurfaceCreated.wait()); | 1022 | QVERIFY(serverSurfaceCreated.wait()); | ||
1023 | SurfaceInterface *serverChildSurface = serverSurfaceCreated.last().first().value<KWayland::Server::SurfaceInterface*>(); | 1023 | SurfaceInterface *serverChildSurface = serverSurfaceCreated.last().first().value<KWayland::Server::SurfaceInterface*>(); | ||
1024 | // create sub-surface | 1024 | // create sub-surface | ||
1025 | m_subCompositor->createSubSurface(child.data(), parent.data()); | 1025 | m_subCompositor->createSubSurface(child.data(), parent.data()); | ||
1026 | 1026 | | |||
1027 | // let's damage this surface, will be in sub-surface pending state | 1027 | // let's damage this surface, will be in sub-surface pending state | ||
1028 | QImage image(QSize(100, 100), QImage::Format_ARGB32); | 1028 | QImage image(QSize(100, 100), QImage::Format_ARGB32_Premultiplied); | ||
1029 | image.fill(Qt::red); | 1029 | image.fill(Qt::red); | ||
1030 | child->attachBuffer(m_shm->createBuffer(image)); | 1030 | child->attachBuffer(m_shm->createBuffer(image)); | ||
1031 | child->damage(QRect(0, 0, 100, 100)); | 1031 | child->damage(QRect(0, 0, 100, 100)); | ||
1032 | child->commit(Surface::CommitFlag::None); | 1032 | child->commit(Surface::CommitFlag::None); | ||
1033 | m_connection->flush(); | 1033 | m_connection->flush(); | ||
1034 | 1034 | | |||
1035 | // Let's try to destroy it | 1035 | // Let's try to destroy it | ||
1036 | QSignalSpy destroySpy(serverChildSurface, &QObject::destroyed); | 1036 | QSignalSpy destroySpy(serverChildSurface, &QObject::destroyed); | ||
Show All 9 Lines |