Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/debug_console_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 "platform.h" | | |||
22 | #include "debug_console.h" | 21 | #include "debug_console.h" | ||
22 | #include "internal_client.h" | ||||
23 | #include "platform.h" | ||||
23 | #include "screens.h" | 24 | #include "screens.h" | ||
24 | #include "shell_client.h" | 25 | #include "shell_client.h" | ||
25 | #include "wayland_server.h" | 26 | #include "wayland_server.h" | ||
27 | #include "workspace.h" | ||||
26 | #include "xcbutils.h" | 28 | #include "xcbutils.h" | ||
27 | 29 | | |||
28 | #include <KWayland/Client/connection_thread.h> | 30 | #include <KWayland/Client/connection_thread.h> | ||
29 | #include <KWayland/Client/compositor.h> | 31 | #include <KWayland/Client/compositor.h> | ||
30 | #include <KWayland/Client/shell.h> | 32 | #include <KWayland/Client/shell.h> | ||
31 | #include <KWayland/Client/shm_pool.h> | 33 | #include <KWayland/Client/shm_pool.h> | ||
32 | #include <KWayland/Client/surface.h> | 34 | #include <KWayland/Client/surface.h> | ||
33 | 35 | | |||
Show All 18 Lines | 47 | private Q_SLOTS: | |||
52 | void testWaylandClient_data(); | 54 | void testWaylandClient_data(); | ||
53 | void testWaylandClient(); | 55 | void testWaylandClient(); | ||
54 | void testInternalWindow(); | 56 | void testInternalWindow(); | ||
55 | void testClosingDebugConsole(); | 57 | void testClosingDebugConsole(); | ||
56 | }; | 58 | }; | ||
57 | 59 | | |||
58 | void DebugConsoleTest::initTestCase() | 60 | void DebugConsoleTest::initTestCase() | ||
59 | { | 61 | { | ||
60 | qRegisterMetaType<KWin::ShellClient*>(); | | |||
61 | qRegisterMetaType<KWin::AbstractClient*>(); | 62 | qRegisterMetaType<KWin::AbstractClient *>(); | ||
63 | qRegisterMetaType<KWin::InternalClient *>(); | ||||
64 | qRegisterMetaType<KWin::ShellClient *>(); | ||||
62 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 65 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
63 | QVERIFY(workspaceCreatedSpy.isValid()); | 66 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
64 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 67 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
65 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 68 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
66 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | 69 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | ||
67 | 70 | | |||
68 | kwinApp()->start(); | 71 | kwinApp()->start(); | ||
69 | QVERIFY(workspaceCreatedSpy.wait()); | 72 | QVERIFY(workspaceCreatedSpy.wait()); | ||
▲ Show 20 Lines • Show All 422 Lines • ▼ Show 20 Line(s) | 440 | { | |||
492 | 495 | | |||
493 | // now close the window again, it should be removed from the model | 496 | // now close the window again, it should be removed from the model | ||
494 | QSignalSpy rowsRemovedSpy(&model, &QAbstractItemModel::rowsRemoved); | 497 | QSignalSpy rowsRemovedSpy(&model, &QAbstractItemModel::rowsRemoved); | ||
495 | QVERIFY(rowsRemovedSpy.isValid()); | 498 | QVERIFY(rowsRemovedSpy.isValid()); | ||
496 | 499 | | |||
497 | w->hide(); | 500 | w->hide(); | ||
498 | w.reset(); | 501 | w.reset(); | ||
499 | 502 | | |||
500 | QVERIFY(rowsRemovedSpy.wait()); | 503 | QTRY_COMPARE(rowsRemovedSpy.count(), 1); | ||
501 | QCOMPARE(rowsRemovedSpy.count(), 1); | | |||
502 | QCOMPARE(rowsRemovedSpy.first().first().value<QModelIndex>(), internalTopLevelIndex); | 504 | QCOMPARE(rowsRemovedSpy.first().first().value<QModelIndex>(), internalTopLevelIndex); | ||
503 | } | 505 | } | ||
504 | 506 | | |||
505 | void DebugConsoleTest::testClosingDebugConsole() | 507 | void DebugConsoleTest::testClosingDebugConsole() | ||
506 | { | 508 | { | ||
507 | // this test verifies that the DebugConsole gets destroyed when closing the window | 509 | // this test verifies that the DebugConsole gets destroyed when closing the window | ||
508 | // BUG: 369858 | 510 | // BUG: 369858 | ||
509 | 511 | | |||
510 | DebugConsole *console = new DebugConsole; | 512 | DebugConsole *console = new DebugConsole; | ||
511 | QSignalSpy destroyedSpy(console, &QObject::destroyed); | 513 | QSignalSpy destroyedSpy(console, &QObject::destroyed); | ||
512 | QVERIFY(destroyedSpy.isValid()); | 514 | QVERIFY(destroyedSpy.isValid()); | ||
513 | 515 | | |||
514 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 516 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
515 | QVERIFY(clientAddedSpy.isValid()); | 517 | QVERIFY(clientAddedSpy.isValid()); | ||
516 | console->show(); | 518 | console->show(); | ||
517 | QCOMPARE(console->windowHandle()->isVisible(), true); | 519 | QCOMPARE(console->windowHandle()->isVisible(), true); | ||
518 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 520 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
519 | ShellClient *c = clientAddedSpy.first().first().value<ShellClient*>(); | 521 | InternalClient *c = clientAddedSpy.first().first().value<InternalClient *>(); | ||
520 | QVERIFY(c->isInternal()); | 522 | QVERIFY(c->isInternal()); | ||
521 | QCOMPARE(c->internalWindow(), console->windowHandle()); | 523 | QCOMPARE(c->internalWindow(), console->windowHandle()); | ||
522 | QVERIFY(c->isDecorated()); | 524 | QVERIFY(c->isDecorated()); | ||
523 | QCOMPARE(c->isMinimizable(), false); | 525 | QCOMPARE(c->isMinimizable(), false); | ||
524 | c->closeWindow(); | 526 | c->closeWindow(); | ||
525 | QVERIFY(destroyedSpy.wait()); | 527 | QVERIFY(destroyedSpy.wait()); | ||
526 | } | 528 | } | ||
527 | 529 | | |||
528 | } | 530 | } | ||
529 | 531 | | |||
530 | WAYLANDTEST_MAIN(KWin::DebugConsoleTest) | 532 | WAYLANDTEST_MAIN(KWin::DebugConsoleTest) | ||
531 | #include "debug_console_test.moc" | 533 | #include "debug_console_test.moc" |