Changeset View
Changeset View
Standalone View
Standalone View
autotests/client/test_plasmashell.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 41 | private Q_SLOTS: | |||
---|---|---|---|---|---|
49 | void testSkipTaskbar(); | 49 | void testSkipTaskbar(); | ||
50 | void testSkipSwitcher(); | 50 | void testSkipSwitcher(); | ||
51 | void testPanelBehavior_data(); | 51 | void testPanelBehavior_data(); | ||
52 | void testPanelBehavior(); | 52 | void testPanelBehavior(); | ||
53 | void testAutoHidePanel(); | 53 | void testAutoHidePanel(); | ||
54 | void testPanelTakesFocus(); | 54 | void testPanelTakesFocus(); | ||
55 | void testDisconnect(); | 55 | void testDisconnect(); | ||
56 | void testWhileDestroying(); | 56 | void testWhileDestroying(); | ||
57 | void testPopupBehavior(); | ||||
57 | 58 | | |||
58 | private: | 59 | private: | ||
59 | Display *m_display = nullptr; | 60 | Display *m_display = nullptr; | ||
60 | CompositorInterface *m_compositorInterface = nullptr; | 61 | CompositorInterface *m_compositorInterface = nullptr; | ||
61 | PlasmaShellInterface *m_plasmaShellInterface = nullptr; | 62 | PlasmaShellInterface *m_plasmaShellInterface = nullptr; | ||
62 | 63 | | |||
63 | ConnectionThread *m_connection = nullptr; | 64 | ConnectionThread *m_connection = nullptr; | ||
64 | Compositor *m_compositor = nullptr; | 65 | Compositor *m_compositor = nullptr; | ||
▲ Show 20 Lines • Show All 456 Lines • ▼ Show 20 Line(s) | 519 | for (int i = 0; i < 100; i++) { | |||
521 | m_plasmaShell->createSurface(s.data(), this); | 522 | m_plasmaShell->createSurface(s.data(), this); | ||
522 | QVERIFY(surfaceCreatedSpy.wait()); | 523 | QVERIFY(surfaceCreatedSpy.wait()); | ||
523 | } | 524 | } | ||
524 | QVERIFY(clientErrorSpy.isEmpty()); | 525 | QVERIFY(clientErrorSpy.isEmpty()); | ||
525 | QVERIFY(!clientErrorSpy.wait(100)); | 526 | QVERIFY(!clientErrorSpy.wait(100)); | ||
526 | QVERIFY(clientErrorSpy.isEmpty()); | 527 | QVERIFY(clientErrorSpy.isEmpty()); | ||
527 | } | 528 | } | ||
528 | 529 | | |||
530 | void TestPlasmaShell::testPopupBehavior() | ||||
531 | { | ||||
532 | // this test verifies that the popup behavior is properly passed to the server | ||||
533 | QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated); | ||||
534 | QVERIFY(plasmaSurfaceCreatedSpy.isValid()); | ||||
535 | | ||||
536 | QScopedPointer<Surface> s(m_compositor->createSurface()); | ||||
537 | QScopedPointer<PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.data())); | ||||
538 | QVERIFY(plasmaSurfaceCreatedSpy.wait()); | ||||
539 | QCOMPARE(plasmaSurfaceCreatedSpy.count(), 1); | ||||
540 | | ||||
541 | // verify that we got a plasma shell surface | ||||
542 | auto sps = plasmaSurfaceCreatedSpy.first().first().value<PlasmaShellSurfaceInterface*>(); | ||||
543 | QVERIFY(sps); | ||||
544 | QVERIFY(sps->surface()); | ||||
545 | QCOMPARE(sps->popupBehavior(), 0); | ||||
546 | | ||||
547 | // now change the behavior | ||||
548 | QSignalSpy behaviorChangedSpy(sps, &PlasmaShellSurfaceInterface::popupBehaviorChanged); | ||||
549 | QVERIFY(behaviorChangedSpy.isValid()); | ||||
550 | ps->setPopupBehavior(PlasmaShellSurface::PopupBehavior::AlwaysOnTop); | ||||
551 | QVERIFY(behaviorChangedSpy.wait()); | ||||
552 | QCOMPARE(sps->popupBehavior(), PlasmaShellSurfaceInterface::PopupBehavior::AlwaysOnTop); | ||||
553 | | ||||
554 | // changing to same should not trigger the signal | ||||
555 | ps->setPopupBehavior(PlasmaShellSurface::PopupBehavior::AlwaysOnTop); | ||||
556 | QVERIFY(!behaviorChangedSpy.wait(100)); | ||||
557 | | ||||
558 | // but changing back to Always Visible should work | ||||
559 | ps->setPopupBehavior(PlasmaShellSurface::PopupBehaviorFlags()); | ||||
560 | QVERIFY(behaviorChangedSpy.wait()); | ||||
561 | QCOMPARE(sps->popupBehavior(), PlasmaShellSurfaceInterface::PopupBehaviorFlags()); | ||||
562 | } | ||||
563 | | ||||
529 | QTEST_GUILESS_MAIN(TestPlasmaShell) | 564 | QTEST_GUILESS_MAIN(TestPlasmaShell) | ||
530 | #include "test_plasmashell.moc" | 565 | #include "test_plasmashell.moc" |