Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/dont_crash_cursor_physical_size_empty.cpp
Show All 27 Lines | |||||
28 | #include "screens.h" | 28 | #include "screens.h" | ||
29 | #include "wayland_server.h" | 29 | #include "wayland_server.h" | ||
30 | #include "workspace.h" | 30 | #include "workspace.h" | ||
31 | 31 | | |||
32 | #include <KConfigGroup> | 32 | #include <KConfigGroup> | ||
33 | 33 | | |||
34 | #include <KWayland/Client/seat.h> | 34 | #include <KWayland/Client/seat.h> | ||
35 | #include <KWayland/Client/server_decoration.h> | 35 | #include <KWayland/Client/server_decoration.h> | ||
36 | #include <KWayland/Client/xdgshell.h> | | |||
37 | #include <KWayland/Client/surface.h> | 36 | #include <KWayland/Client/surface.h> | ||
38 | #include <KWayland/Server/display.h> | 37 | #include <KWayland/Server/display.h> | ||
39 | #include <KWayland/Server/output_interface.h> | 38 | #include <KWayland/Server/output_interface.h> | ||
40 | 39 | | |||
41 | using namespace KWin; | 40 | using namespace KWin; | ||
42 | using namespace KWayland::Client; | 41 | using namespace KWayland::Client; | ||
43 | static const QString s_socketName = QStringLiteral("wayland_test_kwin_crash_cursor_physical_size_empty-0"); | 42 | static const QString s_socketName = QStringLiteral("wayland_test_kwin_crash_cursor_physical_size_empty-0"); | ||
44 | 43 | | |||
Show All 39 Lines | 69 | { | |||
84 | qputenv("XCURSOR_SIZE", QByteArrayLiteral("0")); | 83 | qputenv("XCURSOR_SIZE", QByteArrayLiteral("0")); | ||
85 | 84 | | |||
86 | kwinApp()->start(); | 85 | kwinApp()->start(); | ||
87 | QVERIFY(workspaceCreatedSpy.wait()); | 86 | QVERIFY(workspaceCreatedSpy.wait()); | ||
88 | } | 87 | } | ||
89 | 88 | | |||
90 | void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco_data() | 89 | void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco_data() | ||
91 | { | 90 | { | ||
92 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 91 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
93 | 92 | | |||
94 | QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; | 93 | QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; | ||
95 | QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; | 94 | QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; | ||
96 | QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; | 95 | QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; | ||
97 | QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; | | |||
98 | } | 96 | } | ||
99 | 97 | | |||
100 | void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco() | 98 | void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco() | ||
101 | { | 99 | { | ||
102 | // This test ensures that there is no endless recursion if the cursor theme cannot be created | 100 | // This test ensures that there is no endless recursion if the cursor theme cannot be created | ||
103 | // a reason for creation failure could be physical size not existing | 101 | // a reason for creation failure could be physical size not existing | ||
104 | // see BUG: 390314 | 102 | // see BUG: 390314 | ||
105 | QScopedPointer<Surface> surface(Test::createSurface()); | 103 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
106 | QFETCH(Test::ShellSurfaceType, type); | 104 | QFETCH(Test::XdgShellSurfaceType, type); | ||
107 | Test::waylandServerSideDecoration()->create(surface.data(), surface.data()); | 105 | Test::waylandServerSideDecoration()->create(surface.data(), surface.data()); | ||
108 | QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data())); | 106 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | ||
109 | 107 | | |||
110 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 108 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
111 | QVERIFY(c); | 109 | QVERIFY(c); | ||
112 | QVERIFY(c->isDecorated()); | 110 | QVERIFY(c->isDecorated()); | ||
113 | 111 | | |||
114 | // destroy physical size | 112 | // destroy physical size | ||
115 | KWayland::Server::Display *display = waylandServer()->display(); | 113 | KWayland::Server::Display *display = waylandServer()->display(); | ||
116 | auto output = display->outputs().first(); | 114 | auto output = display->outputs().first(); | ||
Show All 9 Lines |