Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/maximize_test.cpp
Show All 12 Lines | |||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "kwin_wayland_test.h" | 20 | #include "kwin_wayland_test.h" | ||
21 | #include "abstract_client.h" | ||||
21 | #include "cursor.h" | 22 | #include "cursor.h" | ||
22 | #include "decorations/decorationbridge.h" | 23 | #include "decorations/decorationbridge.h" | ||
23 | #include "decorations/settings.h" | 24 | #include "decorations/settings.h" | ||
24 | #include "platform.h" | 25 | #include "platform.h" | ||
25 | #include "xdgshellclient.h" | | |||
26 | #include "screens.h" | 26 | #include "screens.h" | ||
27 | #include "wayland_server.h" | 27 | #include "wayland_server.h" | ||
28 | #include "workspace.h" | 28 | #include "workspace.h" | ||
29 | 29 | | |||
30 | #include <KWayland/Client/compositor.h> | 30 | #include <KWayland/Client/compositor.h> | ||
31 | #include <KWayland/Client/shm_pool.h> | 31 | #include <KWayland/Client/shm_pool.h> | ||
32 | #include <KWayland/Client/surface.h> | 32 | #include <KWayland/Client/surface.h> | ||
33 | #include <KWayland/Client/server_decoration.h> | 33 | #include <KWayland/Client/server_decoration.h> | ||
Show All 22 Lines | 51 | private Q_SLOTS: | |||
56 | void testMaximizedPassedToDeco(); | 56 | void testMaximizedPassedToDeco(); | ||
57 | void testInitiallyMaximized(); | 57 | void testInitiallyMaximized(); | ||
58 | void testBorderlessMaximizedWindow(); | 58 | void testBorderlessMaximizedWindow(); | ||
59 | void testBorderlessMaximizedWindowNoClientSideDecoration(); | 59 | void testBorderlessMaximizedWindowNoClientSideDecoration(); | ||
60 | }; | 60 | }; | ||
61 | 61 | | |||
62 | void TestMaximized::initTestCase() | 62 | void TestMaximized::initTestCase() | ||
63 | { | 63 | { | ||
64 | qRegisterMetaType<KWin::XdgShellClient *>(); | | |||
65 | qRegisterMetaType<KWin::AbstractClient*>(); | 64 | qRegisterMetaType<KWin::AbstractClient*>(); | ||
66 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 65 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
67 | QVERIFY(workspaceCreatedSpy.isValid()); | 66 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
68 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 67 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
69 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 68 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
70 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | 69 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | ||
71 | 70 | | |||
72 | kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); | 71 | kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); | ||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | 182 | { | |||
197 | QVERIFY(configureRequestedSpy.wait()); | 196 | QVERIFY(configureRequestedSpy.wait()); | ||
198 | QCOMPARE(configureRequestedSpy.count(), 1); | 197 | QCOMPARE(configureRequestedSpy.count(), 1); | ||
199 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | 198 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
200 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | 199 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||
201 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | 200 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||
202 | 201 | | |||
203 | // Now let's render in an incorrect size. | 202 | // Now let's render in an incorrect size. | ||
204 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 203 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
205 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 204 | AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
206 | QVERIFY(client); | 205 | QVERIFY(client); | ||
207 | QCOMPARE(client->frameGeometry(), QRect(0, 0, 100, 50)); | 206 | QCOMPARE(client->frameGeometry(), QRect(0, 0, 100, 50)); | ||
208 | QEXPECT_FAIL("", "Should go out of maximzied", Continue); | 207 | QEXPECT_FAIL("", "Should go out of maximzied", Continue); | ||
209 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | 208 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | ||
210 | 209 | | |||
211 | // Destroy the client. | 210 | // Destroy the client. | ||
212 | shellSurface.reset(); | 211 | shellSurface.reset(); | ||
213 | QVERIFY(Test::waitForWindowDestroyed(client)); | 212 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
Show All 30 Lines | 216 | { | |||
244 | QCOMPARE(configureRequestedSpy.count(), 1); | 243 | QCOMPARE(configureRequestedSpy.count(), 1); | ||
245 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(0, 0)); | 244 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(0, 0)); | ||
246 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | 245 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
247 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | 246 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||
248 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | 247 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||
249 | 248 | | |||
250 | // Map the client. | 249 | // Map the client. | ||
251 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 250 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
252 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 251 | AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
253 | QVERIFY(client); | 252 | QVERIFY(client); | ||
254 | QVERIFY(client->isActive()); | 253 | QVERIFY(client->isActive()); | ||
255 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | 254 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | ||
256 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); | 255 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); | ||
257 | QCOMPARE(client->isDecorated(), true); | 256 | QCOMPARE(client->isDecorated(), true); | ||
258 | 257 | | |||
259 | // We should receive a configure event when the client becomes active. | 258 | // We should receive a configure event when the client becomes active. | ||
260 | QVERIFY(configureRequestedSpy.wait()); | 259 | QVERIFY(configureRequestedSpy.wait()); | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 308 | { | |||
321 | QScopedPointer<XdgShellSurface> xdgShellSurface(Test::createXdgShellStableSurface(surface.data())); | 320 | QScopedPointer<XdgShellSurface> xdgShellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
322 | QScopedPointer<XdgDecoration> deco(Test::xdgDecorationManager()->getToplevelDecoration(xdgShellSurface.data())); | 321 | QScopedPointer<XdgDecoration> deco(Test::xdgDecorationManager()->getToplevelDecoration(xdgShellSurface.data())); | ||
323 | 322 | | |||
324 | QSignalSpy decorationConfiguredSpy(deco.data(), &XdgDecoration::modeChanged); | 323 | QSignalSpy decorationConfiguredSpy(deco.data(), &XdgDecoration::modeChanged); | ||
325 | QVERIFY(decorationConfiguredSpy.isValid()); | 324 | QVERIFY(decorationConfiguredSpy.isValid()); | ||
326 | 325 | | |||
327 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 326 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
328 | 327 | | |||
329 | QSignalSpy frameGeometryChangedSpy(client, &XdgShellClient::frameGeometryChanged); | 328 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | ||
330 | QVERIFY(frameGeometryChangedSpy.isValid()); | 329 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
331 | QSignalSpy sizeChangeRequestedSpy(xdgShellSurface.data(), &XdgShellSurface::sizeChanged); | 330 | QSignalSpy sizeChangeRequestedSpy(xdgShellSurface.data(), &XdgShellSurface::sizeChanged); | ||
332 | QVERIFY(sizeChangeRequestedSpy.isValid()); | 331 | QVERIFY(sizeChangeRequestedSpy.isValid()); | ||
333 | QSignalSpy configureRequestedSpy(xdgShellSurface.data(), &XdgShellSurface::configureRequested); | 332 | QSignalSpy configureRequestedSpy(xdgShellSurface.data(), &XdgShellSurface::configureRequested); | ||
334 | QVERIFY(configureRequestedSpy.isValid()); | 333 | QVERIFY(configureRequestedSpy.isValid()); | ||
335 | 334 | | |||
336 | QVERIFY(client->isDecorated()); | 335 | QVERIFY(client->isDecorated()); | ||
337 | QVERIFY(!client->noBorder()); | 336 | QVERIFY(!client->noBorder()); | ||
Show All 39 Lines |