Changeset View
Changeset View
Standalone View
Standalone View
autotests/client/test_plasmashell.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 41 | private Q_SLOTS: | |||
---|---|---|---|---|---|
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 testAutoHidePanel(); | ||
53 | void testPanelTakesFocus(); | ||||
53 | void testDisconnect(); | 54 | void testDisconnect(); | ||
54 | void testWhileDestroying(); | 55 | void testWhileDestroying(); | ||
55 | 56 | | |||
56 | private: | 57 | private: | ||
57 | Display *m_display = nullptr; | 58 | Display *m_display = nullptr; | ||
58 | CompositorInterface *m_compositorInterface = nullptr; | 59 | CompositorInterface *m_compositorInterface = nullptr; | ||
59 | PlasmaShellInterface *m_plasmaShellInterface = nullptr; | 60 | PlasmaShellInterface *m_plasmaShellInterface = nullptr; | ||
60 | 61 | | |||
▲ Show 20 Lines • Show All 330 Lines • ▼ Show 20 Line(s) | 347 | { | |||
391 | ps->setPanelBehavior(PlasmaShellSurface::PanelBehavior::AlwaysVisible); | 392 | ps->setPanelBehavior(PlasmaShellSurface::PanelBehavior::AlwaysVisible); | ||
392 | // requesting auto hide should raise error | 393 | // requesting auto hide should raise error | ||
393 | QSignalSpy errorSpy(m_connection, &ConnectionThread::errorOccurred); | 394 | QSignalSpy errorSpy(m_connection, &ConnectionThread::errorOccurred); | ||
394 | QVERIFY(errorSpy.isValid()); | 395 | QVERIFY(errorSpy.isValid()); | ||
395 | ps->requestHideAutoHidingPanel(); | 396 | ps->requestHideAutoHidingPanel(); | ||
396 | QVERIFY(errorSpy.wait()); | 397 | QVERIFY(errorSpy.wait()); | ||
397 | } | 398 | } | ||
398 | 399 | | |||
400 | void TestPlasmaShell::testPanelTakesFocus() | ||||
401 | { | ||||
402 | // this test verifies that whether a panel wants to take focus is passed through correctly | ||||
403 | QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated); | ||||
404 | QVERIFY(plasmaSurfaceCreatedSpy.isValid()); | ||||
405 | QScopedPointer<Surface> s(m_compositor->createSurface()); | ||||
406 | QScopedPointer<PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.data())); | ||||
407 | ps->setRole(PlasmaShellSurface::Role::Panel); | ||||
408 | QVERIFY(plasmaSurfaceCreatedSpy.wait()); | ||||
409 | QCOMPARE(plasmaSurfaceCreatedSpy.count(), 1); | ||||
410 | auto sps = plasmaSurfaceCreatedSpy.first().first().value<PlasmaShellSurfaceInterface*>(); | ||||
411 | QVERIFY(sps); | ||||
412 | QCOMPARE(sps->role(), PlasmaShellSurfaceInterface::Role::Panel); | ||||
413 | QCOMPARE(sps->panelTakesFocus(), false); | ||||
414 | | ||||
415 | ps->setPanelTakesFocus(true); | ||||
416 | m_connection->flush(); | ||||
417 | QTRY_COMPARE(sps->panelTakesFocus(), true); | ||||
418 | ps->setPanelTakesFocus(false); | ||||
419 | m_connection->flush(); | ||||
420 | QTRY_COMPARE(sps->panelTakesFocus(), false); | ||||
421 | } | ||||
422 | | ||||
399 | void TestPlasmaShell::testDisconnect() | 423 | void TestPlasmaShell::testDisconnect() | ||
400 | { | 424 | { | ||
401 | // this test verifies that a disconnect cleans up | 425 | // this test verifies that a disconnect cleans up | ||
402 | QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated); | 426 | QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated); | ||
403 | QVERIFY(plasmaSurfaceCreatedSpy.isValid()); | 427 | QVERIFY(plasmaSurfaceCreatedSpy.isValid()); | ||
404 | // create the surface | 428 | // create the surface | ||
405 | QScopedPointer<Surface> s(m_compositor->createSurface()); | 429 | QScopedPointer<Surface> s(m_compositor->createSurface()); | ||
406 | QScopedPointer<PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.data())); | 430 | QScopedPointer<PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.data())); | ||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |