Changeset View
Changeset View
Standalone View
Standalone View
autotests/client/test_plasmashell.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 41 | private Q_SLOTS: | |||
---|---|---|---|---|---|
44 | 44 | | |||
45 | 45 | | |||
46 | void testRole_data(); | 46 | void testRole_data(); | ||
47 | void testRole(); | 47 | void testRole(); | ||
48 | void testPosition(); | 48 | void testPosition(); | ||
49 | void testSkipTaskbar(); | 49 | void testSkipTaskbar(); | ||
50 | void testPanelBehavior_data(); | 50 | void testPanelBehavior_data(); | ||
51 | void testPanelBehavior(); | 51 | void testPanelBehavior(); | ||
52 | void testAutoHidePanel(); | ||||
52 | void testDisconnect(); | 53 | void testDisconnect(); | ||
53 | void testWhileDestroying(); | 54 | void testWhileDestroying(); | ||
54 | 55 | | |||
55 | private: | 56 | private: | ||
56 | Display *m_display = nullptr; | 57 | Display *m_display = nullptr; | ||
57 | CompositorInterface *m_compositorInterface = nullptr; | 58 | CompositorInterface *m_compositorInterface = nullptr; | ||
58 | PlasmaShellInterface *m_plasmaShellInterface = nullptr; | 59 | PlasmaShellInterface *m_plasmaShellInterface = nullptr; | ||
59 | 60 | | |||
▲ Show 20 Lines • Show All 276 Lines • ▼ Show 20 Line(s) | 310 | { | |||
336 | QVERIFY(!behaviorChangedSpy.wait(100)); | 337 | QVERIFY(!behaviorChangedSpy.wait(100)); | ||
337 | 338 | | |||
338 | // but changing back to Always Visible should work | 339 | // but changing back to Always Visible should work | ||
339 | ps->setPanelBehavior(PlasmaShellSurface::PanelBehavior::AlwaysVisible); | 340 | ps->setPanelBehavior(PlasmaShellSurface::PanelBehavior::AlwaysVisible); | ||
340 | QVERIFY(behaviorChangedSpy.wait()); | 341 | QVERIFY(behaviorChangedSpy.wait()); | ||
341 | QCOMPARE(sps->panelBehavior(), PlasmaShellSurfaceInterface::PanelBehavior::AlwaysVisible); | 342 | QCOMPARE(sps->panelBehavior(), PlasmaShellSurfaceInterface::PanelBehavior::AlwaysVisible); | ||
342 | } | 343 | } | ||
343 | 344 | | |||
345 | void TestPlasmaShell::testAutoHidePanel() | ||||
346 | { | ||||
347 | // this test verifies that auto-hiding panels work correctly | ||||
348 | QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated); | ||||
349 | QVERIFY(plasmaSurfaceCreatedSpy.isValid()); | ||||
350 | | ||||
351 | QScopedPointer<Surface> s(m_compositor->createSurface()); | ||||
352 | QScopedPointer<PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.data())); | ||||
353 | ps->setRole(PlasmaShellSurface::Role::Panel); | ||||
354 | ps->setPanelBehavior(PlasmaShellSurface::PanelBehavior::AutoHide); | ||||
355 | QVERIFY(plasmaSurfaceCreatedSpy.wait()); | ||||
356 | QCOMPARE(plasmaSurfaceCreatedSpy.count(), 1); | ||||
357 | auto sps = plasmaSurfaceCreatedSpy.first().first().value<PlasmaShellSurfaceInterface*>(); | ||||
358 | QVERIFY(sps); | ||||
359 | QCOMPARE(sps->panelBehavior(), PlasmaShellSurfaceInterface::PanelBehavior::AutoHide); | ||||
360 | | ||||
361 | QSignalSpy autoHideRequestedSpy(sps, &PlasmaShellSurfaceInterface::panelAutoHideHideRequested); | ||||
362 | QVERIFY(autoHideRequestedSpy.isValid()); | ||||
363 | QSignalSpy autoHideShowRequestedSpy(sps, &PlasmaShellSurfaceInterface::panelAutoHideShowRequested); | ||||
364 | QVERIFY(autoHideShowRequestedSpy.isValid()); | ||||
365 | ps->requestHideAutoHidingPanel(); | ||||
366 | QVERIFY(autoHideRequestedSpy.wait()); | ||||
367 | QCOMPARE(autoHideRequestedSpy.count(), 1); | ||||
368 | QCOMPARE(autoHideShowRequestedSpy.count(), 0); | ||||
369 | | ||||
370 | QSignalSpy panelShownSpy(ps.data(), &PlasmaShellSurface::autoHidePanelShown); | ||||
371 | QVERIFY(panelShownSpy.isValid()); | ||||
372 | QSignalSpy panelHiddenSpy(ps.data(), &PlasmaShellSurface::autoHidePanelHidden); | ||||
373 | QVERIFY(panelHiddenSpy.isValid()); | ||||
374 | | ||||
375 | sps->hideAutoHidingPanel(); | ||||
376 | QVERIFY(panelHiddenSpy.wait()); | ||||
377 | QCOMPARE(panelHiddenSpy.count(), 1); | ||||
378 | QCOMPARE(panelShownSpy.count(), 0); | ||||
379 | | ||||
380 | ps->requestShowAutoHidingPanel(); | ||||
381 | QVERIFY(autoHideShowRequestedSpy.wait()); | ||||
382 | QCOMPARE(autoHideRequestedSpy.count(), 1); | ||||
383 | QCOMPARE(autoHideShowRequestedSpy.count(), 1); | ||||
384 | | ||||
385 | sps->showAutoHidingPanel(); | ||||
386 | QVERIFY(panelShownSpy.wait()); | ||||
387 | QCOMPARE(panelHiddenSpy.count(), 1); | ||||
388 | QCOMPARE(panelShownSpy.count(), 1); | ||||
389 | | ||||
390 | // change panel type | ||||
391 | ps->setPanelBehavior(PlasmaShellSurface::PanelBehavior::AlwaysVisible); | ||||
392 | // requesting auto hide should raise error | ||||
393 | QSignalSpy errorSpy(m_connection, &ConnectionThread::errorOccurred); | ||||
394 | QVERIFY(errorSpy.isValid()); | ||||
395 | ps->requestHideAutoHidingPanel(); | ||||
396 | QVERIFY(errorSpy.wait()); | ||||
397 | } | ||||
398 | | ||||
344 | void TestPlasmaShell::testDisconnect() | 399 | void TestPlasmaShell::testDisconnect() | ||
345 | { | 400 | { | ||
346 | // this test verifies that a disconnect cleans up | 401 | // this test verifies that a disconnect cleans up | ||
347 | QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated); | 402 | QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated); | ||
348 | QVERIFY(plasmaSurfaceCreatedSpy.isValid()); | 403 | QVERIFY(plasmaSurfaceCreatedSpy.isValid()); | ||
349 | // create the surface | 404 | // create the surface | ||
350 | QScopedPointer<Surface> s(m_compositor->createSurface()); | 405 | QScopedPointer<Surface> s(m_compositor->createSurface()); | ||
351 | QScopedPointer<PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.data())); | 406 | QScopedPointer<PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.data())); | ||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |