Autotests: Use a helper method to create X11 connection
This commit is contained in:
parent
8507e602f3
commit
29b456ff25
23 changed files with 77 additions and 193 deletions
|
@ -82,19 +82,11 @@ void ActivitiesTest::cleanup()
|
|||
{
|
||||
}
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
void ActivitiesTest::testSetOnActivitiesValidates()
|
||||
{
|
||||
// this test verifies that windows can't be placed on activities that don't exist
|
||||
// create an xcb window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
|
|
@ -217,17 +217,9 @@ void TestDbusInterface::testGetWindowInfoXdgShellClient()
|
|||
QVERIFY(reply.value().empty());
|
||||
}
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
void TestDbusInterface::testGetWindowInfoX11Client()
|
||||
{
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 600, 400);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
|
|
@ -66,21 +66,13 @@ void X11DesktopWindowTest::cleanup()
|
|||
{
|
||||
}
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
void X11DesktopWindowTest::testDesktopWindow()
|
||||
{
|
||||
// this test creates a desktop window with an RGBA visual and verifies that it's only considered
|
||||
// as an RGB (opaque) window in KWin
|
||||
|
||||
// create an xcb window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
|
|
@ -84,7 +84,8 @@ void DontCrashAuroraeDestroyDecoTest::testBorderlessMaximizedWindows()
|
|||
QCOMPARE(options->borderlessMaximizedWindows(), true);
|
||||
|
||||
// create an xcb window
|
||||
xcb_connection_t *c = xcb_connect(nullptr, nullptr);
|
||||
Test::XcbConnectionPtr connection = Test::createX11Connection();
|
||||
auto c = connection.get();
|
||||
QVERIFY(!xcb_connection_has_error(c));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c);
|
||||
|
@ -126,7 +127,6 @@ void DontCrashAuroraeDestroyDecoTest::testBorderlessMaximizedWindows()
|
|||
xcb_unmap_window(c, windowId);
|
||||
xcb_destroy_window(c, windowId);
|
||||
xcb_flush(c);
|
||||
xcb_disconnect(c);
|
||||
|
||||
QSignalSpy windowClosedSpy(window, &X11Window::windowClosed);
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
|
|
|
@ -69,7 +69,10 @@ void DontCrashEmptyDecorationTest::testBug361551()
|
|||
// there a repaint is scheduled and the resulting texture is invalid if the window size is invalid
|
||||
|
||||
// create an xcb window
|
||||
xcb_connection_t *c = xcb_connect(nullptr, nullptr);
|
||||
Test::XcbConnectionPtr connection = Test::createX11Connection();
|
||||
auto c = connection.get();
|
||||
|
||||
QVERIFY(c);
|
||||
QVERIFY(!xcb_connection_has_error(c));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c);
|
||||
|
@ -93,7 +96,6 @@ void DontCrashEmptyDecorationTest::testBug361551()
|
|||
xcb_unmap_window(c, windowId);
|
||||
xcb_destroy_window(c, windowId);
|
||||
xcb_flush(c);
|
||||
xcb_disconnect(c);
|
||||
|
||||
QSignalSpy windowClosedSpy(window, &X11Window::windowClosed);
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
|
|
|
@ -95,14 +95,6 @@ void SlidingPopupsTest::cleanup()
|
|||
}
|
||||
}
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
void SlidingPopupsTest::testWithOtherEffect_data()
|
||||
{
|
||||
QTest::addColumn<QStringList>("effectsToLoad");
|
||||
|
@ -159,7 +151,7 @@ void SlidingPopupsTest::testWithOtherEffect()
|
|||
QSignalSpy windowAddedSpy(effects, &EffectsHandler::windowAdded);
|
||||
|
||||
// create an xcb window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
|
|
@ -96,14 +96,6 @@ void TranslucencyTest::cleanup()
|
|||
m_translucencyEffect = nullptr;
|
||||
}
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
void TranslucencyTest::testMoveAfterDesktopChange()
|
||||
{
|
||||
// test tries to simulate the condition of bug 366081
|
||||
|
@ -112,7 +104,7 @@ void TranslucencyTest::testMoveAfterDesktopChange()
|
|||
QSignalSpy windowAddedSpy(effects, &EffectsHandler::windowAdded);
|
||||
|
||||
// create an xcb window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -175,7 +167,7 @@ void TranslucencyTest::testDialogClose()
|
|||
QSignalSpy windowAddedSpy(effects, &EffectsHandler::windowAdded);
|
||||
|
||||
// create an xcb window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
|
|
@ -84,14 +84,6 @@ void WobblyWindowsShadeTest::cleanup()
|
|||
QVERIFY(effectsImpl->loadedEffects().isEmpty());
|
||||
}
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
void WobblyWindowsShadeTest::testShadeMove()
|
||||
{
|
||||
// this test simulates the condition from BUG 390953
|
||||
|
@ -99,7 +91,7 @@ void WobblyWindowsShadeTest::testShadeMove()
|
|||
QVERIFY(e->loadEffect(QStringLiteral("wobblywindows")));
|
||||
QVERIFY(e->isEffectLoaded(QStringLiteral("wobblywindows")));
|
||||
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
|
|
@ -279,21 +279,13 @@ void GlobalShortcutsTest::testComponseKey()
|
|||
QTRY_COMPARE(triggeredSpy.count(), 0);
|
||||
}
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
void GlobalShortcutsTest::testX11WindowShortcut()
|
||||
{
|
||||
#ifdef NO_XWAYLAND
|
||||
QSKIP("x11 test, unnecessary without xwayland");
|
||||
#endif
|
||||
// create an X11 window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
const QRect windowGeometry = QRect(0, 0, 10, 20);
|
||||
|
|
|
@ -675,6 +675,20 @@ bool lockScreen();
|
|||
*/
|
||||
bool unlockScreen();
|
||||
|
||||
/**
|
||||
* Creates an X11 connection
|
||||
* Internally a nested event loop is spawned whilst we connect to avoid a deadlock
|
||||
* with X on demand
|
||||
*/
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer);
|
||||
};
|
||||
|
||||
typedef std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> XcbConnectionPtr;
|
||||
XcbConnectionPtr createX11Connection();
|
||||
|
||||
MockInputMethod *inputMethod();
|
||||
KWayland::Client::Surface *inputPanelSurface();
|
||||
|
||||
|
|
|
@ -589,19 +589,11 @@ void MoveResizeWindowTest::testPlasmaShellSurfaceMovable()
|
|||
QVERIFY(Test::waitForWindowDestroyed(window));
|
||||
}
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
void MoveResizeWindowTest::testNetMove()
|
||||
{
|
||||
// this test verifies that a move request for an X11 window through NET API works
|
||||
// create an xcb window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -685,7 +677,7 @@ void MoveResizeWindowTest::testAdjustClientGeometryOfAutohidingX11Panel()
|
|||
// see BUG 365892
|
||||
|
||||
// first create our panel
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
|
|
@ -92,14 +92,7 @@ void PlasmaWindowTest::testCreateDestroyX11PlasmaWindow()
|
|||
QSignalSpy plasmaWindowCreatedSpy(m_windowManagement, &KWayland::Client::PlasmaWindowManagement::windowCreated);
|
||||
|
||||
// create an xcb window
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
|
|
@ -518,14 +518,6 @@ void QuickTilingTest::testQuickTilingTouchMove()
|
|||
QCOMPARE(false, toplevelConfigureRequestedSpy.last().first().toSize().isEmpty());
|
||||
}
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
void QuickTilingTest::testX11QuickTiling_data()
|
||||
{
|
||||
QTest::addColumn<QuickTileMode>("mode");
|
||||
|
@ -551,7 +543,7 @@ void QuickTilingTest::testX11QuickTiling_data()
|
|||
}
|
||||
void QuickTilingTest::testX11QuickTiling()
|
||||
{
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -631,7 +623,7 @@ void QuickTilingTest::testX11QuickTilingAfterVertMaximize_data()
|
|||
|
||||
void QuickTilingTest::testX11QuickTilingAfterVertMaximize()
|
||||
{
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
|
|
@ -70,14 +70,6 @@ void ScreenEdgeClientShowTest::init()
|
|||
QVERIFY(waylandServer()->windows().isEmpty());
|
||||
}
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
void ScreenEdgeClientShowTest::testScreenEdgeShowHideX11_data()
|
||||
{
|
||||
QTest::addColumn<QRect>("windowGeometry");
|
||||
|
@ -99,7 +91,7 @@ void ScreenEdgeClientShowTest::testScreenEdgeShowHideX11()
|
|||
// that should trigger a show of the window whenever the cursor is pushed against the screen edge
|
||||
|
||||
// create the test window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
// atom for the screenedge show hide functionality
|
||||
Xcb::Atom atom(QByteArrayLiteral("_KDE_NET_WM_SCREEN_EDGE_SHOW"), false, c.get());
|
||||
|
@ -197,7 +189,7 @@ void ScreenEdgeClientShowTest::testScreenEdgeShowX11Touch()
|
|||
// that should trigger a show of the window whenever the touch screen swipe gesture is triggered
|
||||
|
||||
// create the test window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
// atom for the screenedge show hide functionality
|
||||
Xcb::Atom atom(QByteArrayLiteral("_KDE_NET_WM_SCREEN_EDGE_SHOW"), false, c.get());
|
||||
|
|
|
@ -62,14 +62,8 @@ void ShadeTest::testShadeGeometry()
|
|||
// this test verifies that the geometry is properly restored after shading
|
||||
// see BUG: 362501
|
||||
// create an xcb window
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
|
|
@ -306,14 +306,6 @@ static xcb_window_t createGroupWindow(xcb_connection_t *conn,
|
|||
return wid;
|
||||
}
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *c)
|
||||
{
|
||||
xcb_disconnect(c);
|
||||
}
|
||||
};
|
||||
|
||||
void StackingOrderTest::testGroupTransientIsAboveWindowGroup()
|
||||
{
|
||||
// This test verifies that group transients are always above other
|
||||
|
@ -321,8 +313,7 @@ void StackingOrderTest::testGroupTransientIsAboveWindowGroup()
|
|||
|
||||
const QRect geometry = QRect(0, 0, 128, 128);
|
||||
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> conn(
|
||||
xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr conn = Test::createX11Connection();
|
||||
|
||||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::windowAdded);
|
||||
|
||||
|
@ -434,8 +425,7 @@ void StackingOrderTest::testRaiseGroupTransient()
|
|||
{
|
||||
const QRect geometry = QRect(0, 0, 128, 128);
|
||||
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> conn(
|
||||
xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr conn = Test::createX11Connection();
|
||||
|
||||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::windowAdded);
|
||||
|
||||
|
@ -565,8 +555,7 @@ void StackingOrderTest::testDeletedGroupTransient()
|
|||
|
||||
const QRect geometry = QRect(0, 0, 128, 128);
|
||||
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> conn(
|
||||
xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr conn = Test::createX11Connection();
|
||||
|
||||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::windowAdded);
|
||||
|
||||
|
@ -680,8 +669,7 @@ void StackingOrderTest::testDontKeepAboveNonModalDialogGroupTransients()
|
|||
|
||||
const QRect geometry = QRect(0, 0, 128, 128);
|
||||
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> conn(
|
||||
xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr conn = Test::createX11Connection();
|
||||
|
||||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::windowAdded);
|
||||
|
||||
|
|
|
@ -526,14 +526,6 @@ void StrutsTest::testX11Struts_data()
|
|||
<< StrutRects();
|
||||
}
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
void StrutsTest::testX11Struts()
|
||||
{
|
||||
// this test verifies that struts are applied correctly for X11 windows
|
||||
|
@ -562,7 +554,7 @@ void StrutsTest::testX11Struts()
|
|||
QCOMPARE(workspace()->restrictedMoveArea(desktop), StrutRects());
|
||||
|
||||
// create an xcb window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -689,7 +681,7 @@ void StrutsTest::test363804()
|
|||
QCOMPARE(outputs[1]->geometry(), geometries[1]);
|
||||
|
||||
// create an xcb window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -771,7 +763,7 @@ void StrutsTest::testLeftScreenSmallerBottomAligned()
|
|||
VirtualDesktop *desktop = VirtualDesktopManager::self()->currentDesktop();
|
||||
|
||||
// create the panel
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -884,7 +876,7 @@ void StrutsTest::testWindowMoveWithPanelBetweenScreens()
|
|||
VirtualDesktop *desktop = VirtualDesktopManager::self()->currentDesktop();
|
||||
|
||||
// create the panel on the right screen, left edge
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <config-kwin.h>
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "qtconcurrentrun.h"
|
||||
|
||||
#if KWIN_BUILD_SCREENLOCKER
|
||||
#include "screenlockerwatcher.h"
|
||||
|
@ -41,7 +42,9 @@
|
|||
#include <KScreenLocker/KsldApp>
|
||||
#endif
|
||||
|
||||
#include <QFutureWatcher>
|
||||
#include <QThread>
|
||||
#include <QtConcurrent>
|
||||
|
||||
// system
|
||||
#include <sys/socket.h>
|
||||
|
@ -985,6 +988,16 @@ bool unlockScreen()
|
|||
}
|
||||
#endif // KWIN_BUILD_LOCKSCREEN
|
||||
|
||||
void XcbConnectionDeleter::operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
};
|
||||
|
||||
Test::XcbConnectionPtr createX11Connection()
|
||||
{
|
||||
return Test::XcbConnectionPtr(xcb_connect(null, null));
|
||||
}
|
||||
|
||||
WaylandOutputManagementV2::WaylandOutputManagementV2(struct ::wl_registry *registry, int id, int version)
|
||||
: QObject()
|
||||
, QtWayland::kde_output_management_v2()
|
||||
|
|
|
@ -93,7 +93,7 @@ void WindowRuleTest::testApplyInitialMaximizeVert()
|
|||
workspace()->slotReconfigure();
|
||||
|
||||
// create the test window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -159,7 +159,7 @@ void WindowRuleTest::testWindowClassChange()
|
|||
workspace()->slotReconfigure();
|
||||
|
||||
// create the test window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
|
|
@ -84,14 +84,6 @@ void X11WindowTest::cleanup()
|
|||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
void X11WindowTest::testMinimumSize()
|
||||
{
|
||||
// This test verifies that the minimum size constraint is correctly applied.
|
||||
|
@ -100,7 +92,7 @@ void X11WindowTest::testMinimumSize()
|
|||
kwinApp()->setXwaylandScale(scale);
|
||||
|
||||
// Create an xcb window.
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -206,7 +198,7 @@ void X11WindowTest::testMaximumSize()
|
|||
kwinApp()->setXwaylandScale(scale);
|
||||
|
||||
// Create an xcb window.
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -311,7 +303,7 @@ void X11WindowTest::testResizeIncrements()
|
|||
kwinApp()->setXwaylandScale(scale);
|
||||
|
||||
// Create an xcb window.
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -395,7 +387,7 @@ void X11WindowTest::testResizeIncrementsNoBaseSize()
|
|||
kwinApp()->setXwaylandScale(scale);
|
||||
|
||||
// Create an xcb window.
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -498,7 +490,7 @@ void X11WindowTest::testTrimCaption()
|
|||
// this test verifies that caption is properly trimmed
|
||||
|
||||
// create an xcb window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -548,7 +540,7 @@ void X11WindowTest::testFullscreenLayerWithActiveWaylandWindow()
|
|||
QCOMPARE(workspace()->outputs().count(), 1);
|
||||
|
||||
// first create an X11 window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -667,7 +659,7 @@ void X11WindowTest::testFocusInWithWaylandLastActiveWindow()
|
|||
kwinApp()->setXwaylandScale(scale);
|
||||
|
||||
// create an X11 window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -726,7 +718,7 @@ void X11WindowTest::testX11WindowId()
|
|||
kwinApp()->setXwaylandScale(scale);
|
||||
|
||||
// create an X11 window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -801,7 +793,7 @@ void X11WindowTest::testCaptionChanges()
|
|||
|
||||
// verifies that caption is updated correctly when the X11 window updates it
|
||||
// BUG: 383444
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -876,7 +868,7 @@ void X11WindowTest::testCaptionMultipleWindows()
|
|||
|
||||
// BUG 384760
|
||||
// create first window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -952,7 +944,7 @@ void X11WindowTest::testFullscreenWindowGroups()
|
|||
QFETCH_GLOBAL(qreal, scale);
|
||||
kwinApp()->setXwaylandScale(scale);
|
||||
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
@ -1028,7 +1020,7 @@ void X11WindowTest::testActivateFocusedWindow()
|
|||
QFETCH_GLOBAL(qreal, scale);
|
||||
kwinApp()->setXwaylandScale(scale);
|
||||
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> connection(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr connection = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(connection.get()));
|
||||
|
||||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::windowAdded);
|
||||
|
@ -1096,7 +1088,7 @@ void X11WindowTest::testReentrantMoveResize()
|
|||
kwinApp()->setXwaylandScale(scale);
|
||||
|
||||
// Create a test window.
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
|
|
@ -63,14 +63,6 @@ void XWaylandInputTest::init()
|
|||
QVERIFY(waylandServer()->windows().isEmpty());
|
||||
}
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
class X11EventReaderHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -123,7 +115,7 @@ void XWaylandInputTest::testPointerEnterLeaveSsd()
|
|||
// this test simulates a pointer enter and pointer leave on a server-side decorated X11 window
|
||||
|
||||
// create the test window
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
if (xcb_get_setup(c.get())->release_number < 11800000) {
|
||||
QSKIP("XWayland 1.18 required");
|
||||
|
@ -192,7 +184,7 @@ void XWaylandInputTest::testPointerEventLeaveCsd()
|
|||
{
|
||||
// this test simulates a pointer enter and pointer leave on a client-side decorated X11 window
|
||||
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
|
||||
if (xcb_get_setup(c.get())->release_number < 11800000) {
|
||||
|
|
|
@ -23,14 +23,6 @@
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_xwayland_server_crash-0");
|
||||
|
||||
class XwaylandServerCrashTest : public QObject
|
||||
|
@ -69,7 +61,7 @@ void XwaylandServerCrashTest::testCrash()
|
|||
// This test verifies that all connected X11 clients get destroyed when Xwayland crashes.
|
||||
|
||||
// Create a normal window.
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
xcb_window_t windowId1 = xcb_generate_id(c.get());
|
||||
|
|
|
@ -21,14 +21,6 @@
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
struct XcbConnectionDeleter
|
||||
{
|
||||
void operator()(xcb_connection_t *pointer)
|
||||
{
|
||||
xcb_disconnect(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_xwayland_server_restart-0");
|
||||
|
||||
class XwaylandServerRestartTest : public QObject
|
||||
|
@ -75,7 +67,7 @@ void XwaylandServerRestartTest::testRestart()
|
|||
QCOMPARE(startedSpy.count(), 1);
|
||||
|
||||
// Check that the compositor still accepts new X11 clients.
|
||||
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect rect(0, 0, 100, 200);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
|
|
Loading…
Reference in a new issue