Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/shell_client_test.cpp
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 46 | private Q_SLOTS: | |||
---|---|---|---|---|---|
57 | void testFullscreen_data(); | 57 | void testFullscreen_data(); | ||
58 | void testFullscreen(); | 58 | void testFullscreen(); | ||
59 | void testMaximizedToFullscreen_data(); | 59 | void testMaximizedToFullscreen_data(); | ||
60 | void testMaximizedToFullscreen(); | 60 | void testMaximizedToFullscreen(); | ||
61 | void testWindowOpensLargerThanScreen_data(); | 61 | void testWindowOpensLargerThanScreen_data(); | ||
62 | void testWindowOpensLargerThanScreen(); | 62 | void testWindowOpensLargerThanScreen(); | ||
63 | void testHidden_data(); | 63 | void testHidden_data(); | ||
64 | void testHidden(); | 64 | void testHidden(); | ||
65 | void testDesktopFileName(); | ||||
65 | }; | 66 | }; | ||
66 | 67 | | |||
67 | void TestShellClient::initTestCase() | 68 | void TestShellClient::initTestCase() | ||
68 | { | 69 | { | ||
69 | qRegisterMetaType<KWin::ShellClient*>(); | 70 | qRegisterMetaType<KWin::ShellClient*>(); | ||
70 | qRegisterMetaType<KWin::AbstractClient*>(); | 71 | qRegisterMetaType<KWin::AbstractClient*>(); | ||
71 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 72 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
72 | QVERIFY(workspaceCreatedSpy.isValid()); | 73 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
▲ Show 20 Lines • Show All 505 Lines • ▼ Show 20 Line(s) | 559 | { | |||
578 | c->hideClient(false); | 579 | c->hideClient(false); | ||
579 | QVERIFY(c->isShown(true)); | 580 | QVERIFY(c->isShown(true)); | ||
580 | QVERIFY(c->wantsInput()); | 581 | QVERIFY(c->wantsInput()); | ||
581 | QVERIFY(c->wantsTabFocus()); | 582 | QVERIFY(c->wantsTabFocus()); | ||
582 | 583 | | |||
583 | //QCOMPARE(workspace()->activeClient(), c); | 584 | //QCOMPARE(workspace()->activeClient(), c); | ||
584 | } | 585 | } | ||
585 | 586 | | |||
587 | void TestShellClient::testDesktopFileName() | ||||
588 | { | ||||
589 | // this test verifies that desktop file name is passed correctly to the window | ||||
590 | QScopedPointer<Surface> surface(Test::createSurface()); | ||||
591 | // only xdg-shell as ShellSurface misses the setter | ||||
592 | QScopedPointer<XdgShellSurface> shellSurface(qobject_cast<XdgShellSurface*>(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface.data()))); | ||||
593 | shellSurface->setAppId(QByteArrayLiteral("org.kde.foo")); | ||||
594 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||||
595 | QVERIFY(c); | ||||
596 | QCOMPARE(c->desktopFileName(), QByteArrayLiteral("org.kde.foo")); | ||||
597 | // the desktop file does not exist, so icon should be generic Wayland | ||||
598 | QCOMPARE(c->icon().name(), QStringLiteral("wayland")); | ||||
599 | | ||||
600 | QSignalSpy desktopFileNameChangedSpy(c, &AbstractClient::desktopFileNameChanged); | ||||
601 | QVERIFY(desktopFileNameChangedSpy.isValid()); | ||||
602 | QSignalSpy iconChangedSpy(c, &ShellClient::iconChanged); | ||||
603 | QVERIFY(iconChangedSpy.isValid()); | ||||
604 | shellSurface->setAppId(QByteArrayLiteral("org.kde.bar")); | ||||
605 | QVERIFY(desktopFileNameChangedSpy.wait()); | ||||
606 | QCOMPARE(c->desktopFileName(), QByteArrayLiteral("org.kde.bar")); | ||||
607 | // icon should still be wayland | ||||
608 | QCOMPARE(c->icon().name(), QStringLiteral("wayland")); | ||||
609 | QVERIFY(iconChangedSpy.isEmpty()); | ||||
610 | | ||||
611 | const QString dfPath = QFINDTESTDATA("data/example.desktop"); | ||||
612 | shellSurface->setAppId(dfPath.toUtf8()); | ||||
613 | QVERIFY(desktopFileNameChangedSpy.wait()); | ||||
614 | QCOMPARE(iconChangedSpy.count(), 1); | ||||
615 | QCOMPARE(QString::fromUtf8(c->desktopFileName()), dfPath); | ||||
616 | QCOMPARE(c->icon().name(), QStringLiteral("kwin")); | ||||
617 | } | ||||
618 | | ||||
586 | WAYLANDTEST_MAIN(TestShellClient) | 619 | WAYLANDTEST_MAIN(TestShellClient) | ||
587 | #include "shell_client_test.moc" | 620 | #include "shell_client_test.moc" |