2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2017-06-18 19:01:30 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
|
2017-06-18 19:01:30 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2017-06-18 19:01:30 +00:00
|
|
|
#include "kwin_wayland_test.h"
|
2022-03-23 10:13:38 +00:00
|
|
|
|
2022-08-29 07:55:49 +00:00
|
|
|
#include "core/platform.h"
|
2017-06-18 19:01:30 +00:00
|
|
|
#include "keyboard_input.h"
|
|
|
|
#include "keyboard_layout.h"
|
|
|
|
#include "virtualdesktops.h"
|
|
|
|
#include "wayland_server.h"
|
2022-04-22 17:39:12 +00:00
|
|
|
#include "window.h"
|
2017-06-18 19:01:30 +00:00
|
|
|
#include "workspace.h"
|
|
|
|
|
|
|
|
#include <KConfigGroup>
|
|
|
|
#include <KGlobalAccel>
|
|
|
|
|
|
|
|
#include <linux/input.h>
|
|
|
|
|
|
|
|
using namespace KWin;
|
|
|
|
using namespace KWayland::Client;
|
|
|
|
|
|
|
|
static const QString s_socketName = QStringLiteral("wayland_test_kwin_keymap_creation_failure-0");
|
|
|
|
|
|
|
|
class KeymapCreationFailureTest : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
private Q_SLOTS:
|
|
|
|
void initTestCase();
|
|
|
|
void init();
|
|
|
|
void cleanup();
|
|
|
|
|
|
|
|
void testPointerButton();
|
|
|
|
};
|
|
|
|
|
|
|
|
void KeymapCreationFailureTest::initTestCase()
|
|
|
|
{
|
|
|
|
// situation for for BUG 381210
|
|
|
|
// this will fail to create keymap
|
|
|
|
qputenv("XKB_DEFAULT_RULES", "no");
|
|
|
|
qputenv("XKB_DEFAULT_MODEL", "no");
|
|
|
|
qputenv("XKB_DEFAULT_LAYOUT", "no");
|
|
|
|
qputenv("XKB_DEFAULT_VARIANT", "no");
|
|
|
|
qputenv("XKB_DEFAULT_OPTIONS", "no");
|
|
|
|
|
2022-04-22 17:39:12 +00:00
|
|
|
qRegisterMetaType<KWin::Window *>();
|
2020-07-07 09:32:29 +00:00
|
|
|
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
2017-06-18 19:01:30 +00:00
|
|
|
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
2020-12-09 13:06:15 +00:00
|
|
|
QVERIFY(waylandServer()->init(s_socketName));
|
2017-06-18 19:01:30 +00:00
|
|
|
|
|
|
|
kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig));
|
|
|
|
kwinApp()->setKxkbConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig));
|
|
|
|
KConfigGroup layoutGroup = kwinApp()->kxkbConfig()->group("Layout");
|
|
|
|
layoutGroup.writeEntry("LayoutList", QStringLiteral("no"));
|
|
|
|
layoutGroup.writeEntry("Model", "no");
|
|
|
|
layoutGroup.writeEntry("Options", "no");
|
|
|
|
layoutGroup.sync();
|
|
|
|
|
|
|
|
kwinApp()->start();
|
2020-07-07 09:32:29 +00:00
|
|
|
QVERIFY(applicationStartedSpy.wait());
|
2017-06-18 19:01:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KeymapCreationFailureTest::init()
|
|
|
|
{
|
|
|
|
QVERIFY(Test::setupWaylandConnection());
|
|
|
|
}
|
|
|
|
|
|
|
|
void KeymapCreationFailureTest::cleanup()
|
|
|
|
{
|
|
|
|
Test::destroyWaylandConnection();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KeymapCreationFailureTest::testPointerButton()
|
|
|
|
{
|
|
|
|
// test case for BUG 381210
|
|
|
|
// pressing a pointer button results in crash
|
|
|
|
|
|
|
|
// now create the crashing condition
|
|
|
|
// which is sending in a pointer event
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonPressed(BTN_LEFT, 0);
|
|
|
|
Test::pointerButtonReleased(BTN_LEFT, 1);
|
2017-06-18 19:01:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WAYLANDTEST_MAIN(KeymapCreationFailureTest)
|
|
|
|
#include "keymap_creation_failure_test.moc"
|