18#include <KConfigGroup>
20#include <KWayland/Client/connection_thread.h>
21#include <KWayland/Client/registry.h>
22#include <KWayland/Client/slide.h>
23#include <KWayland/Client/surface.h>
26#include <xcb/xcb_icccm.h>
29static const QString s_socketName = QStringLiteral(
"wayland_test_effects_wobbly_shade-0");
42void WobblyWindowsShadeTest::initTestCase()
45 QSKIP(
"no render node available");
48 qRegisterMetaType<KWin::Window *>();
49 qRegisterMetaType<KWin::Effect *>();
53 QRect(0, 0, 1280, 1024),
54 QRect(1280, 0, 1280, 1024),
58 auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
59 KConfigGroup plugins(config, QStringLiteral(
"Plugins"));
61 for (QString name : builtinNames) {
62 plugins.writeEntry(name + QStringLiteral(
"Enabled"),
false);
66 kwinApp()->setConfig(config);
68 qputenv(
"KWIN_COMPOSE", QByteArrayLiteral(
"O2"));
69 qputenv(
"KWIN_EFFECTS_FORCE_ANIMATIONS",
"1");
71 QVERIFY(applicationStartedSpy.wait());
74void WobblyWindowsShadeTest::init()
79void WobblyWindowsShadeTest::cleanup()
87void WobblyWindowsShadeTest::testShadeMove()
94 QVERIFY(!xcb_connection_has_error(c.get()));
95 const QRect windowGeometry(0, 0, 100, 200);
96 xcb_window_t windowId = xcb_generate_id(c.get());
97 xcb_create_window(c.get(), XCB_COPY_FROM_PARENT, windowId,
rootWindow(),
100 windowGeometry.width(),
101 windowGeometry.height(),
102 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0,
nullptr);
103 xcb_size_hints_t hints;
104 memset(&hints, 0,
sizeof(hints));
105 xcb_icccm_size_hints_set_position(&hints, 1, windowGeometry.x(), windowGeometry.y());
106 xcb_icccm_size_hints_set_size(&hints, 1, windowGeometry.width(), windowGeometry.height());
107 xcb_icccm_set_wm_normal_hints(c.get(), windowId, &hints);
108 xcb_map_window(c.get(), windowId);
113 QVERIFY(windowCreatedSpy.wait());
116 QCOMPARE(window->
window(), windowId);
122 QSignalSpy readyForPaintingChangedSpy(window, &Window::readyForPaintingChanged);
123 QVERIFY(readyForPaintingChangedSpy.wait());
129 QSignalSpy interactiveMoveResizeStartedSpy(window, &Window::interactiveMoveResizeStarted);
132 QVERIFY(
workspace()->moveResizeWindow() ==
nullptr);
135 QCOMPARE(
workspace()->moveResizeWindow(), window);
137 QCOMPARE(interactiveMoveResizeStartedSpy.count(), 1);
169#include "wobbly_shade_test.moc"
QStringList listOfKnownEffects() const override
All the Effects this loader knows of.
QStringList loadedEffects
Q_SCRIPTABLE bool loadEffect(const QString &name)
Q_SCRIPTABLE bool isEffectLoaded(const QString &name) const
bool isInteractiveMove() const
void updateInteractiveMoveResize(const QPointF ¤tGlobalCursor)
void windowAdded(KWin::Window *)
bool isShadeable() const override
void keyPressEvent(uint key_code, xcb_timestamp_t time)
xcb_window_t window() const
#define WAYLANDTEST_MAIN(TestObject)
void destroyWaylandConnection()
void setOutputConfig(const QList< QRect > &geometries)
bool setupWaylandConnection(AdditionalWaylandInterfaces flags=AdditionalWaylandInterfaces())
XcbConnectionPtr createX11Connection()
bool renderNodeAvailable()
std::unique_ptr< xcb_connection_t, XcbConnectionDeleter > XcbConnectionPtr
KWIN_EXPORT xcb_window_t rootWindow()
WaylandServer * waylandServer()