Commit 8955a242 authored by Xaver Hugl's avatar Xaver Hugl
Browse files

replace all uses of QScopedPointer with std::unique_ptr

parent 3e820f71
Pipeline #212810 failed with stage
in 32 minutes and 9 seconds
This diff is collapsed.
......@@ -87,7 +87,7 @@ void ActivitiesTest::cleanup()
struct XcbConnectionDeleter
{
static inline void cleanup(xcb_connection_t *pointer)
void operator()(xcb_connection_t *pointer)
{
xcb_disconnect(pointer);
}
......@@ -97,26 +97,26 @@ void ActivitiesTest::testSetOnActivitiesValidates()
{
// this test verifies that windows can't be placed on activities that don't exist
// create an xcb window
QScopedPointer<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
QVERIFY(!xcb_connection_has_error(c.data()));
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
QVERIFY(!xcb_connection_has_error(c.get()));
xcb_window_t windowId = xcb_generate_id(c.data());
xcb_window_t windowId = xcb_generate_id(c.get());
const QRect windowGeometry(0, 0, 100, 200);
auto cookie = xcb_create_window_checked(c.data(), 0, windowId, rootWindow(),
auto cookie = xcb_create_window_checked(c.get(), 0, windowId, rootWindow(),
windowGeometry.x(),
windowGeometry.y(),
windowGeometry.width(),
windowGeometry.height(),
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, 0, 0, nullptr);
QVERIFY(!xcb_request_check(c.data(), cookie));
QVERIFY(!xcb_request_check(c.get(), cookie));
xcb_size_hints_t hints;
memset(&hints, 0, sizeof(hints));
xcb_icccm_size_hints_set_position(&hints, 1, windowGeometry.x(), windowGeometry.y());
xcb_icccm_size_hints_set_size(&hints, 1, windowGeometry.width(), windowGeometry.height());
xcb_icccm_set_wm_normal_hints(c.data(), windowId, &hints);
xcb_map_window(c.data(), windowId);
xcb_flush(c.data());
xcb_icccm_set_wm_normal_hints(c.get(), windowId, &hints);
xcb_map_window(c.get(), windowId);
xcb_flush(c.get());
// we should get a window for it
QSignalSpy windowCreatedSpy(workspace(), &Workspace::windowAdded);
......@@ -136,9 +136,9 @@ void ActivitiesTest::testSetOnActivitiesValidates()
QVERIFY(!window->activities().contains(QLatin1String("bar")));
// and destroy the window again
xcb_unmap_window(c.data(), windowId);
xcb_destroy_window(c.data(), windowId);
xcb_flush(c.data());
xcb_unmap_window(c.get(), windowId);
xcb_destroy_window(c.get(), windowId);
xcb_flush(c.get());
c.reset();
QSignalSpy windowClosedSpy(window, &X11Window::windowClosed);
......
......@@ -46,14 +46,14 @@ void BufferSizeChangeTest::testShmBufferSizeChange()
using namespace KWayland::Client;
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(surface != nullptr);
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
QVERIFY(!shellSurface.isNull());
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
QVERIFY(shellSurface != nullptr);
// set buffer size
Window *window = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(window);
// add a first repaint
......@@ -63,7 +63,7 @@ void BufferSizeChangeTest::testShmBufferSizeChange()
QVERIFY(frameRenderedSpy.wait());
// now change buffer size
Test::render(surface.data(), QSize(30, 10), Qt::red);
Test::render(surface.get(), QSize(30, 10), Qt::red);
QSignalSpy damagedSpy(window, &Window::damaged);
QVERIFY(damagedSpy.isValid());
......@@ -77,20 +77,20 @@ void BufferSizeChangeTest::testShmBufferSizeChangeOnSubSurface()
using namespace KWayland::Client;
// setup parent surface
QScopedPointer<KWayland::Client::Surface> parentSurface(Test::createSurface());
QVERIFY(!parentSurface.isNull());
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(parentSurface.data()));
QVERIFY(!shellSurface.isNull());
std::unique_ptr<KWayland::Client::Surface> parentSurface(Test::createSurface());
QVERIFY(parentSurface != nullptr);
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(parentSurface.get()));
QVERIFY(shellSurface != nullptr);
// setup sub surface
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
QScopedPointer<SubSurface> subSurface(Test::createSubSurface(surface.data(), parentSurface.data()));
QVERIFY(!subSurface.isNull());
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(surface != nullptr);
std::unique_ptr<SubSurface> subSurface(Test::createSubSurface(surface.get(), parentSurface.get()));
QVERIFY(subSurface != nullptr);
// set buffer sizes
Test::render(surface.data(), QSize(30, 10), Qt::red);
Window *parent = Test::renderAndWaitForShown(parentSurface.data(), QSize(100, 50), Qt::blue);
Test::render(surface.get(), QSize(30, 10), Qt::red);
Window *parent = Test::renderAndWaitForShown(parentSurface.get(), QSize(100, 50), Qt::blue);
QVERIFY(parent);
// add a first repaint
......@@ -102,7 +102,7 @@ void BufferSizeChangeTest::testShmBufferSizeChangeOnSubSurface()
// change buffer size of sub surface
QSignalSpy damagedParentSpy(parent, &Window::damaged);
QVERIFY(damagedParentSpy.isValid());
Test::render(surface.data(), QSize(20, 10), Qt::red);
Test::render(surface.get(), QSize(20, 10), Qt::red);
parentSurface->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(damagedParentSpy.wait());
......
......@@ -104,13 +104,13 @@ void TestDbusInterface::testGetWindowInfoXdgShellClient()
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
QVERIFY(windowAddedSpy.isValid());
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
shellSurface->set_title(QStringLiteral("Test window"));
// now let's render
Test::render(surface.data(), QSize(100, 50), Qt::blue);
Test::render(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(windowAddedSpy.isEmpty());
QVERIFY(windowAddedSpy.wait());
auto window = windowAddedSpy.first().first().value<Window *>();
......@@ -223,7 +223,7 @@ void TestDbusInterface::testGetWindowInfoXdgShellClient()
struct XcbConnectionDeleter
{
static inline void cleanup(xcb_connection_t *pointer)
void operator()(xcb_connection_t *pointer)
{
xcb_disconnect(pointer);
}
......@@ -231,11 +231,11 @@ struct XcbConnectionDeleter
void TestDbusInterface::testGetWindowInfoX11Client()
{
QScopedPointer<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
QVERIFY(!xcb_connection_has_error(c.data()));
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
QVERIFY(!xcb_connection_has_error(c.get()));
const QRect windowGeometry(0, 0, 600, 400);
xcb_window_t windowId = xcb_generate_id(c.data());
xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, windowId, rootWindow(),
xcb_window_t windowId = xcb_generate_id(c.get());
xcb_create_window(c.get(), XCB_COPY_FROM_PARENT, windowId, rootWindow(),
windowGeometry.x(),
windowGeometry.y(),
windowGeometry.width(),
......@@ -245,13 +245,13 @@ void TestDbusInterface::testGetWindowInfoX11Client()
memset(&hints, 0, sizeof(hints));
xcb_icccm_size_hints_set_position(&hints, 1, windowGeometry.x(), windowGeometry.y());
xcb_icccm_size_hints_set_size(&hints, 1, windowGeometry.width(), windowGeometry.height());
xcb_icccm_set_wm_normal_hints(c.data(), windowId, &hints);
xcb_icccm_set_wm_class(c.data(), windowId, 7, "foo\0bar");
NETWinInfo winInfo(c.data(), windowId, rootWindow(), NET::Properties(), NET::Properties2());
xcb_icccm_set_wm_normal_hints(c.get(), windowId, &hints);
xcb_icccm_set_wm_class(c.get(), windowId, 7, "foo\0bar");
NETWinInfo winInfo(c.get(), windowId, rootWindow(), NET::Properties(), NET::Properties2());
winInfo.setName("Some caption");
winInfo.setDesktopFileName("org.kde.foo");
xcb_map_window(c.data(), windowId);
xcb_flush(c.data());
xcb_map_window(c.get(), windowId);
xcb_flush(c.get());
// we should get a window for it
QSignalSpy windowCreatedSpy(workspace(), &Workspace::windowAdded);
......@@ -373,13 +373,13 @@ void TestDbusInterface::testGetWindowInfoX11Client()
const auto id = window->internalId();
// destroy the window
xcb_unmap_window(c.data(), windowId);
xcb_flush(c.data());
xcb_unmap_window(c.get(), windowId);
xcb_flush(c.get());
QSignalSpy windowClosedSpy(window, &X11Window::windowClosed);
QVERIFY(windowClosedSpy.isValid());
QVERIFY(windowClosedSpy.wait());
xcb_destroy_window(c.data(), windowId);
xcb_destroy_window(c.get(), windowId);
c.reset();
reply = getWindowInfo(id);
......
......@@ -310,11 +310,11 @@ void DebugConsoleTest::testWaylandClient()
// create the Surface and ShellSurface
using namespace KWayland::Client;
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(surface->isValid());
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
QVERIFY(!shellSurface.isNull());
Test::render(surface.data(), QSize(10, 10), Qt::red);
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
QVERIFY(shellSurface != nullptr);
Test::render(surface.get(), QSize(10, 10), Qt::red);
// now we have the window, it should be added to our model
QVERIFY(rowsInsertedSpy.wait());
......@@ -424,7 +424,7 @@ void DebugConsoleTest::testInternalWindow()
QSignalSpy rowsInsertedSpy(&model, &QAbstractItemModel::rowsInserted);
QVERIFY(rowsInsertedSpy.isValid());
QScopedPointer<HelperWindow> w(new HelperWindow);
std::unique_ptr<HelperWindow> w(new HelperWindow);
w->setGeometry(0, 0, 100, 100);
w->show();
......
......@@ -71,7 +71,7 @@ void X11DesktopWindowTest::cleanup()
struct XcbConnectionDeleter
{
static inline void cleanup(xcb_connection_t *pointer)
void operator()(xcb_connection_t *pointer)
{
xcb_disconnect(pointer);
}
......@@ -83,16 +83,16 @@ void X11DesktopWindowTest::testDesktopWindow()
// as an RGB (opaque) window in KWin
// create an xcb window
QScopedPointer<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
QVERIFY(!xcb_connection_has_error(c.data()));
std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
QVERIFY(!xcb_connection_has_error(c.get()));
xcb_window_t windowId = xcb_generate_id(c.data());
xcb_window_t windowId = xcb_generate_id(c.get());
const QRect windowGeometry(0, 0, 1280, 1024);
// helper to find the visual
auto findDepth = [&c]() -> xcb_visualid_t {
// find a visual with 32 depth
const xcb_setup_t *setup = xcb_get_setup(c.data());
const xcb_setup_t *setup = xcb_get_setup(c.get());
for (auto screen = xcb_setup_roots_iterator(setup); screen.rem; xcb_screen_next(&screen)) {
for (auto depth = xcb_screen_allowed_depths_iterator(screen.data); depth.rem; xcb_depth_next(&depth)) {
......@@ -110,27 +110,27 @@ void X11DesktopWindowTest::testDesktopWindow()
return 0;
};
auto visualId = findDepth();
auto colormapId = xcb_generate_id(c.data());
auto cmCookie = xcb_create_colormap_checked(c.data(), XCB_COLORMAP_ALLOC_NONE, colormapId, rootWindow(), visualId);
QVERIFY(!xcb_request_check(c.data(), cmCookie));
auto colormapId = xcb_generate_id(c.get());
auto cmCookie = xcb_create_colormap_checked(c.get(), XCB_COLORMAP_ALLOC_NONE, colormapId, rootWindow(), visualId);
QVERIFY(!xcb_request_check(c.get(), cmCookie));
const uint32_t values[] = {XCB_PIXMAP_NONE, Xcb::defaultScreen()->black_pixel, colormapId};
auto cookie = xcb_create_window_checked(c.data(), 32, windowId, rootWindow(),
auto cookie = xcb_create_window_checked(c.get(), 32, windowId, rootWindow(),
windowGeometry.x(),
windowGeometry.y(),
windowGeometry.width(),
windowGeometry.height(),
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, visualId, XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_COLORMAP, values);
QVERIFY(!xcb_request_check(c.data(), cookie));
QVERIFY(!xcb_request_check(c.get(), cookie));
xcb_size_hints_t hints;
memset(&hints, 0, sizeof(hints));
xcb_icccm_size_hints_set_position(&hints, 1, windowGeometry.x(), windowGeometry.y());
xcb_icccm_size_hints_set_size(&hints, 1, windowGeometry.width(), windowGeometry.height());
xcb_icccm_set_wm_normal_hints(c.data(), windowId, &hints);
NETWinInfo info(c.data(), windowId, rootWindow(), NET::WMAllProperties, NET::WM2AllProperties);
xcb_icccm_set_wm_normal_hints(c.get(), windowId, &hints);
NETWinInfo info(c.get(), windowId, rootWindow(), NET::WMAllProperties, NET::WM2AllProperties);
info.setWindowType(NET::Desktop);
xcb_map_window(c.data(), windowId);
xcb_flush(c.data());
xcb_map_window(c.get(), windowId);
xcb_flush(c.get());
// verify through a geometry request that it's depth 32
Xcb::WindowGeometry geo(windowId);
......@@ -151,9 +151,9 @@ void X11DesktopWindowTest::testDesktopWindow()
QVERIFY(!window->hasAlpha());
// and destroy the window again
xcb_unmap_window(c.data(), windowId);
xcb_destroy_window(c.data(), windowId);
xcb_flush(c.data());
xcb_unmap_window(c.get(), windowId);
xcb_destroy_window(c.get(), windowId);
xcb_flush(c.get());
c.reset();
QSignalSpy windowClosedSpy(window, &X11Window::windowClosed);
......
......@@ -79,11 +79,11 @@ void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco()
// This test ensures that there is no endless recursion if the cursor theme cannot be created
// a reason for creation failure could be physical size not existing
// see BUG: 390314
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
Test::waylandServerSideDecoration()->create(surface.data(), surface.data());
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
Test::waylandServerSideDecoration()->create(surface.get(), surface.get());
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
auto window = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(window);
QVERIFY(window->isDecorated());
......
......@@ -84,10 +84,10 @@ void DontCrashNoBorder::cleanup()
void DontCrashNoBorder::testCreateWindow()
{
// create a window and ensure that this doesn't crash
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
QScopedPointer<Test::XdgToplevelDecorationV1> decoration(Test::createXdgToplevelDecorationV1(shellSurface.data()));
QSignalSpy decorationConfigureRequestedSpy(decoration.data(), &Test::XdgToplevelDecorationV1::configureRequested);
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get(), Test::CreationSetup::CreateOnly));
std::unique_ptr<Test::XdgToplevelDecorationV1> decoration(Test::createXdgToplevelDecorationV1(shellSurface.get()));
QSignalSpy decorationConfigureRequestedSpy(decoration.get(), &Test::XdgToplevelDecorationV1::configureRequested);
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
// Initialize the xdg-toplevel surface.
......@@ -98,7 +98,7 @@ void DontCrashNoBorder::testCreateWindow()
// let's render
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
auto window = Test::renderAndWaitForShown(surface.data(), QSize(500, 50), Qt::blue);
auto window = Test::renderAndWaitForShown(surface.get(), QSize(500, 50), Qt::blue);
QVERIFY(window);
QCOMPARE(workspace()->activeWindow(), window);
QVERIFY(!window->isDecorated());
......
......@@ -113,11 +113,11 @@ void DontCrashReinitializeCompositorTest::testReinitializeCompositor()
// Create the test window.
using namespace KWayland::Client;
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
QVERIFY(!shellSurface.isNull());
Window *window = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(surface != nullptr);
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
QVERIFY(shellSurface != nullptr);
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(window);
// Make sure that only the test effect is loaded.
......
......@@ -81,9 +81,9 @@ void TestDontCrashUseractionsMenu::cleanup()
void TestDontCrashUseractionsMenu::testShowHideShowUseractionsMenu()
{
// this test creates the condition of BUG 382063
QScopedPointer<KWayland::Client::Surface> surface1(Test::createSurface());
QScopedPointer<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.data()));
auto window = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
std::unique_ptr<KWayland::Client::Surface> surface1(Test::createSurface());
std::unique_ptr<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.get()));
auto window = Test::renderAndWaitForShown(surface1.get(), QSize(100, 50), Qt::blue);
QVERIFY(window);
workspace()->showWindowMenu(QRect(), window);
......
......@@ -105,11 +105,11 @@ void DesktopSwitchingAnimationTest::testSwitchDesktops()
// The Fade Desktop effect will do nothing if there are no windows to fade,
// so we have to create a dummy test window.
using namespace KWayland::Client;
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
QVERIFY(!shellSurface.isNull());
Window *window = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(surface != nullptr);
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
QVERIFY(shellSurface != nullptr);
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(window);
QCOMPARE(window->desktops().count(), 1);
QCOMPARE(window->desktops().first(), VirtualDesktopManager::self()->desktops().first());
......
......@@ -85,14 +85,14 @@ void MaximizeAnimationTest::testMaximizeRestore()
using namespace KWayland::Client;
// Create the test window.
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(surface != nullptr);
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get(), Test::CreationSetup::CreateOnly));
// Wait for the initial configure event.
Test::XdgToplevel::States states;
QSignalSpy toplevelConfigureRequestedSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested);
QSignalSpy toplevelConfigureRequestedSpy(shellSurface.get(), &Test::XdgToplevel::configureRequested);
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
surface->commit(KWayland::Client::Surface::CommitFlag::None);
......@@ -106,7 +106,7 @@ void MaximizeAnimationTest::testMaximizeRestore()
// Draw contents of the surface.
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
Window *window = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(window);
QVERIFY(window->isActive());
QCOMPARE(window->maximizeMode(), MaximizeMode::MaximizeRestore);
......@@ -145,7 +145,7 @@ void MaximizeAnimationTest::testMaximizeRestore()
// Draw contents of the maximized window.
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
Test::render(surface.data(), QSize(1280, 1024), Qt::red);
Test::render(surface.get(), QSize(1280, 1024), Qt::red);
QVERIFY(frameGeometryChangedSpy.wait());
QCOMPARE(frameGeometryChangedSpy.count(), 1);
QCOMPARE(maximizeChangedSpy.count(), 1);
......@@ -166,7 +166,7 @@ void MaximizeAnimationTest::testMaximizeRestore()
// Draw contents of the restored window.
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
Test::render(surface.data(), QSize(100, 50), Qt::blue);
Test::render(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(frameGeometryChangedSpy.wait());
QCOMPARE(frameGeometryChangedSpy.count(), 2);
QCOMPARE(maximizeChangedSpy.count(), 2);
......
......@@ -104,16 +104,16 @@ void MinimizeAnimationTest::testMinimizeUnminimize()
// Create a panel at the top of the screen.
const QRect panelRect = QRect(0, 0, 1280, 36);
QScopedPointer<KWayland::Client::Surface> panelSurface(Test::createSurface());
QVERIFY(!panelSurface.isNull());
QScopedPointer<Test::XdgToplevel> panelShellSurface(Test::createXdgToplevelSurface(panelSurface.data()));
QVERIFY(!panelShellSurface.isNull());
QScopedPointer<PlasmaShellSurface> plasmaPanelShellSurface(Test::waylandPlasmaShell()->createSurface(panelSurface.data()));
QVERIFY(!plasmaPanelShellSurface.isNull());
std::unique_ptr<KWayland::Client::Surface> panelSurface(Test::createSurface());
QVERIFY(panelSurface != nullptr);
std::unique_ptr<Test::XdgToplevel> panelShellSurface(Test::createXdgToplevelSurface(panelSurface.get()));
QVERIFY(panelShellSurface != nullptr);
std::unique_ptr<PlasmaShellSurface> plasmaPanelShellSurface(Test::waylandPlasmaShell()->createSurface(panelSurface.get()));
QVERIFY(plasmaPanelShellSurface != nullptr);
plasmaPanelShellSurface->setRole(PlasmaShellSurface::Role::Panel);
plasmaPanelShellSurface->setPosition(panelRect.topLeft());
plasmaPanelShellSurface->setPanelBehavior(PlasmaShellSurface::PanelBehavior::AlwaysVisible);
Window *panel = Test::renderAndWaitForShown(panelSurface.data(), panelRect.size(), Qt::blue);
Window *panel = Test::renderAndWaitForShown(panelSurface.get(), panelRect.size(), Qt::blue);
QVERIFY(panel);
QVERIFY(panel->isDock());
QCOMPARE(panel->frameGeometry(), panelRect);
......@@ -121,11 +121,11 @@ void MinimizeAnimationTest::testMinimizeUnminimize()
QCOMPARE(plasmaWindowCreatedSpy.count(), 1);
// Create the test window.
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
QVERIFY(!shellSurface.isNull());
Window *window = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::red);
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(surface != nullptr);
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
QVERIFY(shellSurface != nullptr);
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::red);
QVERIFY(window);
QVERIFY(plasmaWindowCreatedSpy.wait());
QCOMPARE(plasmaWindowCreatedSpy.count(), 2);
......@@ -135,7 +135,7 @@ void MinimizeAnimationTest::testMinimizeUnminimize()
auto plasmaWindow = plasmaWindowCreatedSpy.last().first().value<PlasmaWindow *>();
QVERIFY(plasmaWindow);
const QRect iconRect = QRect(0, 0, 42, 36);
plasmaWindow->setMinimizedGeometry(panelSurface.data(), iconRect);
plasmaWindow->setMinimizedGeometry(panelSurface.get(), iconRect);
Test::flushWaylandConnection();
QTRY_COMPARE(window->iconGeometry(), iconRect.translated(panel->frameGeometry().topLeft().toPoint()));
......
......@@ -97,11 +97,11 @@ void PopupOpenCloseAnimationTest::testAnimatePopups()
// Create the main window.
using namespace KWayland::Client;
QScopedPointer<KWayland::Client::Surface> mainWindowSurface(Test::createSurface());
QVERIFY(!mainWindowSurface.isNull());
QScopedPointer<Test::XdgToplevel> mainWindowShellSurface(Test::createXdgToplevelSurface(mainWindowSurface.data()));
QVERIFY(!mainWindowShellSurface.isNull());
Window *mainWindow = Test::renderAndWaitForShown(mainWindowSurface.data(), QSize(100, 50), Qt::blue);
std::unique_ptr<KWayland::Client::Surface> mainWindowSurface(Test::createSurface());
QVERIFY(mainWindowSurface != nullptr);
std::unique_ptr<Test::XdgToplevel> mainWindowShellSurface(Test::createXdgToplevelSurface(mainWindowSurface.get()));
QVERIFY(mainWindowShellSurface != nullptr);
Window *mainWindow = Test::renderAndWaitForShown(mainWindowSurface.get(), QSize(100, 50), Qt::blue);
QVERIFY(mainWindow);
// Load effect that will be tested.
......@@ -114,16 +114,16 @@ void PopupOpenCloseAnimationTest::testAnimatePopups()
QVERIFY(!effect->isActive());
// Create a popup, it should be animated.
QScopedPointer<KWayland::Client::Surface> popupSurface(Test::createSurface());
QVERIFY(!popupSurface.isNull());
QScopedPointer<Test::XdgPositioner> positioner(Test::createXdgPositioner());
std::unique_ptr<KWayland::Client::Surface> popupSurface(Test::createSurface());
QVERIFY(popupSurface != nullptr);
std::unique_ptr<Test::XdgPositioner> positioner(Test::createXdgPositioner());
positioner->set_size(20, 20);
positioner->set_anchor_rect(0, 0, 10, 10);
positioner->set_gravity(Test::XdgPositioner::gravity_bottom_right);
positioner->set_anchor(Test::XdgPositioner::anchor_bottom_left);
QScopedPointer<Test::XdgPopup> popupShellSurface(Test::createXdgPopupSurface(popupSurface.data(), mainWindowShellSurface->xdgSurface(), positioner.data()));
QVERIFY(!popupShellSurface.isNull());
Window *popup = Test::renderAndWaitForShown(popupSurface.data(), QSize(20, 20), Qt::red);
std::unique_ptr<Test::XdgPopup> popupShellSurface(Test::createXdgPopupSurface(popupSurface.get(), mainWindowShellSurface->xdgSurface(), positioner.get()));
QVERIFY(popupShellSurface != nullptr);
Window *popup = Test::renderAndWaitForShown(popupSurface.get(), QSize(20, 20), Qt::red);
QVERIFY(popup);
QVERIFY(popup->isPopupWindow());
QCOMPARE(popup->transientFor(), mainWindow);
......@@ -159,11 +159,11 @@ void PopupOpenCloseAnimationTest::testAnimateUserActionsPopup()
// Create the test window.
using namespace KWayland::Client;
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
QVERIFY(!shellSurface.isNull());
Window *window = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(surface != nullptr);