Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/effects/minimize_animation_test.cpp
Show All 20 Lines | |||||
21 | #include "kwin_wayland_test.h" | 21 | #include "kwin_wayland_test.h" | ||
22 | 22 | | |||
23 | #include "abstract_client.h" | 23 | #include "abstract_client.h" | ||
24 | #include "composite.h" | 24 | #include "composite.h" | ||
25 | #include "effectloader.h" | 25 | #include "effectloader.h" | ||
26 | #include "effects.h" | 26 | #include "effects.h" | ||
27 | #include "platform.h" | 27 | #include "platform.h" | ||
28 | #include "scene.h" | 28 | #include "scene.h" | ||
29 | #include "xdgshellclient.h" | | |||
30 | #include "wayland_server.h" | 29 | #include "wayland_server.h" | ||
31 | #include "workspace.h" | 30 | #include "workspace.h" | ||
32 | 31 | | |||
33 | #include "effect_builtins.h" | 32 | #include "effect_builtins.h" | ||
34 | 33 | | |||
35 | #include <KWayland/Client/plasmashell.h> | 34 | #include <KWayland/Client/plasmashell.h> | ||
36 | #include <KWayland/Client/plasmawindowmanagement.h> | 35 | #include <KWayland/Client/plasmawindowmanagement.h> | ||
37 | #include <KWayland/Client/surface.h> | 36 | #include <KWayland/Client/surface.h> | ||
Show All 16 Lines | 47 | private Q_SLOTS: | |||
54 | void testMinimizeUnminimize(); | 53 | void testMinimizeUnminimize(); | ||
55 | }; | 54 | }; | ||
56 | 55 | | |||
57 | void MinimizeAnimationTest::initTestCase() | 56 | void MinimizeAnimationTest::initTestCase() | ||
58 | { | 57 | { | ||
59 | qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8()); | 58 | qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8()); | ||
60 | 59 | | |||
61 | qRegisterMetaType<KWin::AbstractClient *>(); | 60 | qRegisterMetaType<KWin::AbstractClient *>(); | ||
62 | qRegisterMetaType<KWin::XdgShellClient *>(); | | |||
63 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 61 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
64 | QVERIFY(workspaceCreatedSpy.isValid()); | 62 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
65 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 63 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
66 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 64 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
67 | 65 | | |||
68 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 66 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
69 | KConfigGroup plugins(config, QStringLiteral("Plugins")); | 67 | KConfigGroup plugins(config, QStringLiteral("Plugins")); | ||
70 | ScriptedEffectLoader loader; | 68 | ScriptedEffectLoader loader; | ||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 115 | { | |||
129 | QVERIFY(!panelSurface.isNull()); | 127 | QVERIFY(!panelSurface.isNull()); | ||
130 | QScopedPointer<XdgShellSurface> panelShellSurface(Test::createXdgShellStableSurface(panelSurface.data())); | 128 | QScopedPointer<XdgShellSurface> panelShellSurface(Test::createXdgShellStableSurface(panelSurface.data())); | ||
131 | QVERIFY(!panelShellSurface.isNull()); | 129 | QVERIFY(!panelShellSurface.isNull()); | ||
132 | QScopedPointer<PlasmaShellSurface> plasmaPanelShellSurface(Test::waylandPlasmaShell()->createSurface(panelSurface.data())); | 130 | QScopedPointer<PlasmaShellSurface> plasmaPanelShellSurface(Test::waylandPlasmaShell()->createSurface(panelSurface.data())); | ||
133 | QVERIFY(!plasmaPanelShellSurface.isNull()); | 131 | QVERIFY(!plasmaPanelShellSurface.isNull()); | ||
134 | plasmaPanelShellSurface->setRole(PlasmaShellSurface::Role::Panel); | 132 | plasmaPanelShellSurface->setRole(PlasmaShellSurface::Role::Panel); | ||
135 | plasmaPanelShellSurface->setPosition(panelRect.topLeft()); | 133 | plasmaPanelShellSurface->setPosition(panelRect.topLeft()); | ||
136 | plasmaPanelShellSurface->setPanelBehavior(PlasmaShellSurface::PanelBehavior::AlwaysVisible); | 134 | plasmaPanelShellSurface->setPanelBehavior(PlasmaShellSurface::PanelBehavior::AlwaysVisible); | ||
137 | XdgShellClient *panel = Test::renderAndWaitForShown(panelSurface.data(), panelRect.size(), Qt::blue); | 135 | AbstractClient *panel = Test::renderAndWaitForShown(panelSurface.data(), panelRect.size(), Qt::blue); | ||
138 | QVERIFY(panel); | 136 | QVERIFY(panel); | ||
139 | QVERIFY(panel->isDock()); | 137 | QVERIFY(panel->isDock()); | ||
140 | QCOMPARE(panel->frameGeometry(), panelRect); | 138 | QCOMPARE(panel->frameGeometry(), panelRect); | ||
141 | QVERIFY(plasmaWindowCreatedSpy.wait()); | 139 | QVERIFY(plasmaWindowCreatedSpy.wait()); | ||
142 | QCOMPARE(plasmaWindowCreatedSpy.count(), 1); | 140 | QCOMPARE(plasmaWindowCreatedSpy.count(), 1); | ||
143 | 141 | | |||
144 | // Create the test client. | 142 | // Create the test client. | ||
145 | QScopedPointer<Surface> surface(Test::createSurface()); | 143 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
146 | QVERIFY(!surface.isNull()); | 144 | QVERIFY(!surface.isNull()); | ||
147 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 145 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
148 | QVERIFY(!shellSurface.isNull()); | 146 | QVERIFY(!shellSurface.isNull()); | ||
149 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::red); | 147 | AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::red); | ||
150 | QVERIFY(client); | 148 | QVERIFY(client); | ||
151 | QVERIFY(plasmaWindowCreatedSpy.wait()); | 149 | QVERIFY(plasmaWindowCreatedSpy.wait()); | ||
152 | QCOMPARE(plasmaWindowCreatedSpy.count(), 2); | 150 | QCOMPARE(plasmaWindowCreatedSpy.count(), 2); | ||
153 | 151 | | |||
154 | // We have to set the minimized geometry because the squash effect needs it, | 152 | // We have to set the minimized geometry because the squash effect needs it, | ||
155 | // otherwise it won't start animation. | 153 | // otherwise it won't start animation. | ||
156 | auto window = plasmaWindowCreatedSpy.last().first().value<PlasmaWindow *>(); | 154 | auto window = plasmaWindowCreatedSpy.last().first().value<PlasmaWindow *>(); | ||
157 | QVERIFY(window); | 155 | QVERIFY(window); | ||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |