File indexing completed on 2024-11-10 04:56:22
0001 /* 0002 SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 // Qt 0007 #include <QSignalSpy> 0008 #include <QTest> 0009 // WaylandServer 0010 #include "wayland/display.h" 0011 0012 using namespace KWin; 0013 0014 class NoXdgRuntimeDirTest : public QObject 0015 { 0016 Q_OBJECT 0017 private Q_SLOTS: 0018 void initTestCase(); 0019 void testCreate(); 0020 }; 0021 0022 void NoXdgRuntimeDirTest::initTestCase() 0023 { 0024 qunsetenv("XDG_RUNTIME_DIR"); 0025 } 0026 0027 void NoXdgRuntimeDirTest::testCreate() 0028 { 0029 // this test verifies that not having an XDG_RUNTIME_DIR is handled gracefully 0030 // the server cannot start, but should not crash 0031 const QString testSocketName = QStringLiteral("kwayland-test-no-xdg-runtime-dir-0"); 0032 KWin::Display display; 0033 QSignalSpy runningSpy(&display, &KWin::Display::runningChanged); 0034 QVERIFY(!display.addSocketName(testSocketName)); 0035 display.start(); 0036 0037 // call into dispatchEvents should not crash 0038 display.dispatchEvents(); 0039 } 0040 0041 QTEST_GUILESS_MAIN(NoXdgRuntimeDirTest) 0042 #include "test_no_xdg_runtime_dir.moc"