Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/scripting/minimizeall_test.cpp
Show All 14 Lines | |||||
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 | 20 | | |||
21 | #include "kwin_wayland_test.h" | 21 | #include "kwin_wayland_test.h" | ||
22 | 22 | | |||
23 | #include "abstract_client.h" | ||||
23 | #include "platform.h" | 24 | #include "platform.h" | ||
24 | #include "screens.h" | 25 | #include "screens.h" | ||
25 | #include "scripting/scripting.h" | 26 | #include "scripting/scripting.h" | ||
26 | #include "wayland_server.h" | 27 | #include "wayland_server.h" | ||
27 | #include "workspace.h" | 28 | #include "workspace.h" | ||
28 | #include "xdgshellclient.h" | | |||
29 | 29 | | |||
30 | #include <KPackage/PackageLoader> | 30 | #include <KPackage/PackageLoader> | ||
31 | #include <KWayland/Client/surface.h> | 31 | #include <KWayland/Client/surface.h> | ||
32 | 32 | | |||
33 | #include <linux/input.h> | 33 | #include <linux/input.h> | ||
34 | 34 | | |||
35 | namespace KWin | 35 | namespace KWin | ||
36 | { | 36 | { | ||
Show All 13 Lines | 45 | private Q_SLOTS: | |||
50 | void testMinimizeUnminimize(); | 50 | void testMinimizeUnminimize(); | ||
51 | }; | 51 | }; | ||
52 | 52 | | |||
53 | void MinimizeAllScriptTest::initTestCase() | 53 | void MinimizeAllScriptTest::initTestCase() | ||
54 | { | 54 | { | ||
55 | qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8()); | 55 | qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8()); | ||
56 | 56 | | |||
57 | qRegisterMetaType<AbstractClient *>(); | 57 | qRegisterMetaType<AbstractClient *>(); | ||
58 | qRegisterMetaType<XdgShellClient *>(); | | |||
59 | 58 | | |||
60 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 59 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
61 | QVERIFY(workspaceCreatedSpy.isValid()); | 60 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
62 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 61 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
63 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 62 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
64 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | 63 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | ||
65 | 64 | | |||
66 | kwinApp()->start(); | 65 | kwinApp()->start(); | ||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | 115 | { | |||
117 | // This test verifies that all windows are minimized when Meta+Shift+D | 116 | // This test verifies that all windows are minimized when Meta+Shift+D | ||
118 | // is pressed, and unminimized when the shortcut is pressed once again. | 117 | // is pressed, and unminimized when the shortcut is pressed once again. | ||
119 | 118 | | |||
120 | using namespace KWayland::Client; | 119 | using namespace KWayland::Client; | ||
121 | 120 | | |||
122 | // Create a couple of test clients. | 121 | // Create a couple of test clients. | ||
123 | QScopedPointer<Surface> surface1(Test::createSurface()); | 122 | QScopedPointer<Surface> surface1(Test::createSurface()); | ||
124 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | 123 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | ||
125 | XdgShellClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | 124 | AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | ||
126 | QVERIFY(client1); | 125 | QVERIFY(client1); | ||
127 | QVERIFY(client1->isActive()); | 126 | QVERIFY(client1->isActive()); | ||
128 | QVERIFY(client1->isMinimizable()); | 127 | QVERIFY(client1->isMinimizable()); | ||
129 | 128 | | |||
130 | QScopedPointer<Surface> surface2(Test::createSurface()); | 129 | QScopedPointer<Surface> surface2(Test::createSurface()); | ||
131 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | 130 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | ||
132 | XdgShellClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::red); | 131 | AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::red); | ||
133 | QVERIFY(client2); | 132 | QVERIFY(client2); | ||
134 | QVERIFY(client2->isActive()); | 133 | QVERIFY(client2->isActive()); | ||
135 | QVERIFY(client2->isMinimizable()); | 134 | QVERIFY(client2->isMinimizable()); | ||
136 | 135 | | |||
137 | // Minimize the windows. | 136 | // Minimize the windows. | ||
138 | quint32 timestamp = 1; | 137 | quint32 timestamp = 1; | ||
139 | kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); | 138 | kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); | ||
140 | kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); | 139 | kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); | ||
Show All 30 Lines |