Changeset View
Changeset View
Standalone View
Standalone View
autotests/client/test_wayland_windowmanagement.cpp
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 50 | private Q_SLOTS: | |||
---|---|---|---|---|---|
61 | void testRequests(); | 61 | void testRequests(); | ||
62 | void testRequestsBoolean_data(); | 62 | void testRequestsBoolean_data(); | ||
63 | void testRequestsBoolean(); | 63 | void testRequestsBoolean(); | ||
64 | void testShowingDesktop(); | 64 | void testShowingDesktop(); | ||
65 | void testRequestShowingDesktop_data(); | 65 | void testRequestShowingDesktop_data(); | ||
66 | void testRequestShowingDesktop(); | 66 | void testRequestShowingDesktop(); | ||
67 | void testParentWindow(); | 67 | void testParentWindow(); | ||
68 | void testGeometry(); | 68 | void testGeometry(); | ||
69 | void testIcon(); | ||||
69 | 70 | | |||
70 | void cleanup(); | 71 | void cleanup(); | ||
71 | 72 | | |||
72 | private: | 73 | private: | ||
73 | KWayland::Server::Display *m_display; | 74 | KWayland::Server::Display *m_display; | ||
74 | KWayland::Server::CompositorInterface *m_compositorInterface; | 75 | KWayland::Server::CompositorInterface *m_compositorInterface; | ||
75 | KWayland::Server::PlasmaWindowManagementInterface *m_windowManagementInterface; | 76 | KWayland::Server::PlasmaWindowManagementInterface *m_windowManagementInterface; | ||
76 | KWayland::Server::PlasmaWindowInterface *m_windowInterface; | 77 | KWayland::Server::PlasmaWindowInterface *m_windowInterface; | ||
▲ Show 20 Lines • Show All 463 Lines • ▼ Show 20 Line(s) | 517 | { | |||
540 | QVERIFY(!pm.isNull()); | 541 | QVERIFY(!pm.isNull()); | ||
541 | QSignalSpy windowAddedSpy(pm.data(), &PlasmaWindowManagement::windowCreated); | 542 | QSignalSpy windowAddedSpy(pm.data(), &PlasmaWindowManagement::windowCreated); | ||
542 | QVERIFY(windowAddedSpy.isValid()); | 543 | QVERIFY(windowAddedSpy.isValid()); | ||
543 | QVERIFY(windowAddedSpy.wait()); | 544 | QVERIFY(windowAddedSpy.wait()); | ||
544 | auto window = pm->windows().first(); | 545 | auto window = pm->windows().first(); | ||
545 | QCOMPARE(window->geometry(), QRect(0, 0, 35, 45)); | 546 | QCOMPARE(window->geometry(), QRect(0, 0, 35, 45)); | ||
546 | } | 547 | } | ||
547 | 548 | | |||
548 | QTEST_GUILESS_MAIN(TestWindowManagement) | 549 | void TestWindowManagement::testIcon() | ||
550 | { | ||||
551 | using namespace KWayland::Client; | ||||
552 | QVERIFY(m_window); | ||||
553 | QSignalSpy iconChangedSpy(m_window, &PlasmaWindow::iconChanged); | ||||
554 | QVERIFY(iconChangedSpy.isValid()); | ||||
555 | m_windowInterface->setIcon(QIcon()); | ||||
556 | // first goes from themed name to empty | ||||
557 | QVERIFY(iconChangedSpy.wait()); | ||||
558 | if (!QIcon::hasThemeIcon(QStringLiteral("wayland"))) { | ||||
559 | QEXPECT_FAIL("", "no icon", Continue); | ||||
560 | } | ||||
561 | QCOMPARE(m_window->icon().name(), QStringLiteral("wayland")); | ||||
562 | QVERIFY(iconChangedSpy.wait()); | ||||
563 | if (!QIcon::hasThemeIcon(QStringLiteral("wayland"))) { | ||||
564 | QEXPECT_FAIL("", "no icon", Continue); | ||||
565 | } | ||||
566 | QCOMPARE(m_window->icon().name(), QStringLiteral("wayland")); | ||||
567 | | ||||
568 | // create an icon with a pixmap | ||||
569 | QPixmap p(32, 32); | ||||
570 | p.fill(Qt::red); | ||||
571 | m_windowInterface->setIcon(p); | ||||
572 | QVERIFY(iconChangedSpy.wait()); | ||||
573 | QCOMPARE(m_window->icon().pixmap(32, 32), p); | ||||
574 | | ||||
575 | // let's set a themed icon | ||||
576 | m_windowInterface->setIcon(QIcon::fromTheme(QStringLiteral("xorg"))); | ||||
577 | QVERIFY(iconChangedSpy.wait()); | ||||
578 | if (!QIcon::hasThemeIcon(QStringLiteral("xorg"))) { | ||||
579 | QEXPECT_FAIL("", "no icon", Continue); | ||||
580 | } | ||||
581 | QCOMPARE(m_window->icon().name(), QStringLiteral("xorg")); | ||||
582 | } | ||||
583 | | ||||
584 | QTEST_MAIN(TestWindowManagement) | ||||
549 | #include "test_wayland_windowmanagement.moc" | 585 | #include "test_wayland_windowmanagement.moc" |