Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/globalshortcuts_test.cpp
Show All 15 Lines | |||||
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 "client.h" | 21 | #include "client.h" | ||
22 | #include "cursor.h" | 22 | #include "cursor.h" | ||
23 | #include "input.h" | 23 | #include "input.h" | ||
24 | #include "internal_client.h" | ||||
24 | #include "platform.h" | 25 | #include "platform.h" | ||
25 | #include "screens.h" | 26 | #include "screens.h" | ||
26 | #include "shell_client.h" | 27 | #include "shell_client.h" | ||
27 | #include "useractions.h" | 28 | #include "useractions.h" | ||
28 | #include "wayland_server.h" | 29 | #include "wayland_server.h" | ||
29 | #include "workspace.h" | 30 | #include "workspace.h" | ||
30 | 31 | | |||
31 | #include <KWayland/Client/shell.h> | 32 | #include <KWayland/Client/shell.h> | ||
Show All 26 Lines | 50 | private Q_SLOTS: | |||
58 | void testComponseKey(); | 59 | void testComponseKey(); | ||
59 | void testX11ClientShortcut(); | 60 | void testX11ClientShortcut(); | ||
60 | void testWaylandClientShortcut(); | 61 | void testWaylandClientShortcut(); | ||
61 | void testSetupWindowShortcut(); | 62 | void testSetupWindowShortcut(); | ||
62 | }; | 63 | }; | ||
63 | 64 | | |||
64 | void GlobalShortcutsTest::initTestCase() | 65 | void GlobalShortcutsTest::initTestCase() | ||
65 | { | 66 | { | ||
66 | qRegisterMetaType<KWin::ShellClient*>(); | | |||
67 | qRegisterMetaType<KWin::AbstractClient*>(); | 67 | qRegisterMetaType<KWin::AbstractClient *>(); | ||
68 | qRegisterMetaType<KWin::InternalClient *>(); | ||||
69 | qRegisterMetaType<KWin::ShellClient *>(); | ||||
68 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 70 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
69 | QVERIFY(workspaceCreatedSpy.isValid()); | 71 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
70 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 72 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
71 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 73 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
72 | 74 | | |||
73 | kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); | 75 | kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); | ||
74 | qputenv("KWIN_XKB_DEFAULT_KEYMAP", "1"); | 76 | qputenv("KWIN_XKB_DEFAULT_KEYMAP", "1"); | ||
75 | qputenv("XKB_DEFAULT_RULES", "evdev"); | 77 | qputenv("XKB_DEFAULT_RULES", "evdev"); | ||
▲ Show 20 Lines • Show All 265 Lines • ▼ Show 20 Line(s) | 342 | { | |||
341 | QScopedPointer<Surface> surface(Test::createSurface()); | 343 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
342 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 344 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | ||
343 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 345 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
344 | 346 | | |||
345 | QCOMPARE(workspace()->activeClient(), client); | 347 | QCOMPARE(workspace()->activeClient(), client); | ||
346 | QVERIFY(client->isActive()); | 348 | QVERIFY(client->isActive()); | ||
347 | QCOMPARE(client->shortcut(), QKeySequence()); | 349 | QCOMPARE(client->shortcut(), QKeySequence()); | ||
348 | 350 | | |||
349 | QSignalSpy shortcutDialogAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 351 | QSignalSpy shortcutDialogAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
350 | QVERIFY(shortcutDialogAddedSpy.isValid()); | 352 | QVERIFY(shortcutDialogAddedSpy.isValid()); | ||
351 | workspace()->slotSetupWindowShortcut(); | 353 | workspace()->slotSetupWindowShortcut(); | ||
352 | QTRY_COMPARE(shortcutDialogAddedSpy.count(), 1); | 354 | QTRY_COMPARE(shortcutDialogAddedSpy.count(), 1); | ||
353 | auto dialog = shortcutDialogAddedSpy.first().first().value<ShellClient*>(); | 355 | auto dialog = shortcutDialogAddedSpy.first().first().value<InternalClient *>(); | ||
354 | QVERIFY(dialog); | 356 | QVERIFY(dialog); | ||
355 | QVERIFY(dialog->isInternal()); | 357 | QVERIFY(dialog->isInternal()); | ||
356 | auto sequenceEdit = workspace()->shortcutDialog()->findChild<QKeySequenceEdit*>(); | 358 | auto sequenceEdit = workspace()->shortcutDialog()->findChild<QKeySequenceEdit*>(); | ||
357 | QVERIFY(sequenceEdit); | 359 | QVERIFY(sequenceEdit); | ||
358 | 360 | | |||
359 | // the QKeySequenceEdit field does not get focus, we need to pass it focus manually | 361 | // the QKeySequenceEdit field does not get focus, we need to pass it focus manually | ||
360 | QEXPECT_FAIL("", "Edit does not have focus", Continue); | 362 | QEXPECT_FAIL("", "Edit does not have focus", Continue); | ||
361 | QVERIFY(sequenceEdit->hasFocus()); | 363 | QVERIFY(sequenceEdit->hasFocus()); | ||
Show All 21 Lines |