Run clang-format

The .clang-format file is based on the one in ECM except the following
style options:

 - AlwaysBreakBeforeMultilineStrings
 - BinPackArguments
 - BinPackParameters
 - ColumnLimit
 - BreakBeforeBraces
 - KeepEmptyLinesAtTheStartOfBlocks
This commit is contained in:
Vlad Zahorodnii 2022-03-23 12:13:38 +02:00
parent 68a8fa6034
commit 7096e3ead8
744 changed files with 17960 additions and 16741 deletions

83
.clang-format Normal file
View file

@ -0,0 +1,83 @@
---
---
# SPDX-FileCopyrightText: 2019 Christoph Cullmann <cullmann@kde.org>
# SPDX-FileCopyrightText: 2019 Gernot Gebhard <gebhard@absint.com>
#
# SPDX-License-Identifier: MIT
---
Language: JavaScript
DisableFormat: true
---
# Style for C++
Language: Cpp
Standard: c++17
# base is WebKit coding style: https://webkit.org/code-style-guidelines/
# below are only things set that diverge from this style!
BasedOnStyle: WebKit
# 4 spaces indent
TabWidth: 4
# No line limit
ColumnLimit: 0
# sort includes inside line separated groups
SortIncludes: true
# Braces are usually attached, but not after functions or class declarations.
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: true
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
# CrlInstruction *a;
PointerAlignment: Right
# horizontally aligns arguments after an open bracket.
AlignAfterOpenBracket: Align
# don't move all parameters to new line
AllowAllParametersOfDeclarationOnNextLine: false
# no single line functions
AllowShortFunctionsOnASingleLine: None
# In case we have an if statement with multiple lines the operator should be at the beginning of the line
# but we do not want to break assignments
BreakBeforeBinaryOperators: NonAssignment
# format C++11 braced lists like function calls
Cpp11BracedListStyle: true
# do not put a space before C++11 braced lists
SpaceBeforeCpp11BracedList: false
# no namespace indentation to keep indent level low
NamespaceIndentation: None
# we use template< without space.
SpaceAfterTemplateKeyword: false
# Always break after template declaration
AlwaysBreakTemplateDeclarations: true
# macros for which the opening brace stays attached.
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE , wl_resource_for_each, wl_resource_for_each_safe ]
# keep lambda formatting multi-line if not empty
AllowShortLambdasOnASingleLine: Empty
# We do not want clang-format to put all arguments on a new line
AllowAllArgumentsOnNextLine: false

1
.gitignore vendored
View file

@ -20,7 +20,6 @@ random_seed
/build*/
CMakeLists.txt.user*
*.unc-backup*
.clang-format
/compile_commands.json
.clangd
.idea

View file

@ -544,8 +544,7 @@ void ActivationTest::stackScreensHorizontally()
Qt::DirectConnection,
Q_ARG(int, screenGeometries.count()),
Q_ARG(QVector<QRect>, screenGeometries),
Q_ARG(QVector<int>, screenScales)
);
Q_ARG(QVector<int>, screenScales));
}
void ActivationTest::stackScreensVertically()
@ -568,8 +567,7 @@ void ActivationTest::stackScreensVertically()
Qt::DirectConnection,
Q_ARG(int, screenGeometries.count()),
Q_ARG(QVector<QRect>, screenGeometries),
Q_ARG(QVector<int>, screenScales)
);
Q_ARG(QVector<int>, screenScales));
}
}

View file

@ -7,15 +7,16 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "activities.h"
#include "x11client.h"
#include "cursor.h"
#include "deleted.h"
#include "platform.h"
#include "utils/xcbutils.h"
#include "wayland_server.h"
#include "workspace.h"
#include "utils/xcbutils.h"
#include "x11client.h"
#include <kwineffects.h>
#include <QDBusConnection>

View file

@ -25,7 +25,10 @@ class BufferSizeChangeTest : public GenericSceneOpenGLTest
{
Q_OBJECT
public:
BufferSizeChangeTest() : GenericSceneOpenGLTest(QByteArrayLiteral("O2")) {}
BufferSizeChangeTest()
: GenericSceneOpenGLTest(QByteArrayLiteral("O2"))
{
}
private Q_SLOTS:
void init();
void testShmBufferSizeChange();

View file

@ -9,15 +9,16 @@
#include "config-kwin.h"
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "atoms.h"
#include "x11client.h"
#include "deleted.h"
#include "platform.h"
#include "rules.h"
#include "virtualdesktops.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <KWayland/Client/surface.h>
@ -78,7 +79,8 @@ void TestDbusInterface::cleanup()
Test::destroyWaylandConnection();
}
namespace {
namespace
{
QDBusPendingCall getWindowInfo(const QUuid &uuid)
{
auto msg = QDBusMessage::createMethodCall(s_destination, s_path, s_interface, QStringLiteral("getWindowInfo"));
@ -114,7 +116,7 @@ void TestDbusInterface::testGetWindowInfoXdgShellClient()
auto client = clientAddedSpy.first().first().value<AbstractClient *>();
QVERIFY(client);
const QVariantMap expectedData {
const QVariantMap expectedData = {
{QStringLiteral("type"), int(NET::Normal)},
{QStringLiteral("x"), client->x()},
{QStringLiteral("y"), client->y()},
@ -219,7 +221,6 @@ void TestDbusInterface::testGetWindowInfoXdgShellClient()
QVERIFY(reply.value().empty());
}
struct XcbConnectionDeleter
{
static inline void cleanup(xcb_connection_t *pointer)
@ -261,7 +262,7 @@ void TestDbusInterface::testGetWindowInfoX11Client()
QCOMPARE(client->window(), w);
QCOMPARE(client->clientSize(), windowGeometry.size());
const QVariantMap expectedData {
const QVariantMap expectedData = {
{QStringLiteral("type"), NET::Normal},
{QStringLiteral("x"), client->x()},
{QStringLiteral("y"), client->y()},

View file

@ -7,17 +7,18 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "debug_console.h"
#include "internal_client.h"
#include "platform.h"
#include "utils/xcbutils.h"
#include "wayland_server.h"
#include "workspace.h"
#include "utils/xcbutils.h"
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/shm_pool.h>
#include <KWayland/Client/surface.h>
@ -386,7 +387,10 @@ class HelperWindow : public QRasterWindow
{
Q_OBJECT
public:
HelperWindow() : QRasterWindow(nullptr) {}
HelperWindow()
: QRasterWindow(nullptr)
{
}
~HelperWindow() override = default;
Q_SIGNALS:
@ -400,7 +404,8 @@ Q_SIGNALS:
void keyReleased();
protected:
void paintEvent(QPaintEvent *event) override {
void paintEvent(QPaintEvent *event) override
{
Q_UNUSED(event)
QPainter p(this);
p.fillRect(0, 0, width(), height(), Qt::red);

View file

@ -7,14 +7,15 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "cursor.h"
#include "internal_client.h"
#include "platform.h"
#include "pointer_input.h"
#include "touch_input.h"
#include "screens.h"
#include "touch_input.h"
#include "wayland_server.h"
#include "workspace.h"
#include <kwineffects.h>
@ -23,8 +24,8 @@
#include "decorations/decorationbridge.h"
#include "decorations/settings.h"
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/keyboard.h>
#include <KWayland/Client/pointer.h>
#include <KWayland/Client/seat.h>
@ -690,7 +691,10 @@ class EventHelper : public QObject
{
Q_OBJECT
public:
EventHelper() : QObject() {}
EventHelper()
: QObject()
{
}
~EventHelper() override = default;
bool eventFilter(QObject *watched, QEvent *event) override

View file

@ -7,15 +7,16 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "platform.h"
#include "x11client.h"
#include "cursor.h"
#include "deleted.h"
#include "platform.h"
#include "utils/xcbutils.h"
#include "wayland_server.h"
#include "workspace.h"
#include "utils/xcbutils.h"
#include "x11client.h"
#include <kwineffects.h>
#include <netwm.h>

View file

@ -7,14 +7,15 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "x11client.h"
#include "composite.h"
#include "cursor.h"
#include "platform.h"
#include "renderbackend.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <kwineffects.h>
#include <KDecoration2/Decoration>
@ -35,7 +36,6 @@ private Q_SLOTS:
void initTestCase();
void init();
void testBorderlessMaximizedWindows();
};
void DontCrashAuroraeDestroyDecoTest::initTestCase()

View file

@ -7,21 +7,22 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "platform.h"
#include "abstract_client.h"
#include "x11client.h"
#include "composite.h"
#include "deleted.h"
#include "effects.h"
#include "effectloader.h"
#include "effects.h"
#include "platform.h"
#include "scripting/scriptedeffect.h"
#include "wayland_server.h"
#include "workspace.h"
#include "scripting/scriptedeffect.h"
#include "x11client.h"
#include <KDecoration2/Decoration>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/shm_pool.h>
#include <KWayland/Client/surface.h>

View file

@ -7,14 +7,15 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "composite.h"
#include "effectloader.h"
#include "x11client.h"
#include "cursor.h"
#include "effectloader.h"
#include "effects.h"
#include "platform.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <KConfigGroup>

View file

@ -7,14 +7,15 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "x11client.h"
#include "composite.h"
#include "cursor.h"
#include "platform.h"
#include "renderbackend.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <kwineffects.h>
#include <KDecoration2/Decoration>

View file

@ -7,12 +7,13 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "platform.h"
#include "abstract_client.h"
#include "x11client.h"
#include "deleted.h"
#include "platform.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <KDecoration2/Decoration>

View file

@ -8,14 +8,15 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "x11client.h"
#include "composite.h"
#include "cursor.h"
#include "platform.h"
#include "renderbackend.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <kwineffects.h>
#include <KWayland/Client/surface.h>

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "cursor.h"

View file

@ -71,9 +71,7 @@ void MinimizeAnimationTest::initTestCase()
void MinimizeAnimationTest::init()
{
QVERIFY(Test::setupWaylandConnection(
Test::AdditionalWaylandInterface::PlasmaShell |
Test::AdditionalWaylandInterface::WindowManagement
));
Test::AdditionalWaylandInterface::PlasmaShell | Test::AdditionalWaylandInterface::WindowManagement));
}
void MinimizeAnimationTest::cleanup()

View file

@ -7,8 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "scripting/scriptedeffect.h"
#include "libkwineffects/anidata_p.h"
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "composite.h"
@ -16,25 +15,25 @@
#include "deleted.h"
#include "effectloader.h"
#include "effects.h"
#include "kwin_wayland_test.h"
#include "libkwineffects/anidata_p.h"
#include "platform.h"
#include "renderbackend.h"
#include "scripting/scriptedeffect.h"
#include "virtualdesktops.h"
#include "wayland_server.h"
#include "workspace.h"
#include <QJSValue>
#include <QQmlEngine>
#include <KConfigGroup>
#include <KGlobalAccel>
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/slide.h>
#include <KWayland/Client/surface.h>
#include <QJSValue>
#include <QQmlEngine>
using namespace KWin;
using namespace std::chrono_literals;

View file

@ -6,24 +6,24 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "x11client.h"
#include "composite.h"
#include "deleted.h"
#include "effects.h"
#include "effectloader.h"
#include "cursor.h"
#include "deleted.h"
#include "effectloader.h"
#include "effects.h"
#include "kwin_wayland_test.h"
#include "platform.h"
#include "renderbackend.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <KConfigGroup>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/surface.h>
#include <KWayland/Client/slide.h>
#include <KWayland/Client/surface.h>
#include <netwm.h>
#include <xcb/xcb_icccm.h>
@ -104,7 +104,6 @@ struct XcbConnectionDeleter
}
};
void SlidingPopupsTest::testWithOtherEffect_data()
{
QTest::addColumn<QStringList>("effectsToLoad");

View file

@ -7,14 +7,15 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "x11client.h"
#include "composite.h"
#include "effects.h"
#include "effectloader.h"
#include "cursor.h"
#include "effectloader.h"
#include "effects.h"
#include "platform.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <KConfigGroup>

View file

@ -7,22 +7,23 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "x11client.h"
#include "composite.h"
#include "cursor.h"
#include "effects.h"
#include "effectloader.h"
#include "effects.h"
#include "platform.h"
#include "renderbackend.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <KConfigGroup>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/surface.h>
#include <KWayland/Client/slide.h>
#include <KWayland/Client/surface.h>
#include <netwm.h>
#include <xcb/xcb_icccm.h>
@ -99,7 +100,6 @@ void WobblyWindowsShadeTest::testShadeMove()
QVERIFY(e->loadEffect(QStringLiteral("wobblywindows")));
QVERIFY(e->isEffectLoaded(QStringLiteral("wobblywindows")));
QScopedPointer<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
QVERIFY(!xcb_connection_has_error(c.data()));
const QRect windowGeometry(0, 0, 100, 200);

View file

@ -12,23 +12,28 @@
#include <KDecoration2/Decoration>
#include <KPluginFactory>
class FakeDecoWithShadows : public KDecoration2::Decoration
{
Q_OBJECT
public:
explicit FakeDecoWithShadows(QObject *parent = nullptr, const QVariantList &args = QVariantList())
: Decoration(parent, args) {}
~FakeDecoWithShadows() override {}
: Decoration(parent, args)
{
}
~FakeDecoWithShadows() override
{
}
void paint(QPainter *painter, const QRect &repaintRegion) override {
void paint(QPainter *painter, const QRect &repaintRegion) override
{
Q_UNUSED(painter)
Q_UNUSED(repaintRegion)
}
public Q_SLOTS:
void init() override {
void init() override
{
const int shadowSize = 128;
const int offsetTop = 64;
const int offsetLeft = 48;
@ -55,7 +60,6 @@ public Q_SLOTS:
K_PLUGIN_FACTORY_WITH_JSON(
FakeDecoWithShadowsFactory,
"fakedecoration_with_shadows.json",
registerPlugin<FakeDecoWithShadows>();
)
registerPlugin<FakeDecoWithShadows>();)
#include "fakedecoration_with_shadows.moc"

View file

@ -9,8 +9,8 @@
#include "generic_scene_opengl_test.h"
#include "abstract_client.h"
#include "composite.h"
#include "effectloader.h"
#include "cursor.h"
#include "effectloader.h"
#include "platform.h"
#include "renderbackend.h"
#include "scene.h"

View file

@ -16,6 +16,7 @@ class GenericSceneOpenGLTest : public QObject
Q_OBJECT
public:
~GenericSceneOpenGLTest() override;
protected:
GenericSceneOpenGLTest(const QByteArray &envVariable);
private Q_SLOTS:

View file

@ -7,7 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "x11client.h"
#include "cursor.h"
#include "input.h"
#include "internal_client.h"
@ -16,6 +16,7 @@
#include "useractions.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <KWayland/Client/surface.h>
#include <KWaylandServer/keyboard_interface.h>
@ -101,11 +102,9 @@ void GlobalShortcutsTest::testNonLatinLayout_data()
{KEY_LEFTALT, Qt::ALT},
{KEY_LEFTSHIFT, Qt::SHIFT},
{KEY_LEFTMETA, Qt::META},
} )
{
}) {
for (const auto &key :
QVector<QPair<int, Qt::Key>> {
// Tab is example of a key usually the same on different layouts, check it first
{KEY_TAB, Qt::Key_Tab},
@ -120,8 +119,7 @@ void GlobalShortcutsTest::testNonLatinLayout_data()
// FIXME: QTBUG-90611
{KEY_GRAVE, Qt::Key_QuoteLeft},
#endif
} )
{
}) {
QTest::newRow(QKeySequence(modifier.second + key.second).toString().toLatin1().constData())
<< modifier.first << modifier.second << key.first << key.second;
}
@ -315,9 +313,7 @@ void GlobalShortcutsTest::testX11ClientShortcut()
xcb_window_t w = xcb_generate_id(c.data());
const QRect windowGeometry = QRect(0, 0, 10, 20);
const uint32_t values[] = {
XCB_EVENT_MASK_ENTER_WINDOW |
XCB_EVENT_MASK_LEAVE_WINDOW
};
XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW};
xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, w, rootWindow(),
windowGeometry.x(),
windowGeometry.y(),

View file

@ -45,8 +45,7 @@ int main(int argc, char *argv[])
if (qApp->clipboard()->text() == QLatin1String("test")) {
QTimer::singleShot(100, qApp, &QCoreApplication::quit);
}
}
);
});
QScopedPointer<Window> w(new Window);
w->setGeometry(QRect(0, 0, 100, 200));
w->show();

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "platform.h"
#include "virtualdesktops.h"
@ -57,7 +58,6 @@ void TestIdleInhibition::initTestCase()
void TestIdleInhibition::init()
{
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::IdleInhibitV1));
}
void TestIdleInhibition::cleanup()

View file

@ -7,20 +7,21 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "cursor.h"
#include "deleted.h"
#include "platform.h"
#include "wayland_server.h"
#include "workspace.h"
#include <kwineffects.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/event_queue.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/pointer.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/seat.h>
#include <KWayland/Client/shm_pool.h>
#include <KWayland/Client/surface.h>

View file

@ -7,28 +7,29 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "cursor.h"
#include "effects.h"
#include "deleted.h"
#include "platform.h"
#include "wayland_server.h"
#include "workspace.h"
#include "effects.h"
#include "inputmethod.h"
#include "virtualkeyboard_dbus.h"
#include "platform.h"
#include "qwayland-input-method-unstable-v1.h"
#include "qwayland-text-input-unstable-v3.h"
#include "virtualkeyboard_dbus.h"
#include "wayland_server.h"
#include "workspace.h"
#include <QTest>
#include <QSignalSpy>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QDBusPendingReply>
#include <KWaylandServer/clientconnection.h>
#include <KWaylandServer/display.h>
#include <KWaylandServer/seat_interface.h>
#include <KWaylandServer/surface_interface.h>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QDBusPendingReply>
#include <QSignalSpy>
#include <QTest>
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/keyboard.h>
@ -63,14 +64,14 @@ private Q_SLOTS:
void testModifierForwarding();
private:
void touchNow() {
void touchNow()
{
static int time = 0;
Test::touchDown(0, {100, 100}, ++time);
Test::touchUp(0, ++time);
}
};
void InputMethodTest::initTestCase()
{
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.kwin.testvirtualkeyboard"));
@ -93,16 +94,12 @@ void InputMethodTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void InputMethodTest::init()
{
touchNow();
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat |
Test::AdditionalWaylandInterface::TextInputManagerV2 |
Test::AdditionalWaylandInterface::InputMethodV1 |
Test::AdditionalWaylandInterface::TextInputManagerV3));
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat | Test::AdditionalWaylandInterface::TextInputManagerV2 | Test::AdditionalWaylandInterface::InputMethodV1 | Test::AdditionalWaylandInterface::TextInputManagerV3));
workspace()->setActiveOutput(QPoint(640, 512));
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
@ -291,7 +288,6 @@ void InputMethodTest::testHidePanel()
// Destroy the test client.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(client));
}
void InputMethodTest::testSwitchFocusedSurfaces()

View file

@ -7,12 +7,13 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "cursor.h"
#include "deleted.h"
#include "effects.h"
#include "internal_client.h"
#include "platform.h"
#include "wayland_server.h"
#include "workspace.h"
@ -20,8 +21,8 @@
#include <QRasterWindow>
#include <KWayland/Client/keyboard.h>
#include <KWayland/Client/surface.h>
#include <KWayland/Client/seat.h>
#include <KWayland/Client/surface.h>
#include <KWindowSystem>
#include <KWaylandServer/surface_interface.h>
@ -76,10 +77,12 @@ public:
HelperWindow();
~HelperWindow() override;
QPoint latestGlobalMousePos() const {
QPoint latestGlobalMousePos() const
{
return m_latestGlobalMousePos;
}
Qt::MouseButtons pressedButtons() const {
Qt::MouseButtons pressedButtons() const
{
return m_pressedButtons;
}

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "keyboard_input.h"
#include "keyboard_layout.h"
@ -109,15 +110,19 @@ void KeyboardLayoutTest::resetLayouts()
callSession(QStringLiteral("loadSession"));
}
auto KeyboardLayoutTest::changeLayout(uint index) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.keyboard"), QStringLiteral("/Layouts"), QStringLiteral("org.kde.KeyboardLayouts"), QStringLiteral("setLayout"));
auto KeyboardLayoutTest::changeLayout(uint index)
{
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.keyboard"),
QStringLiteral("/Layouts"),
QStringLiteral("org.kde.KeyboardLayouts"),
QStringLiteral("setLayout"));
msg << index;
return QDBusConnection::sessionBus().asyncCall(msg);
}
void KeyboardLayoutTest::callSession(const QString &method) {
QDBusMessage msg = QDBusMessage::createMethodCall(
QStringLiteral("org.kde.KWin"),
void KeyboardLayoutTest::callSession(const QString &method)
{
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.KWin"),
QStringLiteral("/Session"),
QStringLiteral("org.kde.KWin.Session"),
method);
@ -189,7 +194,12 @@ void KeyboardLayoutTest::testChangeLayoutThroughDBus()
{
// this test verifies that the layout can be changed through DBus
// first configure layouts
enum Layout {de, us, de_neo, bad};
enum Layout {
de,
us,
de_neo,
bad,
};
layoutGroup.writeEntry("LayoutList", QStringLiteral("de,us,de(neo)"));
layoutGroup.sync();
reconfigureLayouts();
@ -391,7 +401,12 @@ void KeyboardLayoutTest::testVirtualDesktopPolicy()
void KeyboardLayoutTest::testWindowPolicy()
{
enum Layout {us, de, de_neo, bad};
enum Layout {
us,
de,
de_neo,
bad,
};
layoutGroup.writeEntry("LayoutList", QStringLiteral("us,de,de(neo)"));
layoutGroup.writeEntry("SwitchMode", QStringLiteral("Window"));
layoutGroup.sync();
@ -433,7 +448,12 @@ void KeyboardLayoutTest::testWindowPolicy()
void KeyboardLayoutTest::testApplicationPolicy()
{
enum Layout {us, de, de_neo, bad};
enum Layout {
us,
de,
de_neo,
bad,
};
layoutGroup.writeEntry("LayoutList", QStringLiteral("us,de,de(neo)"));
layoutGroup.writeEntry("SwitchMode", QStringLiteral("WinClass"));
layoutGroup.sync();

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "keyboard_input.h"
#include "keyboard_layout.h"

View file

@ -13,9 +13,9 @@
#include "inputmethod.h"
#include "platform.h"
#include "pluginmanager.h"
#include "utils/xcbutils.h"
#include "wayland_server.h"
#include "workspace.h"
#include "utils/xcbutils.h"
#include "xwl/xwayland.h"
#include <KPluginMetaData>
@ -27,9 +27,9 @@
#include <QtConcurrentRun>
// system
#include <unistd.h>
#include <sys/socket.h>
#include <iostream>
#include <sys/socket.h>
#include <unistd.h>
Q_IMPORT_PLUGIN(KWinIntegrationPlugin)
Q_IMPORT_PLUGIN(KGlobalAccelImpl)

View file

@ -76,7 +76,8 @@ public:
WaylandTestApplication(OperationMode mode, int &argc, char **argv);
~WaylandTestApplication() override;
void setInputMethodServerToStart(const QString &inputMethodServer) {
void setInputMethodServerToStart(const QString &inputMethodServer)
{
m_inputMethodServerToStart = inputMethodServer;
}
@ -111,14 +112,20 @@ class MockInputMethod;
class TextInputManagerV3 : public QtWayland::zwp_text_input_manager_v3
{
public:
~TextInputManagerV3() override { destroy(); }
~TextInputManagerV3() override
{
destroy();
}
};
class TextInputV3 : public QObject, public QtWayland::zwp_text_input_v3
{
Q_OBJECT
public:
~TextInputV3() override { destroy(); }
~TextInputV3() override
{
destroy();
}
Q_SIGNALS:
void preeditString(const QString &text, int cursor_begin, int cursor_end);
@ -608,7 +615,6 @@ XdgPopup *createXdgPopupSurface(KWayland::Client::Surface *surface, XdgSurface *
XdgToplevelDecorationV1 *createXdgToplevelDecorationV1(XdgToplevel *toplevel, QObject *parent = nullptr);
IdleInhibitorV1 *createIdleInhibitorV1(KWayland::Client::Surface *surface);
/**
* Creates a shared memory buffer of @p size in @p color and attaches it to the @p surface.
* The @p surface gets damaged and committed, thus it's rendered.

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "cursor.h"
#include "input.h"
@ -42,7 +43,6 @@ private Q_SLOTS:
void testWindowToDesktop();
};
void KWinBindingsTest::initTestCase()
{
qRegisterMetaType<KWin::AbstractClient *>();

View file

@ -5,6 +5,7 @@
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "main.h"
@ -130,29 +131,25 @@ void LayerShellV1ClientTest::testAnchor_data()
QTest::addRow("left") << int(Test::LayerSurfaceV1::anchor_left)
<< QRect(0, 450, 280, 124);
QTest::addRow("top left") << (Test::LayerSurfaceV1::anchor_top |
Test::LayerSurfaceV1::anchor_left)
QTest::addRow("top left") << (Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_left)
<< QRect(0, 0, 280, 124);
QTest::addRow("top") << int(Test::LayerSurfaceV1::anchor_top)
<< QRect(500, 0, 280, 124);
QTest::addRow("top right") << (Test::LayerSurfaceV1::anchor_top |
Test::LayerSurfaceV1::anchor_right)
QTest::addRow("top right") << (Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_right)
<< QRect(1000, 0, 280, 124);
QTest::addRow("right") << int(Test::LayerSurfaceV1::anchor_right)
<< QRect(1000, 450, 280, 124);
QTest::addRow("bottom right") << (Test::LayerSurfaceV1::anchor_bottom |
Test::LayerSurfaceV1::anchor_right)
QTest::addRow("bottom right") << (Test::LayerSurfaceV1::anchor_bottom | Test::LayerSurfaceV1::anchor_right)
<< QRect(1000, 900, 280, 124);
QTest::addRow("bottom") << int(Test::LayerSurfaceV1::anchor_bottom)
<< QRect(500, 900, 280, 124);
QTest::addRow("bottom left") << (Test::LayerSurfaceV1::anchor_bottom |
Test::LayerSurfaceV1::anchor_left)
QTest::addRow("bottom left") << (Test::LayerSurfaceV1::anchor_bottom | Test::LayerSurfaceV1::anchor_left)
<< QRect(0, 900, 280, 124);
}
@ -198,8 +195,7 @@ void LayerShellV1ClientTest::testMargins_data()
<< QMargins(100, 0, 0, 0)
<< QRect(100, 450, 280, 124);
QTest::addRow("top left") << (Test::LayerSurfaceV1::anchor_top |
Test::LayerSurfaceV1::anchor_left)
QTest::addRow("top left") << (Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_left)
<< QMargins(100, 200, 0, 0)
<< QRect(100, 200, 280, 124);
@ -207,8 +203,7 @@ void LayerShellV1ClientTest::testMargins_data()
<< QMargins(0, 200, 0, 0)
<< QRect(500, 200, 280, 124);
QTest::addRow("top right") << (Test::LayerSurfaceV1::anchor_top |
Test::LayerSurfaceV1::anchor_right)
QTest::addRow("top right") << (Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_right)
<< QMargins(0, 200, 300, 0)
<< QRect(700, 200, 280, 124);
@ -216,8 +211,7 @@ void LayerShellV1ClientTest::testMargins_data()
<< QMargins(0, 0, 300, 0)
<< QRect(700, 450, 280, 124);
QTest::addRow("bottom right") << (Test::LayerSurfaceV1::anchor_bottom |
Test::LayerSurfaceV1::anchor_right)
QTest::addRow("bottom right") << (Test::LayerSurfaceV1::anchor_bottom | Test::LayerSurfaceV1::anchor_right)
<< QMargins(0, 0, 300, 400)
<< QRect(700, 500, 280, 124);
@ -225,8 +219,7 @@ void LayerShellV1ClientTest::testMargins_data()
<< QMargins(0, 0, 0, 400)
<< QRect(500, 500, 280, 124);
QTest::addRow("bottom left") << (Test::LayerSurfaceV1::anchor_bottom |
Test::LayerSurfaceV1::anchor_left)
QTest::addRow("bottom left") << (Test::LayerSurfaceV1::anchor_bottom | Test::LayerSurfaceV1::anchor_left)
<< QMargins(100, 0, 0, 400)
<< QRect(100, 500, 280, 124);
}
@ -357,20 +350,15 @@ void LayerShellV1ClientTest::testFill_data()
QTest::addColumn<QSize>("desiredSize");
QTest::addColumn<QRect>("expectedGeometry");
QTest::addRow("horizontal") << (Test::LayerSurfaceV1::anchor_left |
Test::LayerSurfaceV1::anchor_right)
QTest::addRow("horizontal") << (Test::LayerSurfaceV1::anchor_left | Test::LayerSurfaceV1::anchor_right)
<< QSize(0, 124)
<< QRect(0, 450, 1280, 124);
QTest::addRow("vertical") << (Test::LayerSurfaceV1::anchor_top |
Test::LayerSurfaceV1::anchor_bottom)
QTest::addRow("vertical") << (Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_bottom)
<< QSize(280, 0)
<< QRect(500, 0, 280, 1024);
QTest::addRow("all") << (Test::LayerSurfaceV1::anchor_left |
Test::LayerSurfaceV1::anchor_top |
Test::LayerSurfaceV1::anchor_right |
Test::LayerSurfaceV1::anchor_bottom)
QTest::addRow("all") << (Test::LayerSurfaceV1::anchor_left | Test::LayerSurfaceV1::anchor_top | Test::LayerSurfaceV1::anchor_right | Test::LayerSurfaceV1::anchor_bottom)
<< QSize(0, 0)
<< QRect(0, 0, 1280, 1024);
}

View file

@ -7,22 +7,23 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "composite.h"
#include "cursor.h"
#include "platform.h"
#include "renderbackend.h"
#include "screenedge.h"
#include "wayland_server.h"
#include "workspace.h"
#include <kwineffects.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/keyboard.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/pointer.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/seat.h>
#include <KWayland/Client/shm_pool.h>
#include <KWayland/Client/surface.h>
@ -80,13 +81,19 @@ class HelperEffect : public Effect
{
Q_OBJECT
public:
HelperEffect() {}
~HelperEffect() override {}
HelperEffect()
{
}
~HelperEffect() override
{
}
void windowInputMouseEvent(QEvent*) override {
void windowInputMouseEvent(QEvent *) override
{
Q_EMIT inputEvent();
}
void grabbedKeyboardEvent(QKeyEvent *e) override {
void grabbedKeyboardEvent(QKeyEvent *e) override
{
Q_EMIT keyEvent(e->text());
}
@ -96,25 +103,26 @@ Q_SIGNALS:
};
#define LOCK \
do { \
QVERIFY(!waylandServer()->isScreenLocked()); \
QSignalSpy lockStateChangedSpy(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged); \
QVERIFY(lockStateChangedSpy.isValid()); \
ScreenLocker::KSldApp::self()->lock(ScreenLocker::EstablishLock::Immediate); \
QCOMPARE(lockStateChangedSpy.count(), 1); \
QVERIFY(waylandServer()->isScreenLocked());
QVERIFY(waylandServer()->isScreenLocked()); \
} while (false)
#define UNLOCK \
int expectedLockCount = 1; \
if (ScreenLocker::KSldApp::self()->lockState() == ScreenLocker::KSldApp::Locked) { \
expectedLockCount = 2; \
} \
QCOMPARE(lockStateChangedSpy.count(), expectedLockCount); \
do { \
QSignalSpy lockStateChangedSpy(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged); \
QVERIFY(lockStateChangedSpy.isValid()); \
unlock(); \
if (lockStateChangedSpy.count() < expectedLockCount + 1) { \
if (lockStateChangedSpy.count() != 1) { \
QVERIFY(lockStateChangedSpy.wait()); \
} \
QCOMPARE(lockStateChangedSpy.count(), expectedLockCount + 1); \
QVERIFY(!waylandServer()->isScreenLocked());
QCOMPARE(lockStateChangedSpy.count(), 1); \
QVERIFY(!waylandServer()->isScreenLocked()); \
} while (false)
#define MOTION(target) Test::pointerMotion(target, timestamp++)
@ -212,7 +220,7 @@ void LockScreenTest::testStackingOrder()
QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded);
QVERIFY(clientAddedSpy.isValid());
LOCK
LOCK;
QVERIFY(clientAddedSpy.wait());
AbstractClient *client = clientAddedSpy.first().first().value<AbstractClient *>();
@ -220,7 +228,7 @@ void LockScreenTest::testStackingOrder()
QVERIFY(client->isLockScreen());
QCOMPARE(client->layer(), UnmanagedLayer);
UNLOCK
UNLOCK;
}
void LockScreenTest::testPointer()
@ -242,7 +250,7 @@ void LockScreenTest::testPointer()
MOTION(c->frameGeometry().center());
QVERIFY(enteredSpy.wait());
LOCK
LOCK;
QVERIFY(leftSpy.wait());
QCOMPARE(leftSpy.count(), 1);
@ -258,7 +266,7 @@ void LockScreenTest::testPointer()
// go back on the window
MOTION(c->frameGeometry().center());
// and unlock
UNLOCK
UNLOCK;
QVERIFY(enteredSpy.wait());
QCOMPARE(enteredSpy.count(), 2);
@ -294,7 +302,7 @@ void LockScreenTest::testPointerButton()
RELEASE;
QVERIFY(buttonChangedSpy.wait());
LOCK
LOCK;
// and simulate a click
PRESS;
@ -302,7 +310,7 @@ void LockScreenTest::testPointerButton()
RELEASE;
QVERIFY(!buttonChangedSpy.wait());
UNLOCK
UNLOCK;
QVERIFY(enteredSpy.wait());
QCOMPARE(enteredSpy.count(), 2);
@ -335,7 +343,7 @@ void LockScreenTest::testPointerAxis()
Test::pointerAxisHorizontal(5.0, timestamp++);
QVERIFY(axisChangedSpy.wait());
LOCK
LOCK;
// and simulate axis
Test::pointerAxisHorizontal(5.0, timestamp++);
@ -344,7 +352,7 @@ void LockScreenTest::testPointerAxis()
QVERIFY(!axisChangedSpy.wait(100));
// and unlock
UNLOCK
UNLOCK;
QVERIFY(enteredSpy.wait());
QCOMPARE(enteredSpy.count(), 2);
@ -387,14 +395,14 @@ void LockScreenTest::testKeyboard()
QCOMPARE(keyChangedSpy.at(1).at(1).value<Keyboard::KeyState>(), Keyboard::KeyState::Released);
QCOMPARE(keyChangedSpy.at(1).at(2).value<quint32>(), quint32(2));
LOCK
LOCK;
QVERIFY(leftSpy.wait());
KEYPRESS(KEY_B);
KEYRELEASE(KEY_B);
QCOMPARE(leftSpy.count(), 1);
QCOMPARE(keyChangedSpy.count(), 2);
UNLOCK
UNLOCK;
QVERIFY(enteredSpy.wait());
QCOMPARE(enteredSpy.count(), 2);
KEYPRESS(KEY_C);
@ -422,13 +430,13 @@ void LockScreenTest::testScreenEdge()
MOTION(QPoint(5, 5));
QCOMPARE(screenEdgeSpy.count(), 1);
LOCK
LOCK;
MOTION(QPoint(4, 4));
QCOMPARE(screenEdgeSpy.count(), 1);
// and unlock
UNLOCK
UNLOCK;
MOTION(QPoint(5, 5));
QCOMPARE(screenEdgeSpy.count(), 2);
@ -451,7 +459,7 @@ void LockScreenTest::testEffects()
RELEASE;
QCOMPARE(inputSpy.count(), 3);
LOCK
LOCK;
MOTION(QPoint(6, 6));
QCOMPARE(inputSpy.count(), 3);
@ -461,7 +469,7 @@ void LockScreenTest::testEffects()
RELEASE;
QCOMPARE(inputSpy.count(), 3);
UNLOCK
UNLOCK;
MOTION(QPoint(5, 5));
QCOMPARE(inputSpy.count(), 4);
@ -490,13 +498,13 @@ void LockScreenTest::testEffectsKeyboard()
QCOMPARE(inputSpy.first().first().toString(), QStringLiteral("a"));
QCOMPARE(inputSpy.at(1).first().toString(), QStringLiteral("a"));
LOCK
LOCK;
KEYPRESS(KEY_B);
QCOMPARE(inputSpy.count(), 2);
KEYRELEASE(KEY_B);
QCOMPARE(inputSpy.count(), 2);
UNLOCK
UNLOCK;
KEYPRESS(KEY_C);
QCOMPARE(inputSpy.count(), 3);
QCOMPARE(inputSpy.first().first().toString(), QStringLiteral("a"));
@ -541,13 +549,13 @@ void LockScreenTest::testEffectsKeyboardAutorepeat()
QCOMPARE(inputSpy.count(), 1);
// while locked key repeat should not pass any events to the Effect
LOCK
LOCK;
KEYPRESS(KEY_B);
QVERIFY(!inputSpy.wait(200));
KEYRELEASE(KEY_B);
QVERIFY(!inputSpy.wait(200));
UNLOCK
UNLOCK;
// don't test again, that's covered by testEffectsKeyboard
effects->ungrabKeyboard();
@ -576,14 +584,14 @@ void LockScreenTest::testMoveWindow()
QCOMPARE(clientStepUserMovedResizedSpy.count(), 1);
// while locking our window should continue to be in move resize
LOCK
LOCK;
QCOMPARE(workspace()->moveResizeClient(), c);
QVERIFY(c->isInteractiveMove());
Test::keyboardKeyPressed(KEY_RIGHT, timestamp++);
Test::keyboardKeyReleased(KEY_RIGHT, timestamp++);
QCOMPARE(clientStepUserMovedResizedSpy.count(), 1);
UNLOCK
UNLOCK;
QCOMPARE(workspace()->moveResizeClient(), c);
QVERIFY(c->isInteractiveMove());
Test::keyboardKeyPressed(KEY_RIGHT, timestamp++);
@ -605,6 +613,7 @@ void LockScreenTest::testPointerShortcut()
// try to trigger the shortcut
quint32 timestamp = 1;
#define PERFORM(expectedCount) \
do { \
Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); \
PRESS; \
QCoreApplication::instance()->processEvents(); \
@ -612,21 +621,21 @@ void LockScreenTest::testPointerShortcut()
RELEASE; \
Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); \
QCoreApplication::instance()->processEvents(); \
QCOMPARE(actionSpy.count(), expectedCount);
QCOMPARE(actionSpy.count(), expectedCount); \
} while (false)
PERFORM(1)
PERFORM(1);
// now the same thing with a locked screen
LOCK
PERFORM(1)
LOCK;
PERFORM(1);
// and as unlocked
UNLOCK
PERFORM(2)
UNLOCK;
PERFORM(2);
#undef PERFORM
}
void LockScreenTest::testAxisShortcut_data()
{
QTest::addColumn<Qt::Orientation>("direction");
@ -657,6 +666,7 @@ void LockScreenTest::testAxisShortcut()
// try to trigger the shortcut
quint32 timestamp = 1;
#define PERFORM(expectedCount) \
do { \
Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); \
if (direction == Qt::Vertical) \
Test::pointerAxisVertical(sign * 5.0, timestamp++); \
@ -666,17 +676,18 @@ void LockScreenTest::testAxisShortcut()
QCOMPARE(actionSpy.count(), expectedCount); \
Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); \
QCoreApplication::instance()->processEvents(); \
QCOMPARE(actionSpy.count(), expectedCount);
QCOMPARE(actionSpy.count(), expectedCount); \
} while (false)
PERFORM(1)
PERFORM(1);
// now the same thing with a locked screen
LOCK
PERFORM(1)
LOCK;
PERFORM(1);
// and as unlocked
UNLOCK
PERFORM(2)
UNLOCK;
PERFORM(2);
#undef PERFORM
}
@ -704,7 +715,7 @@ void LockScreenTest::testKeyboardShortcut()
QVERIFY(!actionSpy.wait());
QCOMPARE(actionSpy.count(), 1);
LOCK
LOCK;
KEYPRESS(KEY_SPACE);
QVERIFY(!actionSpy.wait());
QCOMPARE(actionSpy.count(), 1);
@ -712,7 +723,7 @@ void LockScreenTest::testKeyboardShortcut()
QVERIFY(!actionSpy.wait());
QCOMPARE(actionSpy.count(), 1);
UNLOCK
UNLOCK;
KEYPRESS(KEY_SPACE);
QVERIFY(actionSpy.wait());
QCOMPARE(actionSpy.count(), 2);
@ -744,7 +755,7 @@ void LockScreenTest::testTouch()
QVERIFY(sequenceStartedSpy.wait());
QCOMPARE(sequenceStartedSpy.count(), 1);
LOCK
LOCK;
QVERIFY(cancelSpy.wait());
Test::touchUp(1, timestamp++);
@ -753,7 +764,7 @@ void LockScreenTest::testTouch()
Test::touchMotion(1, QPointF(26, 26), timestamp++);
Test::touchUp(1, timestamp++);
UNLOCK
UNLOCK;
Test::touchDown(1, QPointF(25, 25), timestamp++);
QVERIFY(sequenceStartedSpy.wait());
QCOMPARE(sequenceStartedSpy.count(), 2);

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "cursor.h"
@ -17,9 +18,9 @@
#include "workspace.h"
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/shm_pool.h>
#include <KWayland/Client/surface.h>
#include <KWayland/Client/plasmashell.h>
#include <KDecoration2/DecoratedClient>
#include <KDecoration2/Decoration>
@ -66,8 +67,7 @@ void TestMaximized::initTestCase()
void TestMaximized::init()
{
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::XdgDecorationV1 |
Test::AdditionalWaylandInterface::PlasmaShell));
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::XdgDecorationV1 | Test::AdditionalWaylandInterface::PlasmaShell));
workspace()->setActiveOutput(QPoint(640, 512));
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));

View file

@ -7,7 +7,9 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config-kwin.h>
#include "kwin_wayland_test.h"
#include "cursor.h"
#include "input.h"
#include "keyboard_input.h"

View file

@ -8,22 +8,23 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "atoms.h"
#include "platform.h"
#include "abstract_client.h"
#include "x11client.h"
#include "cursor.h"
#include "deleted.h"
#include "effects.h"
#include "platform.h"
#include "screens.h"
#include "wayland_server.h"
#include "workspace.h"
#include "deleted.h"
#include "x11client.h"
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/pointer.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/pointer.h>
#include <KWayland/Client/seat.h>
#include <KWayland/Client/surface.h>

View file

@ -7,11 +7,11 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "platform.h"
#include "wayland_server.h"
#include "plugins/nightcolor/nightcolormanager.h"
#include "platform.h"
#include "plugins/nightcolor/constants.h"
#include "plugins/nightcolor/nightcolormanager.h"
#include "wayland_server.h"
#include <KConfigGroup>
@ -102,7 +102,6 @@ void NightColorTest::testConfigRead()
} else {
QCOMPARE(manager->mode(), mode);
}
}
WAYLANDTEST_MAIN(NightColorTest)

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "cursor.h"
#include "input.h"
#include "keyboard_input.h"

View file

@ -10,8 +10,8 @@
#include "abstract_output.h"
#include "cursor.h"
#include "platform.h"
#include "waylandoutputconfig.h"
#include "wayland_server.h"
#include "waylandoutputconfig.h"
#include "workspace.h"
#include <KWayland/Client/surface.h>

View file

@ -7,10 +7,11 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "cursor.h"
#include "kwin_wayland_test.h"
#include "platform.h"
#include "screens.h"
#include "wayland_server.h"

View file

@ -7,16 +7,17 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "platform.h"
#include "cursor.h"
#include "platform.h"
#include "screens.h"
#include "virtualdesktops.h"
#include "wayland_server.h"
#include "workspace.h"
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/event_queue.h>
#include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/registry.h>
@ -240,7 +241,6 @@ void PlasmaSurfaceTest::testOSDPlacementManualPosition()
QCOMPARE(c->frameGeometry(), QRect(50, 70, 100, 50));
}
void PlasmaSurfaceTest::testPanelTypeHasStrut_data()
{
QTest::addColumn<PlasmaShellSurface::PanelBehavior>("panelBehavior");

View file

@ -7,12 +7,13 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "x11client.h"
#include "cursor.h"
#include "platform.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <kwineffects.h>
#include <KWayland/Client/compositor.h>

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "cursor.h"
#include "platform.h"
#include "wayland_server.h"

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "cursor.h"
@ -71,7 +72,6 @@ void TestPointerConstraints::initTestCase()
kwinApp()->setConfig(config);
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();

View file

@ -7,14 +7,15 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "cursor.h"
#include "deleted.h"
#include "effects.h"
#include "pointer_input.h"
#include "options.h"
#include "platform.h"
#include "pointer_input.h"
#include "screenedge.h"
#include "screens.h"
#include "virtualdesktops.h"
@ -24,8 +25,8 @@
#include <kwineffects.h>
#include <KWayland/Client/buffer.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/pointer.h>
#include <KWayland/Client/region.h>
#include <KWayland/Client/seat.h>
@ -162,9 +163,7 @@ void PointerInputTest::initTestCase()
void PointerInputTest::init()
{
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat |
Test::AdditionalWaylandInterface::Decoration |
Test::AdditionalWaylandInterface::XdgDecorationV1));
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat | Test::AdditionalWaylandInterface::Decoration | Test::AdditionalWaylandInterface::XdgDecorationV1));
QVERIFY(Test::waitForWaylandPointer());
m_compositor = Test::waylandCompositor();
m_seat = Test::waylandSeat();
@ -224,7 +223,7 @@ void PointerInputTest::testWarpingUpdatesFocus()
QCOMPARE(waylandServer()->seat()->focusedPointerSurface(), window->surface());
// and out again
Cursors::self()->mouse()->setPos(QPoint(250, 250));;
Cursors::self()->mouse()->setPos(QPoint(250, 250));
QVERIFY(leftSpy.wait());
QCOMPARE(leftSpy.count(), 1);
// there should not be a focused pointer surface anymore
@ -1211,8 +1210,12 @@ class HelperEffect : public Effect
{
Q_OBJECT
public:
HelperEffect() {}
~HelperEffect() override {}
HelperEffect()
{
}
~HelperEffect() override
{
}
};
void PointerInputTest::testEffectOverrideCursorImage()
@ -1576,8 +1579,7 @@ void PointerInputTest::testConfineToScreenGeometry()
QRect(0, 0, 1280, 1024),
QRect(1280, 0, 1280, 1024),
QRect(2560, 0, 1280, 1024),
QRect(1280, 1024, 1280, 1024)
};
QRect(1280, 1024, 1280, 1024)};
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs",
Qt::DirectConnection,
Q_ARG(int, geometries.count()),

View file

@ -7,23 +7,24 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "abstract_client.h"
#include "x11client.h"
#include "abstract_output.h"
#include "cursor.h"
#include "decorations/decorationbridge.h"
#include "decorations/settings.h"
#include "platform.h"
#include "scripting/scripting.h"
#include "wayland_server.h"
#include "workspace.h"
#include "scripting/scripting.h"
#include "x11client.h"
#include <KDecoration2/DecoratedClient>
#include <KDecoration2/Decoration>
#include <KDecoration2/DecorationSettings>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/server_decoration.h>
#include <KWayland/Client/surface.h>
@ -505,9 +506,7 @@ void QuickTilingTest::testQuickTilingTouchMove()
QVERIFY(c->isDecorated());
const auto decoration = c->decoration();
QCOMPARE(workspace()->activeClient(), c);
QCOMPARE(c->frameGeometry(), QRect(-decoration->borderLeft(), 0,
1000 + decoration->borderLeft() + decoration->borderRight(),
50 + decoration->borderTop() + decoration->borderBottom()));
QCOMPARE(c->frameGeometry(), QRect(-decoration->borderLeft(), 0, 1000 + decoration->borderLeft() + decoration->borderRight(), 50 + decoration->borderTop() + decoration->borderBottom()));
QCOMPARE(c->quickTileMode(), QuickTileMode(QuickTileFlag::None));
QCOMPARE(c->maximizeMode(), MaximizeRestore);
@ -530,7 +529,6 @@ void QuickTilingTest::testQuickTilingTouchMove()
Test::touchUp(0, timestamp++);
QVERIFY(!workspace()->moveResizeClient());
// When there are no borders, there is no change to them when quick-tiling.
// TODO: we should test both cases with fixed fake decoration for autotests.
const bool hasBorders = Decoration::DecorationBridge::self()->settings()->borderSize() != KDecoration2::BorderSize::None;

View file

@ -12,7 +12,10 @@ class SceneOpenGLESTest : public GenericSceneOpenGLTest
{
Q_OBJECT
public:
SceneOpenGLESTest() : GenericSceneOpenGLTest(QByteArrayLiteral("O2ES")) {}
SceneOpenGLESTest()
: GenericSceneOpenGLTest(QByteArrayLiteral("O2ES"))
{
}
};
WAYLANDTEST_MAIN(SceneOpenGLESTest)

View file

@ -12,7 +12,10 @@ class SceneOpenGLTest : public GenericSceneOpenGLTest
{
Q_OBJECT
public:
SceneOpenGLTest() : GenericSceneOpenGLTest(QByteArrayLiteral("O2")) {}
SceneOpenGLTest()
: GenericSceneOpenGLTest(QByteArrayLiteral("O2"))
{
}
};
WAYLANDTEST_MAIN(SceneOpenGLTest)

View file

@ -7,20 +7,21 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "composite.h"
#include "effectloader.h"
#include "x11client.h"
#include "cursor.h"
#include "effectloader.h"
#include "effects.h"
#include "platform.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <KConfigGroup>
#include <KWayland/Client/pointer.h>
#include <KWayland/Client/seat.h>
#include <KWayland/Client/surface.h>
#include <KWayland/Client/pointer.h>
#include <KWaylandServer/shmclientbuffer.h>
#include <KWaylandServer/surface_interface.h>
@ -337,7 +338,6 @@ void SceneQPainterTest::testX11Window()
xcb_map_window(c.data(), w);
xcb_flush(c.data());
// we should get a client for it
QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded);
QVERIFY(windowCreatedSpy.isValid());

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "cursor.h"
#include "platform.h"
@ -15,8 +16,8 @@
#include "workspace.h"
#include <KWayland/Client/output.h>
#include <KWayland/Client/xdgoutput.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/xdgoutput.h>
using namespace KWin;
using namespace KWayland::Client;

View file

@ -7,14 +7,15 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "x11client.h"
#include "cursor.h"
#include "deleted.h"
#include "platform.h"
#include "screenedge.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <kwineffects.h>
#include <netwm.h>
@ -72,7 +73,6 @@ void ScreenEdgeClientShowTest::init()
QVERIFY(waylandServer()->clients().isEmpty());
}
struct XcbConnectionDeleter
{
static inline void cleanup(xcb_connection_t *pointer)

View file

@ -14,8 +14,8 @@
#include "cursor.h"
#include "effectloader.h"
#include "main.h"
#include "screenedge.h"
#include "platform.h"
#include "screenedge.h"
#include "wayland_server.h"
#include "workspace.h"

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "cursor.h"

View file

@ -67,8 +67,7 @@ static QString locateMainScript(const QString &pluginName)
QStringLiteral("kwin/scripts"),
[&](const KPluginMetaData &metaData) {
return metaData.pluginId() == pluginName;
}
);
});
if (offers.isEmpty()) {
return QString();
}

View file

@ -7,12 +7,13 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "cursor.h"
#include "effectloader.h"
#include "platform.h"
#include "scripting/scripting.h"
#include "wayland_server.h"
#include "workspace.h"
#include "scripting/scripting.h"
#define private public
#include "screenedge.h"
@ -206,7 +207,8 @@ void ScreenEdgeTest::testTouchEdge()
QVERIFY(workspace()->showingDesktop());
}
void ScreenEdgeTest::triggerConfigReload() {
void ScreenEdgeTest::triggerConfigReload()
{
workspace()->slotReconfigure();
}

View file

@ -7,12 +7,13 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "x11client.h"
#include "cursor.h"
#include "platform.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <kwineffects.h>
#include <KDecoration2/Decoration>

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "platform.h"
#include "wayland_server.h"

View file

@ -11,12 +11,12 @@
#include "abstract_client.h"
#include "atoms.h"
#include "x11client.h"
#include "deleted.h"
#include "main.h"
#include "platform.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/surface.h>
@ -48,7 +48,6 @@ private Q_SLOTS:
void testKeepAbove();
void testKeepBelow();
};
void StackingOrderTest::initTestCase()
@ -197,7 +196,8 @@ void StackingOrderTest::testRaiseTransient()
struct WindowUnrefDeleter
{
static inline void cleanup(Deleted *d) {
static inline void cleanup(Deleted *d)
{
if (d != nullptr) {
d->unrefWindow();
}
@ -268,8 +268,7 @@ void StackingOrderTest::testDeletedTransient()
[](Toplevel *toplevel, Deleted *deleted) {
Q_UNUSED(toplevel)
deleted->refWindow();
}
);
});
QSignalSpy windowClosedSpy(transient2, &AbstractClient::windowClosed);
QVERIFY(windowClosedSpy.isValid());
@ -333,7 +332,8 @@ static xcb_window_t createGroupWindow(xcb_connection_t *conn,
struct XcbConnectionDeleter
{
static inline void cleanup(xcb_connection_t *c) {
static inline void cleanup(xcb_connection_t *c)
{
xcb_disconnect(c);
}
};
@ -690,8 +690,7 @@ void StackingOrderTest::testDeletedGroupTransient()
[](Toplevel *toplevel, Deleted *deleted) {
Q_UNUSED(toplevel)
deleted->refWindow();
}
);
});
QSignalSpy windowClosedSpy(transient, &X11Client::windowClosed);
QVERIFY(windowClosedSpy.isValid());

View file

@ -7,16 +7,17 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "x11client.h"
#include "cursor.h"
#include "deleted.h"
#include "platform.h"
#include "screenedge.h"
#include "screens.h"
#include "virtualdesktops.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <kwineffects.h>
#include <KWayland/Client/compositor.h>

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "cursor.h"
#include "input.h"
@ -15,8 +16,8 @@
#include "wayland_server.h"
#include "workspace.h"
#include <KWayland/Client/surface.h>
#include <KConfigGroup>
#include <KWayland/Client/surface.h>
#include <linux/input.h>

View file

@ -7,31 +7,33 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config-kwin.h>
#include "kwin_wayland_test.h"
#if KWIN_BUILD_SCREENLOCKER
#include "screenlockerwatcher.h"
#endif
#include "inputmethod.h"
#include "wayland_server.h"
#include "workspace.h"
#include "inputmethod.h"
#include <KWayland/Client/appmenu.h>
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/event_queue.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/output.h>
#include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/plasmawindowmanagement.h>
#include <KWayland/Client/pointerconstraints.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/seat.h>
#include <KWayland/Client/server_decoration.h>
#include <KWayland/Client/shadow.h>
#include <KWayland/Client/shm_pool.h>
#include <KWayland/Client/output.h>
#include <KWayland/Client/subcompositor.h>
#include <KWayland/Client/subsurface.h>
#include <KWayland/Client/surface.h>
#include <KWayland/Client/textinput.h>
#include <KWayland/Client/appmenu.h>
#include <KWaylandServer/display.h>
// screenlocker
@ -42,8 +44,8 @@
#include <QThread>
// system
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
using namespace KWayland::Client;
@ -223,7 +225,8 @@ IdleInhibitorV1::~IdleInhibitorV1()
destroy();
}
static struct {
static struct
{
ConnectionThread *connection = nullptr;
EventQueue *queue = nullptr;
KWayland::Client::Compositor *compositor = nullptr;
@ -270,7 +273,6 @@ KWayland::Client::Surface *inputPanelSurface()
MockInputMethod::MockInputMethod(struct wl_registry *registry, int id, int version)
: QtWayland::zwp_input_method_v1(registry, id, version)
{
}
MockInputMethod::~MockInputMethod()
{

View file

@ -14,11 +14,11 @@
#include "virtualkeyboard_dbus.h"
#include "wayland_server.h"
#include <QTest>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QDBusPendingReply>
#include <QSignalSpy>
#include <QTest>
#include <virtualkeyboardinterface.h>
@ -54,10 +54,7 @@ void VirtualKeyboardDBusTest::initTestCase()
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
QVERIFY(setupWaylandConnection(AdditionalWaylandInterface::Seat |
AdditionalWaylandInterface::InputMethodV1 |
AdditionalWaylandInterface::TextInputManagerV2 |
AdditionalWaylandInterface::TextInputManagerV3));
QVERIFY(setupWaylandConnection(AdditionalWaylandInterface::Seat | AdditionalWaylandInterface::InputMethodV1 | AdditionalWaylandInterface::TextInputManagerV2 | AdditionalWaylandInterface::TextInputManagerV3));
}
void VirtualKeyboardDBusTest::init()

View file

@ -7,11 +7,12 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "cursor.h"
#include "platform.h"
#include "touch_input.h"
#include "cursor.h"
#include "wayland_server.h"
#include "workspace.h"
@ -67,8 +68,7 @@ void TouchInputTest::initTestCase()
void TouchInputTest::init()
{
using namespace KWayland::Client;
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat |
Test::AdditionalWaylandInterface::XdgDecorationV1));
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat | Test::AdditionalWaylandInterface::XdgDecorationV1));
QVERIFY(Test::waitForWaylandTouch());
m_touch = Test::waylandSeat()->createTouch(Test::waylandSeat());
QVERIFY(m_touch);

View file

@ -7,22 +7,23 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "cursor.h"
#include "platform.h"
#include "screens.h"
#include "wayland_server.h"
#include "workspace.h"
#include <kwineffects.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/event_queue.h>
#include <KWayland/Client/keyboard.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/pointer.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/seat.h>
#include <KWayland/Client/server_decoration.h>
#include <KWayland/Client/shm_pool.h>

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "main.h"
#include "platform.h"

View file

@ -7,15 +7,16 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "atoms.h"
#include "x11client.h"
#include "cursor.h"
#include "deleted.h"
#include "platform.h"
#include "rules.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <netwm.h>
#include <xcb/xcb_icccm.h>
@ -102,9 +103,7 @@ void WindowRuleTest::testApplyInitialMaximizeVert()
xcb_window_t w = xcb_generate_id(c.data());
const QRect windowGeometry = QRect(0, 0, 10, 20);
const uint32_t values[] = {
XCB_EVENT_MASK_ENTER_WINDOW |
XCB_EVENT_MASK_LEAVE_WINDOW
};
XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW};
xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, w, rootWindow(),
windowGeometry.x(),
windowGeometry.y(),
@ -172,9 +171,7 @@ void WindowRuleTest::testWindowClassChange()
xcb_window_t w = xcb_generate_id(c.data());
const QRect windowGeometry = QRect(0, 0, 10, 20);
const uint32_t values[] = {
XCB_EVENT_MASK_ENTER_WINDOW |
XCB_EVENT_MASK_LEAVE_WINDOW
};
XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW};
xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, w, rootWindow(),
windowGeometry.x(),
windowGeometry.y(),

View file

@ -7,6 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "cursor.h"

View file

@ -7,17 +7,18 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "atoms.h"
#include "x11client.h"
#include "composite.h"
#include "effects.h"
#include "effectloader.h"
#include "cursor.h"
#include "deleted.h"
#include "effectloader.h"
#include "effects.h"
#include "platform.h"
#include "screens.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <KWayland/Client/surface.h>
@ -726,8 +727,9 @@ void X11ClientTest::testX11WindowId()
QUuid deletedUuid;
QCOMPARE(deletedUuid.isNull(), true);
connect(client, &X11Client::windowClosed, this, [&deletedUuid] (Toplevel *, Deleted *d) { deletedUuid = d->internalId(); });
connect(client, &X11Client::windowClosed, this, [&deletedUuid](Toplevel *, Deleted *d) {
deletedUuid = d->internalId();
});
NETRootInfo rootInfo(c.data(), NET::WMAllProperties);
QCOMPARE(rootInfo.activeWindow(), client->window());
@ -909,7 +911,6 @@ void X11ClientTest::testCaptionMultipleWindows()
QTRY_COMPARE(QByteArray(info5.visibleIconName()), QByteArray());
}
void X11ClientTest::testFullscreenWindowGroups()
{
// this test creates an X11 window and puts it to full screen

View file

@ -147,7 +147,8 @@ private Q_SLOTS:
void testMatchAfterNameChange();
private:
template <typename T> void setWindowRule(const QString &property, const T &value, int policy);
template<typename T>
void setWindowRule(const QString &property, const T &value, int policy);
private:
KSharedConfig::Ptr m_config;

View file

@ -8,13 +8,14 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_wayland_output.h"
#include "cursor.h"
#include "decorations/decorationbridge.h"
#include "decorations/settings.h"
#include "effects.h"
#include "deleted.h"
#include "effects.h"
#include "platform.h"
#include "screens.h"
#include "virtualdesktops.h"
@ -25,15 +26,15 @@
#include <KDecoration2/Decoration>
#include <KDecoration2/DecorationSettings>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/appmenu.h>
#include <KWayland/Client/compositor.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/output.h>
#include <KWayland/Client/pointer.h>
#include <KWayland/Client/seat.h>
#include <KWayland/Client/server_decoration.h>
#include <KWayland/Client/subsurface.h>
#include <KWayland/Client/surface.h>
#include <KWayland/Client/appmenu.h>
#include <KWaylandServer/clientconnection.h>
#include <KWaylandServer/display.h>
@ -41,8 +42,8 @@
#include <QDBusConnection>
// system
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <csignal>
@ -186,9 +187,7 @@ void TestXdgShellClient::initTestCase()
void TestXdgShellClient::init()
{
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat |
Test::AdditionalWaylandInterface::XdgDecorationV1 |
Test::AdditionalWaylandInterface::AppMenu));
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat | Test::AdditionalWaylandInterface::XdgDecorationV1 | Test::AdditionalWaylandInterface::AppMenu));
QVERIFY(Test::waitForWaylandPointer());
workspace()->setActiveOutput(QPoint(640, 512));

View file

@ -7,13 +7,14 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "platform.h"
#include "x11client.h"
#include "cursor.h"
#include "deleted.h"
#include "platform.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11client.h"
#include <KWaylandServer/seat_interface.h>
@ -108,11 +109,13 @@ void X11EventReaderHelper::processXcbEvents()
case XCB_ENTER_NOTIFY: {
auto enterEvent = reinterpret_cast<xcb_enter_notify_event_t *>(event);
Q_EMIT entered(QPoint(enterEvent->event_x, enterEvent->event_y));
break; }
break;
}
case XCB_LEAVE_NOTIFY: {
auto leaveEvent = reinterpret_cast<xcb_leave_notify_event_t *>(event);
Q_EMIT left(QPoint(leaveEvent->event_x, leaveEvent->event_y));
break; }
break;
}
}
free(event);
}
@ -140,9 +143,7 @@ void XWaylandInputTest::testPointerEnterLeaveSsd()
xcb_window_t w = xcb_generate_id(c.data());
const QRect windowGeometry = QRect(0, 0, 100, 200);
const uint32_t values[] = {
XCB_EVENT_MASK_ENTER_WINDOW |
XCB_EVENT_MASK_LEAVE_WINDOW
};
XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW};
xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, w, rootWindow(),
windowGeometry.x(),
windowGeometry.y(),
@ -231,9 +232,7 @@ void XWaylandInputTest::testPointerEventLeaveCsd()
xcb_window_t window = xcb_generate_id(c.data());
const uint32_t values[] = {
XCB_EVENT_MASK_ENTER_WINDOW |
XCB_EVENT_MASK_LEAVE_WINDOW
};
XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW};
xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, window, rootWindow(),
boundingRect.x, boundingRect.y, boundingRect.width, boundingRect.height,
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, XCB_CW_EVENT_MASK, values);

View file

@ -8,6 +8,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "abstract_client.h"
#include "abstract_output.h"
#include "platform.h"
@ -24,7 +25,8 @@ using namespace KWin;
static const QString s_socketName = QStringLiteral("wayland_test_kwin_xwayland_selections-0");
struct ProcessKillBeforeDeleter {
struct ProcessKillBeforeDeleter
{
static inline void cleanup(QProcess *pointer)
{
if (pointer)

View file

@ -5,6 +5,7 @@
*/
#include "kwin_wayland_test.h"
#include "abstract_output.h"
#include "composite.h"
#include "main.h"

View file

@ -5,6 +5,7 @@
*/
#include "kwin_wayland_test.h"
#include "composite.h"
#include "main.h"
#include "platform.h"

View file

@ -6,14 +6,15 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "mock_libinput.h"
#include "backends/libinput/device.h"
#include <config-kwin.h>
#include "backends/libinput/device.h"
#include "mock_libinput.h"
#include <KSharedConfig>
#include <QDBusInterface>
#include <QDBusConnection>
#include <QDBusInterface>
#include <QtTest>
#include <linux/input.h>
@ -161,13 +162,16 @@ private Q_SLOTS:
void testSwitch();
};
namespace {
namespace
{
template<typename T>
T dbusProperty(const QString &name, const char *property)
{
QDBusInterface interface{QStringLiteral("org.kde.kwin.tests.libinputdevice"),
QDBusInterface interface {
QStringLiteral("org.kde.kwin.tests.libinputdevice"),
QStringLiteral("/org/kde/KWin/InputDevice/") + name,
QStringLiteral("org.kde.KWin.InputDevice")};
QStringLiteral("org.kde.KWin.InputDevice")
};
return interface.property(property).value<T>();
}
}
@ -1057,7 +1061,6 @@ void TestLibinputDevice::testAlphaNumericKeyboard()
QTEST(dbusProperty<bool>(d.sysName(), "alphaNumericKeyboard"), "isAlpha");
}
void TestLibinputDevice::testEnabled_data()
{
QTest::addColumn<bool>("supported");
@ -1392,7 +1395,8 @@ void TestLibinputDevice::testScrollTwoFinger()
QFETCH(bool, setShouldFail);
QFETCH(bool, supportsScrollTwoFinger);
device.supportedScrollMethods = (supportsScrollTwoFinger ? LIBINPUT_CONFIG_SCROLL_2FG : LIBINPUT_CONFIG_SCROLL_NO_SCROLL) | LIBINPUT_CONFIG_SCROLL_EDGE;
device.scrollMethod = initValue ? LIBINPUT_CONFIG_SCROLL_2FG : otherValue ? LIBINPUT_CONFIG_SCROLL_EDGE : LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
device.scrollMethod = initValue ? LIBINPUT_CONFIG_SCROLL_2FG : otherValue ? LIBINPUT_CONFIG_SCROLL_EDGE
: LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
device.setScrollMethodReturnValue = setShouldFail;
Device d(&device);
@ -1440,7 +1444,8 @@ void TestLibinputDevice::testScrollEdge()
QFETCH(bool, setShouldFail);
QFETCH(bool, supportsScrollEdge);
device.supportedScrollMethods = (supportsScrollEdge ? LIBINPUT_CONFIG_SCROLL_EDGE : LIBINPUT_CONFIG_SCROLL_NO_SCROLL) | LIBINPUT_CONFIG_SCROLL_2FG;
device.scrollMethod = initValue ? LIBINPUT_CONFIG_SCROLL_EDGE : otherValue ? LIBINPUT_CONFIG_SCROLL_2FG : LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
device.scrollMethod = initValue ? LIBINPUT_CONFIG_SCROLL_EDGE : otherValue ? LIBINPUT_CONFIG_SCROLL_2FG
: LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
device.setScrollMethodReturnValue = setShouldFail;
Device d(&device);
@ -1488,7 +1493,8 @@ void TestLibinputDevice::testScrollButtonDown()
QFETCH(bool, setShouldFail);
QFETCH(bool, supportsScrollButtonDown);
device.supportedScrollMethods = (supportsScrollButtonDown ? LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN : LIBINPUT_CONFIG_SCROLL_NO_SCROLL) | LIBINPUT_CONFIG_SCROLL_2FG;
device.scrollMethod = initValue ? LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN : otherValue ? LIBINPUT_CONFIG_SCROLL_2FG : LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
device.scrollMethod = initValue ? LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN : otherValue ? LIBINPUT_CONFIG_SCROLL_2FG
: LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
device.setScrollMethodReturnValue = setShouldFail;
Device d(&device);

View file

@ -146,7 +146,6 @@ void InputEventsTest::testInitWheelEvent()
QCOMPARE(event.axisSource(), InputRedirection::PointerAxisSourceWheel);
// and our custom argument
QCOMPARE(event.device(), &d);
}
void InputEventsTest::testInitSwitchEvent_data()

View file

@ -6,9 +6,10 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "mock_libinput.h"
#include <config-kwin.h>
#include "mock_libinput.h"
#include <linux/input.h>
int libinput_device_keyboard_has_key(struct libinput_device *device, uint32_t code)
@ -384,7 +385,6 @@ enum libinput_config_status libinput_device_config_send_events_set_mode(struct l
return LIBINPUT_CONFIG_STATUS_INVALID;
}
enum libinput_event_type libinput_event_get_type(struct libinput_event *event)
{
return event->type;
@ -410,39 +410,45 @@ struct libinput_event_keyboard *libinput_event_get_keyboard_event(struct libinpu
struct libinput_event_pointer *libinput_event_get_pointer_event(struct libinput_event *event)
{
if (event->type == LIBINPUT_EVENT_POINTER_MOTION ||
event->type == LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE ||
event->type == LIBINPUT_EVENT_POINTER_BUTTON ||
event->type == LIBINPUT_EVENT_POINTER_AXIS) {
switch (event->type) {
case LIBINPUT_EVENT_POINTER_MOTION:
case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
case LIBINPUT_EVENT_POINTER_BUTTON:
case LIBINPUT_EVENT_POINTER_AXIS:
return reinterpret_cast<libinput_event_pointer *>(event);
}
default:
return nullptr;
}
}
struct libinput_event_touch *libinput_event_get_touch_event(struct libinput_event *event)
{
if (event->type == LIBINPUT_EVENT_TOUCH_DOWN ||
event->type == LIBINPUT_EVENT_TOUCH_UP ||
event->type == LIBINPUT_EVENT_TOUCH_MOTION ||
event->type == LIBINPUT_EVENT_TOUCH_CANCEL ||
event->type == LIBINPUT_EVENT_TOUCH_FRAME) {
switch (event->type) {
case LIBINPUT_EVENT_TOUCH_DOWN:
case LIBINPUT_EVENT_TOUCH_UP:
case LIBINPUT_EVENT_TOUCH_MOTION:
case LIBINPUT_EVENT_TOUCH_CANCEL:
case LIBINPUT_EVENT_TOUCH_FRAME:
return reinterpret_cast<libinput_event_touch *>(event);
}
default:
return nullptr;
}
}
struct libinput_event_gesture *libinput_event_get_gesture_event(struct libinput_event *event)
{
if (event->type == LIBINPUT_EVENT_GESTURE_PINCH_BEGIN ||
event->type == LIBINPUT_EVENT_GESTURE_PINCH_UPDATE ||
event->type == LIBINPUT_EVENT_GESTURE_PINCH_END ||
event->type == LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN ||
event->type == LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE ||
event->type == LIBINPUT_EVENT_GESTURE_SWIPE_END) {
switch (event->type) {
case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN:
case LIBINPUT_EVENT_GESTURE_PINCH_UPDATE:
case LIBINPUT_EVENT_GESTURE_PINCH_END:
case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN:
case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE:
case LIBINPUT_EVENT_GESTURE_SWIPE_END:
return reinterpret_cast<libinput_event_gesture *>(event);
}
default:
return nullptr;
}
}
int libinput_event_gesture_get_cancelled(struct libinput_event_gesture *event)
{
@ -886,7 +892,7 @@ enum libinput_switch_state libinput_event_switch_get_switch_state(struct libinpu
uint32_t libinput_event_switch_get_time(struct libinput_event_switch *event)
{
return event->time;;
return event->time;
}
uint64_t libinput_event_switch_get_time_usec(struct libinput_event_switch *event)
@ -905,28 +911,27 @@ struct libinput_event_tablet_pad *libinput_event_get_tablet_pad_event(struct lib
struct libinput_event_tablet_tool *
libinput_event_get_tablet_tool_event(struct libinput_event *event)
{
if (event->type == LIBINPUT_EVENT_TABLET_TOOL_AXIS ||
event->type == LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY ||
event->type == LIBINPUT_EVENT_TABLET_TOOL_TIP) {
switch (event->type) {
case LIBINPUT_EVENT_TABLET_TOOL_AXIS:
case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY:
case LIBINPUT_EVENT_TABLET_TOOL_TIP:
return reinterpret_cast<libinput_event_tablet_tool *>(event);
}
default:
return nullptr;
}
}
int
libinput_device_tablet_pad_get_num_strips(struct libinput_device *device)
int libinput_device_tablet_pad_get_num_strips(struct libinput_device *device)
{
return device->stripCount;
}
int
libinput_device_tablet_pad_get_num_rings(struct libinput_device *device)
int libinput_device_tablet_pad_get_num_rings(struct libinput_device *device)
{
return device->ringCount;
}
int
libinput_device_tablet_pad_get_num_buttons(struct libinput_device *device)
int libinput_device_tablet_pad_get_num_buttons(struct libinput_device *device)
{
return device->buttonCount;
}
@ -945,8 +950,7 @@ libinput_device_group_get_user_data(struct libinput_device_group *group)
return nullptr;
}
void
libinput_device_led_update(struct libinput_device *device,
void libinput_device_led_update(struct libinput_device *device,
enum libinput_led leds)
{
Q_UNUSED(device)

View file

@ -17,7 +17,8 @@
#include <array>
struct libinput_device {
struct libinput_device
{
bool keyboard = false;
bool pointer = false;
bool touch = false;
@ -100,22 +101,28 @@ struct libinput_device {
uint32_t ringCount = 0;
};
struct libinput_event {
virtual ~libinput_event() {}
struct libinput_event
{
virtual ~libinput_event()
{
}
libinput_device *device = nullptr;
libinput_event_type type = LIBINPUT_EVENT_NONE;
quint32 time = 0;
};
struct libinput_event_keyboard : libinput_event {
libinput_event_keyboard() {
struct libinput_event_keyboard : libinput_event
{
libinput_event_keyboard()
{
type = LIBINPUT_EVENT_KEYBOARD_KEY;
}
libinput_key_state state = LIBINPUT_KEY_STATE_RELEASED;
quint32 key = 0;
};
struct libinput_event_pointer : libinput_event {
struct libinput_event_pointer : libinput_event
{
libinput_button_state buttonState = LIBINPUT_BUTTON_STATE_RELEASED;
quint32 button = 0;
bool verticalAxis = false;
@ -129,12 +136,14 @@ struct libinput_event_pointer : libinput_event {
QPointF absolutePos;
};
struct libinput_event_touch : libinput_event {
struct libinput_event_touch : libinput_event
{
qint32 slot = -1;
QPointF absolutePos;
};
struct libinput_event_gesture : libinput_event {
struct libinput_event_gesture : libinput_event
{
int fingerCount = 0;
bool cancelled = false;
QSizeF delta = QSizeF(0, 0);
@ -142,7 +151,8 @@ struct libinput_event_gesture : libinput_event {
qreal angleDelta = 0.0;
};
struct libinput_event_switch : libinput_event {
struct libinput_event_switch : libinput_event
{
enum class State {
Off,
On
@ -151,7 +161,8 @@ struct libinput_event_switch : libinput_event {
quint64 timeMicroseconds = 0;
};
struct libinput {
struct libinput
{
int refCount = 1;
QByteArray seat;
int assignSeatRetVal = 0;

View file

@ -12,8 +12,10 @@
#include <QByteArray>
#include <QVector>
struct MockGL {
struct {
struct MockGL
{
struct
{
QByteArray vendor;
QByteArray renderer;
QByteArray version;

View file

@ -6,8 +6,8 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <kwineffects.h>
#include <QTest>
#include <kwineffects.h>
Q_DECLARE_METATYPE(KWin::WindowQuadList)
@ -96,10 +96,14 @@ void WindowQuadListTest::testMakeGrid()
auto vertexTest = [actualQuad, expectedQuad](int index) {
const KWin::WindowVertex &actualVertex = actualQuad[index];
const KWin::WindowVertex &expectedVertex = expectedQuad[index];
if (actualVertex.x() != expectedVertex.x()) return false;
if (actualVertex.y() != expectedVertex.y()) return false;
if (!qFuzzyIsNull(actualVertex.u() - expectedVertex.u())) return false;
if (!qFuzzyIsNull(actualVertex.v() - expectedVertex.v())) return false;
if (actualVertex.x() != expectedVertex.x())
return false;
if (actualVertex.y() != expectedVertex.y())
return false;
if (!qFuzzyIsNull(actualVertex.u() - expectedVertex.u()))
return false;
if (!qFuzzyIsNull(actualVertex.v() - expectedVertex.v()))
return false;
return true;
};
found = vertexTest(0) && vertexTest(1) && vertexTest(2) && vertexTest(3);
@ -107,10 +111,7 @@ void WindowQuadListTest::testMakeGrid()
break;
}
}
QVERIFY2(found, qPrintable(QStringLiteral("%0, %1 / %2, %3").arg(QString::number(actualQuad.left()),
QString::number(actualQuad.top()),
QString::number(actualQuad.right()),
QString::number(actualQuad.bottom()))));
QVERIFY2(found, qPrintable(QStringLiteral("%0, %1 / %2, %3").arg(QString::number(actualQuad.left()), QString::number(actualQuad.top()), QString::number(actualQuad.right()), QString::number(actualQuad.bottom()))));
}
}
@ -179,10 +180,14 @@ void WindowQuadListTest::testMakeRegularGrid()
auto vertexTest = [actualQuad, expectedQuad](int index) {
const KWin::WindowVertex &actualVertex = actualQuad[index];
const KWin::WindowVertex &expectedVertex = expectedQuad[index];
if (actualVertex.x() != expectedVertex.x()) return false;
if (actualVertex.y() != expectedVertex.y()) return false;
if (!qFuzzyIsNull(actualVertex.u() - expectedVertex.u())) return false;
if (!qFuzzyIsNull(actualVertex.v() - expectedVertex.v())) return false;
if (actualVertex.x() != expectedVertex.x())
return false;
if (actualVertex.y() != expectedVertex.y())
return false;
if (!qFuzzyIsNull(actualVertex.u() - expectedVertex.u()))
return false;
if (!qFuzzyIsNull(actualVertex.v() - expectedVertex.v()))
return false;
return true;
};
found = vertexTest(0) && vertexTest(1) && vertexTest(2) && vertexTest(3);
@ -190,10 +195,7 @@ void WindowQuadListTest::testMakeRegularGrid()
break;
}
}
QVERIFY2(found, qPrintable(QStringLiteral("%0, %1 / %2, %3").arg(QString::number(actualQuad.left()),
QString::number(actualQuad.top()),
QString::number(actualQuad.right()),
QString::number(actualQuad.bottom()))));
QVERIFY2(found, qPrintable(QStringLiteral("%0, %1 / %2, %3").arg(QString::number(actualQuad.left()), QString::number(actualQuad.top()), QString::number(actualQuad.right()), QString::number(actualQuad.bottom()))));
}
}

View file

@ -6,8 +6,8 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <QtTest>
#include <QLoggingCategory>
#include <QtTest>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else

View file

@ -7,11 +7,11 @@
#include "onscreennotificationtest.h"
#include "onscreennotification.h"
#include "input.h"
#include "onscreennotification.h"
#include <KSharedConfig>
#include <KConfigGroup>
#include <KSharedConfig>
#include <QQmlEngine>
#include <QSignalSpy>

View file

@ -163,111 +163,127 @@ void OpenGLContextAttributeBuilderTest::testEgl_data()
QTest::addColumn<std::vector<int>>("expectedAttribs");
QTest::newRow("fallback") << false << 0 << 0 << false << false << false << false << false << std::vector<int>{EGL_NONE};
QTest::newRow("legacy/robust") << false << 0 << 0 << true << false << false << false << false <<
std::vector<int>{
QTest::newRow("legacy/robust")
<< false << 0 << 0 << true << false << false << false << false
<< std::vector<int>{
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, EGL_LOSE_CONTEXT_ON_RESET_KHR,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR,
EGL_NONE};
QTest::newRow("legacy/robust/high priority") << false << 0 << 0 << true << false << false << false << true <<
std::vector<int>{
QTest::newRow("legacy/robust/high priority")
<< false << 0 << 0 << true << false << false << false << true
<< std::vector<int>{
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, EGL_LOSE_CONTEXT_ON_RESET_KHR,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR,
EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG,
EGL_NONE};
QTest::newRow("core") << true << 3 << 1 << false << false << false << false << false <<
std::vector<int>{
QTest::newRow("core")
<< true << 3 << 1 << false << false << false << false << false
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 1,
EGL_NONE};
QTest::newRow("core/high priority") << true << 3 << 1 << false << false << false << false << true <<
std::vector<int>{
QTest::newRow("core/high priority")
<< true << 3 << 1 << false << false << false << false << true
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 1,
EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG,
EGL_NONE};
QTest::newRow("core/robust") << true << 3 << 1 << true << false << false << false << false <<
std::vector<int>{
QTest::newRow("core/robust")
<< true << 3 << 1 << true << false << false << false << false
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 1,
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, EGL_LOSE_CONTEXT_ON_RESET_KHR,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR,
EGL_NONE};
QTest::newRow("core/robust/high priority") << true << 3 << 1 << true << false << false << false << true <<
std::vector<int>{
QTest::newRow("core/robust/high priority")
<< true << 3 << 1 << true << false << false << false << true
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 1,
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, EGL_LOSE_CONTEXT_ON_RESET_KHR,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR,
EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG,
EGL_NONE};
QTest::newRow("core/robust/forward compatible") << true << 3 << 1 << true << true << false << false << false <<
std::vector<int>{
QTest::newRow("core/robust/forward compatible")
<< true << 3 << 1 << true << true << false << false << false
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 1,
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, EGL_LOSE_CONTEXT_ON_RESET_KHR,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR | EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR,
EGL_NONE};
QTest::newRow("core/robust/forward compatible/high priority") << true << 3 << 1 << true << true << false << false << true <<
std::vector<int>{
QTest::newRow("core/robust/forward compatible/high priority")
<< true << 3 << 1 << true << true << false << false << true
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 1,
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, EGL_LOSE_CONTEXT_ON_RESET_KHR,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR | EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR,
EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG,
EGL_NONE};
QTest::newRow("core/forward compatible") << true << 3 << 1 << false << true << false << false << false <<
std::vector<int>{
QTest::newRow("core/forward compatible")
<< true << 3 << 1 << false << true << false << false << false
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 1,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR,
EGL_NONE};
QTest::newRow("core/forward compatible/high priority") << true << 3 << 1 << false << true << false << false << true <<
std::vector<int>{
QTest::newRow("core/forward compatible/high priority")
<< true << 3 << 1 << false << true << false << false << true
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 1,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR,
EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG,
EGL_NONE};
QTest::newRow("core profile/forward compatible") << true << 3 << 2 << false << true << true << false << false <<
std::vector<int>{
QTest::newRow("core profile/forward compatible")
<< true << 3 << 2 << false << true << true << false << false
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 2,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR,
EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
EGL_NONE};
QTest::newRow("core profile/forward compatible/high priority") << true << 3 << 2 << false << true << true << false << true <<
std::vector<int>{
QTest::newRow("core profile/forward compatible/high priority")
<< true << 3 << 2 << false << true << true << false << true
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 2,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR,
EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG,
EGL_NONE};
QTest::newRow("compatibility profile/forward compatible") << true << 3 << 2 << false << true << false << true << false <<
std::vector<int>{
QTest::newRow("compatibility profile/forward compatible")
<< true << 3 << 2 << false << true << false << true << false
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 2,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR,
EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR,
EGL_NONE};
QTest::newRow("compatibility profile/forward compatible/high priority") << true << 3 << 2 << false << true << false << true << true <<
std::vector<int>{
QTest::newRow("compatibility profile/forward compatible/high priority")
<< true << 3 << 2 << false << true << false << true << true
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 2,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR,
EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR,
EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG,
EGL_NONE};
QTest::newRow("core profile/robust/forward compatible") << true << 3 << 2 << true << true << true << false << false <<
std::vector<int>{
QTest::newRow("core profile/robust/forward compatible")
<< true << 3 << 2 << true << true << true << false << false
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 2,
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, EGL_LOSE_CONTEXT_ON_RESET_KHR,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR | EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR,
EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
EGL_NONE};
QTest::newRow("core profile/robust/forward compatible/high priority") << true << 3 << 2 << true << true << true << false << true <<
std::vector<int>{
QTest::newRow("core profile/robust/forward compatible/high priority")
<< true << 3 << 2 << true << true << true << false << true
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 2,
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, EGL_LOSE_CONTEXT_ON_RESET_KHR,
@ -275,16 +291,18 @@ void OpenGLContextAttributeBuilderTest::testEgl_data()
EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG,
EGL_NONE};
QTest::newRow("compatibility profile/robust/forward compatible") << true << 3 << 2 << true << true << false << true << false <<
std::vector<int>{
QTest::newRow("compatibility profile/robust/forward compatible")
<< true << 3 << 2 << true << true << false << true << false
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 2,
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, EGL_LOSE_CONTEXT_ON_RESET_KHR,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR | EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR,
EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR,
EGL_NONE};
QTest::newRow("compatibility profile/robust/forward compatible/high priority") << true << 3 << 2 << true << true << false << true << true <<
std::vector<int>{
QTest::newRow("compatibility profile/robust/forward compatible/high priority")
<< true << 3 << 2 << true << true << false << true << true
<< std::vector<int>{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 2,
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, EGL_LOSE_CONTEXT_ON_RESET_KHR,
@ -325,21 +343,29 @@ void OpenGLContextAttributeBuilderTest::testGles_data()
QTest::addColumn<bool>("highPriority");
QTest::addColumn<std::vector<int>>("expectedAttribs");
QTest::newRow("robust") << true << false << std::vector<int>{
QTest::newRow("robust")
<< true << false
<< std::vector<int>{
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, EGL_TRUE,
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, EGL_LOSE_CONTEXT_ON_RESET_EXT,
EGL_NONE};
QTest::newRow("robust/high priority") << true << true << std::vector<int>{
QTest::newRow("robust/high priority")
<< true << true
<< std::vector<int>{
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, EGL_TRUE,
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, EGL_LOSE_CONTEXT_ON_RESET_EXT,
EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG,
EGL_NONE};
QTest::newRow("normal") << false << false << std::vector<int>{
QTest::newRow("normal")
<< false << false
<< std::vector<int>{
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE};
QTest::newRow("normal/high priority") << false << true << std::vector<int>{
QTest::newRow("normal/high priority")
<< false << true
<< std::vector<int>{
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG,
EGL_NONE};
@ -369,40 +395,48 @@ void OpenGLContextAttributeBuilderTest::testGlx_data()
QTest::addColumn<bool>("videoPurge");
QTest::addColumn<std::vector<int>>("expectedAttribs");
QTest::newRow("fallback") << true << 2 << 1 << false << false << std::vector<int>{
QTest::newRow("fallback")
<< true << 2 << 1 << false << false
<< std::vector<int>{
GLX_CONTEXT_MAJOR_VERSION_ARB, 2,
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
0};
QTest::newRow("legacy/robust") << false << 0 << 0 << true << false << std::vector<int>{
QTest::newRow("legacy/robust")
<< false << 0 << 0 << true << false
<< std::vector<int>{
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB,
GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, GLX_LOSE_CONTEXT_ON_RESET_ARB,
0
};
QTest::newRow("legacy/robust/videoPurge") << false << 0 << 0 << true << true << std::vector<int>{
0};
QTest::newRow("legacy/robust/videoPurge")
<< false << 0 << 0 << true << true
<< std::vector<int>{
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB,
GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, GLX_LOSE_CONTEXT_ON_RESET_ARB,
GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV, GL_TRUE,
0
};
QTest::newRow("core") << true << 3 << 1 << false << false << std::vector<int>{
0};
QTest::newRow("core")
<< true << 3 << 1 << false << false
<< std::vector<int>{
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
0};
QTest::newRow("core/robust") << true << 3 << 1 << true << false << std::vector<int>{
QTest::newRow("core/robust")
<< true << 3 << 1 << true << false
<< std::vector<int>{
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB,
GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, GLX_LOSE_CONTEXT_ON_RESET_ARB,
0
};
QTest::newRow("core/robust/videoPurge") << true << 3 << 1 << true << true << std::vector<int>{
0};
QTest::newRow("core/robust/videoPurge")
<< true << 3 << 1 << true << true
<< std::vector<int>{
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB,
GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, GLX_LOSE_CONTEXT_ON_RESET_ARB,
GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV, GL_TRUE,
0
};
0};
#endif
}

View file

@ -20,39 +20,50 @@ class MockTabBoxClient : public TabBox::TabBoxClient
{
public:
explicit MockTabBoxClient(QString caption);
bool isMinimized() const override {
bool isMinimized() const override
{
return false;
}
QString caption() const override {
QString caption() const override
{
return m_caption;
}
void close() override;
int height() const override {
int height() const override
{
return 100;
}
virtual QPixmap icon(const QSize &size = QSize(32, 32)) const {
virtual QPixmap icon(const QSize &size = QSize(32, 32)) const
{
return QPixmap(size);
}
bool isCloseable() const override {
bool isCloseable() const override
{
return true;
}
bool isFirstInTabBox() const override {
bool isFirstInTabBox() const override
{
return false;
}
int width() const override {
int width() const override
{
return 100;
}
int x() const override {
int x() const override
{
return 0;
}
int y() const override {
int y() const override
{
return 0;
}
QIcon icon() const override {
QIcon icon() const override
{
return QIcon();
}
QUuid internalId() const override {
QUuid internalId() const override
{
return QUuid{};
}

View file

@ -18,79 +18,98 @@ class MockTabBoxHandler : public TabBox::TabBoxHandler
public:
MockTabBoxHandler(QObject *parent = nullptr);
~MockTabBoxHandler() override;
void activateAndClose() override {
void activateAndClose() override
{
}
QWeakPointer<TabBox::TabBoxClient> activeClient() const override;
void setActiveClient(const QWeakPointer<TabBox::TabBoxClient> &client);
int activeScreen() const override {
int activeScreen() const override
{
return 0;
}
QWeakPointer<TabBox::TabBoxClient> clientToAddToList(TabBox::TabBoxClient *client, int desktop) const override;
int currentDesktop() const override {
int currentDesktop() const override
{
return 1;
}
QWeakPointer< TabBox::TabBoxClient > desktopClient() const override {
QWeakPointer<TabBox::TabBoxClient> desktopClient() const override
{
return QWeakPointer<TabBox::TabBoxClient>();
}
QString desktopName(int desktop) const override {
QString desktopName(int desktop) const override
{
Q_UNUSED(desktop)
return "desktop 1";
}
QString desktopName(TabBox::TabBoxClient *client) const override {
QString desktopName(TabBox::TabBoxClient *client) const override
{
Q_UNUSED(client)
return "desktop";
}
void elevateClient(TabBox::TabBoxClient *c, QWindow *tabbox, bool elevate) const override {
void elevateClient(TabBox::TabBoxClient *c, QWindow *tabbox, bool elevate) const override
{
Q_UNUSED(c)
Q_UNUSED(tabbox)
Q_UNUSED(elevate)
}
void shadeClient(TabBox::TabBoxClient *c, bool b) const override {
void shadeClient(TabBox::TabBoxClient *c, bool b) const override
{
Q_UNUSED(c)
Q_UNUSED(b)
}
virtual void hideOutline() {
virtual void hideOutline()
{
}
QWeakPointer<TabBox::TabBoxClient> nextClientFocusChain(TabBox::TabBoxClient *client) const override;
QWeakPointer<TabBox::TabBoxClient> firstClientFocusChain() const override;
bool isInFocusChain(TabBox::TabBoxClient *client) const override;
int nextDesktopFocusChain(int desktop) const override {
int nextDesktopFocusChain(int desktop) const override
{
Q_UNUSED(desktop)
return 1;
}
int numberOfDesktops() const override {
int numberOfDesktops() const override
{
return 1;
}
bool isKWinCompositing() const override {
bool isKWinCompositing() const override
{
return false;
}
void raiseClient(TabBox::TabBoxClient *c) const override {
void raiseClient(TabBox::TabBoxClient *c) const override
{
Q_UNUSED(c)
}
void restack(TabBox::TabBoxClient *c, TabBox::TabBoxClient *under) override {
void restack(TabBox::TabBoxClient *c, TabBox::TabBoxClient *under) override
{
Q_UNUSED(c)
Q_UNUSED(under)
}
virtual void showOutline(const QRect &outline) {
virtual void showOutline(const QRect &outline)
{
Q_UNUSED(outline)
}
TabBox::TabBoxClientList stackingOrder() const override {
TabBox::TabBoxClientList stackingOrder() const override
{
return TabBox::TabBoxClientList();
}
void grabbedKeyEvent(QKeyEvent *event) const override;
void highlightWindows(TabBox::TabBoxClient *window = nullptr, QWindow *controller = nullptr) override {
void highlightWindows(TabBox::TabBoxClient *window = nullptr, QWindow *controller = nullptr) override
{
Q_UNUSED(window)
Q_UNUSED(controller)
}
bool noModifierGrab() const override {
bool noModifierGrab() const override
{
return false;
}
// mock methods
QWeakPointer<TabBox::TabBoxClient> createMockWindow(const QString &caption);
void closeWindow(TabBox::TabBoxClient *client);
private:
QList<QSharedPointer<TabBox::TabBoxClient>> m_windows;
QWeakPointer<TabBox::TabBoxClient> m_activeClient;

View file

@ -7,9 +7,9 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "test_tabbox_clientmodel.h"
#include "mock_tabboxhandler.h"
#include "clientmodel.h"
#include "../testutils.h"
#include "clientmodel.h"
#include "mock_tabboxhandler.h"
#include <QtTest>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)

View file

@ -6,9 +6,9 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "mock_tabboxhandler.h"
#include "clientmodel.h"
#include "../testutils.h"
#include "clientmodel.h"
#include "mock_tabboxhandler.h"
#include <QtTest>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>

View file

@ -21,10 +21,10 @@
// xcb
#include <xcb/xcb.h>
// system
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
Q_LOGGING_CATEGORY(KWIN_CORE, "kwin_core")

View file

@ -8,8 +8,8 @@
*/
#include "gestures.h"
#include <QTest>
#include <QSignalSpy>
#include <QTest>
#include <QtWidgets/qaction.h>
#include <iostream>
@ -514,7 +514,6 @@ void GestureTest::testSwipeCancel()
QCOMPARE(triggeredSpy.count(), 0);
}
void GestureTest::testSwipeUpdateTrigger_data()
{
QTest::addColumn<KWin::SwipeGesture::Direction>("direction");
@ -708,7 +707,5 @@ void GestureTest::testSwipeGeometryStart()
QTEST(!startedSpy.isEmpty(), "started");
}
QTEST_MAIN(GestureTest)
#include "test_gestures.moc"

View file

@ -14,7 +14,8 @@
#include <QAction>
#include <QtTest>
namespace KWin {
namespace KWin
{
int screen_number = 0;

View file

@ -11,9 +11,9 @@
#include "virtualdesktops.h"
#include <QVector2D>
#include <QGraphicsRotation>
#include <QGraphicsScale>
#include <QVector2D>
#include <QtTest>
@ -46,219 +46,294 @@ public:
void minimize() override;
void unminimize() override;
void closeWindow() override;
void referencePreviousWindowPixmap() override {}
void unreferencePreviousWindowPixmap() override {}
QWindow *internalWindow() const override {
void referencePreviousWindowPixmap() override
{
}
void unreferencePreviousWindowPixmap() override
{
}
QWindow *internalWindow() const override
{
return nullptr;
}
bool isDeleted() const override {
bool isDeleted() const override
{
return false;
}
bool isMinimized() const override {
bool isMinimized() const override
{
return false;
}
double opacity() const override {
double opacity() const override
{
return m_opacity;
}
void setOpacity(qreal opacity) {
void setOpacity(qreal opacity)
{
m_opacity = opacity;
}
bool hasAlpha() const override {
bool hasAlpha() const override
{
return true;
}
QStringList activities() const override {
QStringList activities() const override
{
return QStringList();
}
int desktop() const override {
int desktop() const override
{
return 0;
}
QVector<uint> desktops() const override {
QVector<uint> desktops() const override
{
return {};
}
int x() const override {
int x() const override
{
return 0;
}
int y() const override {
int y() const override
{
return 0;
}
int width() const override {
int width() const override
{
return 100;
}
int height() const override {
int height() const override
{
return 100;
}
QSize basicUnit() const override {
QSize basicUnit() const override
{
return QSize();
}
QRect geometry() const override {
QRect geometry() const override
{
return QRect();
}
QRect expandedGeometry() const override {
QRect expandedGeometry() const override
{
return QRect();
}
QRect frameGeometry() const override {
QRect frameGeometry() const override
{
return QRect();
}
QRect bufferGeometry() const override {
QRect bufferGeometry() const override
{
return QRect();
}
QRect clientGeometry() const override {
QRect clientGeometry() const override
{
return QRect();
}
EffectScreen *screen() const override {
EffectScreen *screen() const override
{
return nullptr;
}
QPoint pos() const override {
QPoint pos() const override
{
return QPoint();
}
QSize size() const override {
QSize size() const override
{
return QSize(100, 100);
}
QRect rect() const override {
QRect rect() const override
{
return QRect(0, 0, 100, 100);
}
bool isMovable() const override {
bool isMovable() const override
{
return true;
}
bool isMovableAcrossScreens() const override {
bool isMovableAcrossScreens() const override
{
return true;
}
bool isUserMove() const override {
bool isUserMove() const override
{
return false;
}
bool isUserResize() const override {
bool isUserResize() const override
{
return false;
}
QRect iconGeometry() const override {
QRect iconGeometry() const override
{
return QRect();
}
bool isDesktop() const override {
bool isDesktop() const override
{
return false;
}
bool isDock() const override {
bool isDock() const override
{
return false;
}
bool isToolbar() const override {
bool isToolbar() const override
{
return false;
}
bool isMenu() const override {
bool isMenu() const override
{
return false;
}
bool isNormalWindow() const override {
bool isNormalWindow() const override
{
return true;
}
bool isSpecialWindow() const override {
bool isSpecialWindow() const override
{
return false;
}
bool isDialog() const override {
bool isDialog() const override
{
return false;
}
bool isSplash() const override {
bool isSplash() const override
{
return false;
}
bool isUtility() const override {
bool isUtility() const override
{
return false;
}
bool isDropdownMenu() const override {
bool isDropdownMenu() const override
{
return false;
}
bool isPopupMenu() const override {
bool isPopupMenu() const override
{
return false;
}
bool isTooltip() const override {
bool isTooltip() const override
{
return false;
}
bool isNotification() const override {
bool isNotification() const override
{
return false;
}
bool isCriticalNotification() const override {
bool isCriticalNotification() const override
{
return false;
}
bool isOnScreenDisplay() const override {
bool isOnScreenDisplay() const override
{
return false;
}
bool isComboBox() const override {
bool isComboBox() const override
{
return false;
}
bool isDNDIcon() const override {
bool isDNDIcon() const override
{
return false;
}
QRect contentsRect() const override {
QRect contentsRect() const override
{
return QRect();
}
bool decorationHasAlpha() const override {
bool decorationHasAlpha() const override
{
return false;
}
KDecoration2::Decoration *decoration() const override {
KDecoration2::Decoration *decoration() const override
{
return nullptr;
}
QString caption() const override {
QString caption() const override
{
return QString();
}
QIcon icon() const override {
QIcon icon() const override
{
return QIcon();
}
QString windowClass() const override {
QString windowClass() const override
{
return QString();
}
QString windowRole() const override {
QString windowRole() const override
{
return QString();
}
NET::WindowType windowType() const override {
NET::WindowType windowType() const override
{
return NET::Normal;
}
bool acceptsFocus() const override {
bool acceptsFocus() const override
{
return true;
}
bool keepAbove() const override {
bool keepAbove() const override
{
return false;
}
bool keepBelow() const override {
bool keepBelow() const override
{
return false;
}
bool isModal() const override {
bool isModal() const override
{
return false;
}
bool isSkipSwitcher() const override {
bool isSkipSwitcher() const override
{
return false;
}
bool isCurrentTab() const override {
bool isCurrentTab() const override
{
return true;
}
bool skipsCloseAnimation() const override {
bool skipsCloseAnimation() const override
{
return false;
}
KWaylandServer::SurfaceInterface *surface() const override {
KWaylandServer::SurfaceInterface *surface() const override
{
return nullptr;
}
bool isFullScreen() const override {
bool isFullScreen() const override
{
return false;
}
bool isUnresponsive() const override {
bool isUnresponsive() const override
{
return false;
}
bool isPopupWindow() const override {
bool isPopupWindow() const override
{
return false;
}
bool isManaged() const override {
bool isManaged() const override
{
return true;
}
bool isWaylandClient() const override {
bool isWaylandClient() const override
{
return true;
}
bool isX11Client() const override {
bool isX11Client() const override
{
return false;
}
bool isOutline() const override {
bool isOutline() const override
{
return false;
}
bool isLockScreen() const override {
bool isLockScreen() const override
{
return false;
}
pid_t pid() const override {
pid_t pid() const override
{
return 0;
}
qlonglong windowId() const override {
qlonglong windowId() const override
{
return 0;
}

View file

@ -31,7 +31,6 @@ public:
protected:
void performStartup() override;
};
X11TestApplication::X11TestApplication(int &argc, char **argv)

View file

@ -49,6 +49,7 @@ private Q_SLOTS:
void testMotifEmpty();
void testMotif_data();
void testMotif();
private:
void testEmpty(WindowGeometry &geometry);
void testGeometry(WindowGeometry &geometry, const QRect &rect);
@ -514,8 +515,7 @@ void TestXcbWrapper::testMotif()
functions,
decorations,
0,
0
};
0};
xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, m_testWindow, atom, atom, 32, 5, data);
xcb_flush(QX11Info::connection());
MotifHints hints(atom);

View file

@ -23,7 +23,8 @@ private Q_SLOTS:
// from kwindowsystem/src/platforms/xcb/kkeyserver.cpp
// adjusted to xkb
struct TransKey {
struct TransKey
{
Qt::Key keySymQt;
xkb_keysym_t keySymX;
Qt::KeyboardModifiers modifiers;
@ -458,8 +459,7 @@ static const TransKey g_rgQtToSymX[] = {
{Qt::Key_6, XKB_KEY_KP_6, Qt::KeypadModifier},
{Qt::Key_7, XKB_KEY_KP_7, Qt::KeypadModifier},
{Qt::Key_8, XKB_KEY_KP_8, Qt::KeypadModifier},
{ Qt::Key_9, XKB_KEY_KP_9, Qt::KeypadModifier }
};
{Qt::Key_9, XKB_KEY_KP_9, Qt::KeypadModifier}};
void XkbTest::testToQtKey_data()
{

View file

@ -13,13 +13,16 @@
// XCB
#include <xcb/xcb.h>
namespace {
static void forceXcb() {
namespace
{
static void forceXcb()
{
qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("xcb"));
}
}
namespace KWin {
namespace KWin
{
/**
* Wrapper to create an 0,0x10,10 input only window for testing purposes

View file

@ -9,11 +9,11 @@
// read additional window rules and add them to kwinrulesrc
#include <QDebug>
#include <QStandardPaths>
#include <QtDBus>
#include <kconfig.h>
#include <kconfiggroup.h>
#include <QtDBus>
#include <QStandardPaths>
#include <QDebug>
int main(int argc, char *argv[])
{
@ -23,8 +23,7 @@ int main( int argc, char* argv[] )
QCoreApplication::setApplicationName("kwin_update_default_rules");
QString file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString("kwin/default_rules/%1").arg(argv[1]));
if( file.isEmpty())
{
if (file.isEmpty()) {
qWarning() << "File " << argv[1] << " not found!";
return 1;
}
@ -36,8 +35,7 @@ int main( int argc, char* argv[] )
int pos = dcg.readEntry("count", 0);
for (int group = 1;
group <= count;
++group )
{
++group) {
QMap<QString, QString> entries = src_cfg.entryMap(QString::number(group));
++pos;
dest_cfg.deleteGroup(QString::number(pos));
@ -54,5 +52,4 @@ int main( int argc, char* argv[] )
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}

Some files were not shown because too many files have changed in this diff Show more