KWin
Loading...
Searching...
No Matches
test_no_xdg_runtime_dir.cpp
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6// Qt
7#include <QSignalSpy>
8#include <QTest>
9// WaylandServer
10#include "wayland/display.h"
11
12using namespace KWin;
13
14class NoXdgRuntimeDirTest : public QObject
15{
16 Q_OBJECT
17private Q_SLOTS:
18 void initTestCase();
19 void testCreate();
20};
21
22void NoXdgRuntimeDirTest::initTestCase()
23{
24 qunsetenv("XDG_RUNTIME_DIR");
25}
26
27void NoXdgRuntimeDirTest::testCreate()
28{
29 // this test verifies that not having an XDG_RUNTIME_DIR is handled gracefully
30 // the server cannot start, but should not crash
31 const QString testSocketName = QStringLiteral("kwayland-test-no-xdg-runtime-dir-0");
32 KWin::Display display;
33 QSignalSpy runningSpy(&display, &KWin::Display::runningChanged);
34 QVERIFY(!display.addSocketName(testSocketName));
35 display.start();
36
37 // call into dispatchEvents should not crash
38 display.dispatchEvents();
39}
40
41QTEST_GUILESS_MAIN(NoXdgRuntimeDirTest)
42#include "test_no_xdg_runtime_dir.moc"
Class holding the Wayland server display loop.
Definition display.h:34
void dispatchEvents()
Definition display.cpp:116
bool addSocketName(const QString &name=QString())
Definition display.cpp:68
bool start()
Definition display.cpp:92