Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/effects/fade_test.cpp
Show All 25 Lines | |||||
26 | #include "shell_client.h" | 26 | #include "shell_client.h" | ||
27 | #include "wayland_server.h" | 27 | #include "wayland_server.h" | ||
28 | #include "workspace.h" | 28 | #include "workspace.h" | ||
29 | #include "effect_builtins.h" | 29 | #include "effect_builtins.h" | ||
30 | 30 | | |||
31 | #include <KConfigGroup> | 31 | #include <KConfigGroup> | ||
32 | 32 | | |||
33 | #include <KWayland/Client/buffer.h> | 33 | #include <KWayland/Client/buffer.h> | ||
34 | #include <KWayland/Client/shell.h> | | |||
35 | #include <KWayland/Client/surface.h> | 34 | #include <KWayland/Client/surface.h> | ||
36 | 35 | | |||
37 | using namespace KWin; | 36 | using namespace KWin; | ||
38 | using namespace KWayland::Client; | 37 | using namespace KWayland::Client; | ||
39 | static const QString s_socketName = QStringLiteral("wayland_test_effects_translucency-0"); | 38 | static const QString s_socketName = QStringLiteral("wayland_test_effects_translucency-0"); | ||
40 | 39 | | |||
41 | class FadeTest : public QObject | 40 | class FadeTest : public QObject | ||
42 | { | 41 | { | ||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 109 | if (e->isEffectLoaded(QStringLiteral("kwin4_effect_fade"))) { | |||
111 | e->unloadEffect(QStringLiteral("kwin4_effect_fade")); | 110 | e->unloadEffect(QStringLiteral("kwin4_effect_fade")); | ||
112 | } | 111 | } | ||
113 | QVERIFY(!e->isEffectLoaded(QStringLiteral("kwin4_effect_fade"))); | 112 | QVERIFY(!e->isEffectLoaded(QStringLiteral("kwin4_effect_fade"))); | ||
114 | m_fadeEffect = nullptr; | 113 | m_fadeEffect = nullptr; | ||
115 | } | 114 | } | ||
116 | 115 | | |||
117 | void FadeTest::testWindowCloseAfterWindowHidden_data() | 116 | void FadeTest::testWindowCloseAfterWindowHidden_data() | ||
118 | { | 117 | { | ||
119 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 118 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
120 | 119 | | |||
121 | QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; | 120 | QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; | ||
122 | QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; | 121 | QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; | ||
123 | QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; | 122 | QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; | ||
124 | } | 123 | } | ||
125 | 124 | | |||
126 | void FadeTest::testWindowCloseAfterWindowHidden() | 125 | void FadeTest::testWindowCloseAfterWindowHidden() | ||
127 | { | 126 | { | ||
128 | // this test simulates the showing/hiding/closing of a Wayland window | 127 | // this test simulates the showing/hiding/closing of a Wayland window | ||
129 | // especially the situation that a window got unmapped and destroyed way later | 128 | // especially the situation that a window got unmapped and destroyed way later | ||
130 | QVERIFY(!m_fadeEffect->isActive()); | 129 | QVERIFY(!m_fadeEffect->isActive()); | ||
131 | 130 | | |||
132 | QSignalSpy windowAddedSpy(effects, &EffectsHandler::windowAdded); | 131 | QSignalSpy windowAddedSpy(effects, &EffectsHandler::windowAdded); | ||
133 | QVERIFY(windowAddedSpy.isValid()); | 132 | QVERIFY(windowAddedSpy.isValid()); | ||
134 | QSignalSpy windowHiddenSpy(effects, &EffectsHandler::windowHidden); | 133 | QSignalSpy windowHiddenSpy(effects, &EffectsHandler::windowHidden); | ||
135 | QVERIFY(windowHiddenSpy.isValid()); | 134 | QVERIFY(windowHiddenSpy.isValid()); | ||
136 | QSignalSpy windowShownSpy(effects, &EffectsHandler::windowShown); | 135 | QSignalSpy windowShownSpy(effects, &EffectsHandler::windowShown); | ||
137 | QVERIFY(windowShownSpy.isValid()); | 136 | QVERIFY(windowShownSpy.isValid()); | ||
138 | QSignalSpy windowClosedSpy(effects, &EffectsHandler::windowClosed); | 137 | QSignalSpy windowClosedSpy(effects, &EffectsHandler::windowClosed); | ||
139 | QVERIFY(windowClosedSpy.isValid()); | 138 | QVERIFY(windowClosedSpy.isValid()); | ||
140 | 139 | | |||
141 | QScopedPointer<Surface> surface(Test::createSurface()); | 140 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
142 | QFETCH(Test::ShellSurfaceType, type); | 141 | QFETCH(Test::XdgShellSurfaceType, type); | ||
143 | QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data())); | 142 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | ||
144 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 143 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
145 | QVERIFY(c); | 144 | QVERIFY(c); | ||
146 | QTRY_COMPARE(windowAddedSpy.count(), 1); | 145 | QTRY_COMPARE(windowAddedSpy.count(), 1); | ||
147 | QTRY_COMPARE(m_fadeEffect->isActive(), true); | 146 | QTRY_COMPARE(m_fadeEffect->isActive(), true); | ||
148 | 147 | | |||
149 | QTest::qWait(500); | 148 | QTest::qWait(500); | ||
150 | QTRY_COMPARE(m_fadeEffect->isActive(), false); | 149 | QTRY_COMPARE(m_fadeEffect->isActive(), false); | ||
151 | 150 | | |||
Show All 32 Lines |