Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/plasma_surface_test.cpp
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 46 | private Q_SLOTS: | |||
---|---|---|---|---|---|
54 | void testAcceptsFocus(); | 54 | void testAcceptsFocus(); | ||
55 | 55 | | |||
56 | void testDesktopIsOpaque(); | 56 | void testDesktopIsOpaque(); | ||
57 | void testPanelWindowsCanCover_data(); | 57 | void testPanelWindowsCanCover_data(); | ||
58 | void testPanelWindowsCanCover(); | 58 | void testPanelWindowsCanCover(); | ||
59 | void testOSDPlacement(); | 59 | void testOSDPlacement(); | ||
60 | void testPanelTypeHasStrut_data(); | 60 | void testPanelTypeHasStrut_data(); | ||
61 | void testPanelTypeHasStrut(); | 61 | void testPanelTypeHasStrut(); | ||
62 | void testPanelActivate_data(); | ||||
63 | void testPanelActivate(); | ||||
62 | 64 | | |||
63 | private: | 65 | private: | ||
64 | ConnectionThread *m_connection = nullptr; | 66 | ConnectionThread *m_connection = nullptr; | ||
65 | KWayland::Client::Compositor *m_compositor = nullptr; | 67 | KWayland::Client::Compositor *m_compositor = nullptr; | ||
66 | Shell *m_shell = nullptr; | 68 | Shell *m_shell = nullptr; | ||
67 | PlasmaShell *m_plasmaShell = nullptr; | 69 | PlasmaShell *m_plasmaShell = nullptr; | ||
68 | }; | 70 | }; | ||
69 | 71 | | |||
▲ Show 20 Lines • Show All 293 Lines • ▼ Show 20 Line(s) | 314 | { | |||
363 | KWin::Cursor::setPos(triggerPoint); | 365 | KWin::Cursor::setPos(triggerPoint); | ||
364 | QCOMPARE(stackingOrderChangedSpy.count(), 1); | 366 | QCOMPARE(stackingOrderChangedSpy.count(), 1); | ||
365 | stackingOrder = workspace()->stackingOrder(); | 367 | stackingOrder = workspace()->stackingOrder(); | ||
366 | QCOMPARE(stackingOrder.count(), 2); | 368 | QCOMPARE(stackingOrder.count(), 2); | ||
367 | QCOMPARE(stackingOrder.first(), c); | 369 | QCOMPARE(stackingOrder.first(), c); | ||
368 | QCOMPARE(stackingOrder.last(), panel); | 370 | QCOMPARE(stackingOrder.last(), panel); | ||
369 | } | 371 | } | ||
370 | 372 | | |||
373 | void PlasmaSurfaceTest::testPanelActivate_data() | ||||
374 | { | ||||
375 | QTest::addColumn<bool>("wantsFocus"); | ||||
376 | QTest::addColumn<bool>("active"); | ||||
377 | | ||||
378 | QTest::newRow("no focus") << false << false; | ||||
379 | QTest::newRow("focus") << true << true; | ||||
380 | } | ||||
381 | | ||||
382 | void PlasmaSurfaceTest::testPanelActivate() | ||||
383 | { | ||||
384 | QScopedPointer<Surface> surface(Test::createSurface()); | ||||
385 | QVERIFY(!surface.isNull()); | ||||
386 | QScopedPointer<QObject> shellSurface(Test::createShellSurface(Test::ShellSurfaceType::WlShell, surface.data())); | ||||
387 | QVERIFY(!shellSurface.isNull()); | ||||
388 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | ||||
389 | QVERIFY(!plasmaSurface.isNull()); | ||||
390 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | ||||
391 | QFETCH(bool, wantsFocus); | ||||
392 | plasmaSurface->setPanelTakesFocus(wantsFocus); | ||||
393 | | ||||
394 | auto panel = Test::renderAndWaitForShown(surface.data(), QSize(100, 200), Qt::blue); | ||||
395 | | ||||
396 | QVERIFY(panel); | ||||
397 | QCOMPARE(panel->windowType(), NET::Dock); | ||||
398 | QVERIFY(panel->isDock()); | ||||
399 | QFETCH(bool, active); | ||||
400 | QCOMPARE(panel->dockWantsInput(), active); | ||||
401 | QCOMPARE(panel->isActive(), active); | ||||
402 | } | ||||
403 | | ||||
371 | WAYLANDTEST_MAIN(PlasmaSurfaceTest) | 404 | WAYLANDTEST_MAIN(PlasmaSurfaceTest) | ||
372 | #include "plasma_surface_test.moc" | 405 | #include "plasma_surface_test.moc" |