Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/shell_client_test.cpp
Show First 20 Lines • Show All 772 Lines • ▼ Show 20 Line(s) | 771 | { | |||
---|---|---|---|---|---|
773 | // this test verifies that desktop file name is passed correctly to the window | 773 | // this test verifies that desktop file name is passed correctly to the window | ||
774 | QScopedPointer<Surface> surface(Test::createSurface()); | 774 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
775 | // only xdg-shell as ShellSurface misses the setter | 775 | // only xdg-shell as ShellSurface misses the setter | ||
776 | QScopedPointer<XdgShellSurface> shellSurface(qobject_cast<XdgShellSurface*>(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface.data()))); | 776 | QScopedPointer<XdgShellSurface> shellSurface(qobject_cast<XdgShellSurface*>(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface.data()))); | ||
777 | shellSurface->setAppId(QByteArrayLiteral("org.kde.foo")); | 777 | shellSurface->setAppId(QByteArrayLiteral("org.kde.foo")); | ||
778 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 778 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
779 | QVERIFY(c); | 779 | QVERIFY(c); | ||
780 | QCOMPARE(c->desktopFileName(), QByteArrayLiteral("org.kde.foo")); | 780 | QCOMPARE(c->desktopFileName(), QByteArrayLiteral("org.kde.foo")); | ||
781 | QCOMPARE(c->resourceClass(), QByteArrayLiteral("org.kde.foo")); | ||||
782 | QVERIFY(c->resourceName().startsWith("testShellClient")); | ||||
781 | // the desktop file does not exist, so icon should be generic Wayland | 783 | // the desktop file does not exist, so icon should be generic Wayland | ||
782 | QCOMPARE(c->icon().name(), QStringLiteral("wayland")); | 784 | QCOMPARE(c->icon().name(), QStringLiteral("wayland")); | ||
783 | 785 | | |||
784 | QSignalSpy desktopFileNameChangedSpy(c, &AbstractClient::desktopFileNameChanged); | 786 | QSignalSpy desktopFileNameChangedSpy(c, &AbstractClient::desktopFileNameChanged); | ||
785 | QVERIFY(desktopFileNameChangedSpy.isValid()); | 787 | QVERIFY(desktopFileNameChangedSpy.isValid()); | ||
786 | QSignalSpy iconChangedSpy(c, &ShellClient::iconChanged); | 788 | QSignalSpy iconChangedSpy(c, &ShellClient::iconChanged); | ||
787 | QVERIFY(iconChangedSpy.isValid()); | 789 | QVERIFY(iconChangedSpy.isValid()); | ||
788 | shellSurface->setAppId(QByteArrayLiteral("org.kde.bar")); | 790 | shellSurface->setAppId(QByteArrayLiteral("org.kde.bar")); | ||
789 | QVERIFY(desktopFileNameChangedSpy.wait()); | 791 | QVERIFY(desktopFileNameChangedSpy.wait()); | ||
790 | QCOMPARE(c->desktopFileName(), QByteArrayLiteral("org.kde.bar")); | 792 | QCOMPARE(c->desktopFileName(), QByteArrayLiteral("org.kde.bar")); | ||
793 | QCOMPARE(c->resourceClass(), QByteArrayLiteral("org.kde.bar")); | ||||
794 | QVERIFY(c->resourceName().startsWith("testShellClient")); | ||||
791 | // icon should still be wayland | 795 | // icon should still be wayland | ||
792 | QCOMPARE(c->icon().name(), QStringLiteral("wayland")); | 796 | QCOMPARE(c->icon().name(), QStringLiteral("wayland")); | ||
793 | QVERIFY(iconChangedSpy.isEmpty()); | 797 | QVERIFY(iconChangedSpy.isEmpty()); | ||
794 | 798 | | |||
795 | const QString dfPath = QFINDTESTDATA("data/example.desktop"); | 799 | const QString dfPath = QFINDTESTDATA("data/example.desktop"); | ||
796 | shellSurface->setAppId(dfPath.toUtf8()); | 800 | shellSurface->setAppId(dfPath.toUtf8()); | ||
797 | QVERIFY(desktopFileNameChangedSpy.wait()); | 801 | QVERIFY(desktopFileNameChangedSpy.wait()); | ||
798 | QCOMPARE(iconChangedSpy.count(), 1); | 802 | QCOMPARE(iconChangedSpy.count(), 1); | ||
▲ Show 20 Lines • Show All 218 Lines • Show Last 20 Lines |