Commit cdf77766 authored by Xaver Hugl's avatar Xaver Hugl
Browse files

autotests/integration: use std::unique_ptr for wayland surfaces

parent 65a2f88d
Pipeline #219462 passed with stage
in 13 minutes and 38 seconds
......@@ -71,7 +71,7 @@ private Q_SLOTS:
void testTooltipDoesntEatKeyEvents();
private:
Window *showWindow();
std::pair<Window *, std::unique_ptr<KWayland::Client::Surface>> showWindow();
};
#define MOTION(target) Test::pointerMotion(target, timestamp++)
......@@ -80,19 +80,19 @@ private:
#define RELEASE Test::pointerButtonReleased(BTN_LEFT, timestamp++)
Window *DecorationInputTest::showWindow()
std::pair<Window *, std::unique_ptr<KWayland::Client::Surface>> DecorationInputTest::showWindow()
{
using namespace KWayland::Client;
#define VERIFY(statement) \
if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__)) \
return nullptr;
return {nullptr, nullptr};
#define COMPARE(actual, expected) \
if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__)) \
return nullptr;
return {nullptr, nullptr};
KWayland::Client::Surface *surface = Test::createSurface(Test::waylandCompositor());
VERIFY(surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface, Test::CreationSetup::CreateOnly, surface);
std::unique_ptr<KWayland::Client::Surface> surface{Test::createSurface()};
VERIFY(surface.get());
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), Test::CreationSetup::CreateOnly, surface.get());
VERIFY(shellSurface);
Test::XdgToplevelDecorationV1 *decoration = Test::createXdgToplevelDecorationV1(shellSurface, shellSurface);
VERIFY(decoration);
......@@ -107,14 +107,14 @@ Window *DecorationInputTest::showWindow()
// let's render
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
auto window = Test::renderAndWaitForShown(surface, QSize(500, 50), Qt::blue);
auto window = Test::renderAndWaitForShown(surface.get(), QSize(500, 50), Qt::blue);
VERIFY(window);
COMPARE(workspace()->activeWindow(), window);
#undef VERIFY
#undef COMPARE
return window;
return {window, std::move(surface)};
}
void DecorationInputTest::initTestCase()
......@@ -172,7 +172,7 @@ void DecorationInputTest::testAxis_data()
void DecorationInputTest::testAxis()
{
Window *window = showWindow();
const auto [window, surface] = showWindow();
QVERIFY(window);
QVERIFY(window->isDecorated());
QVERIFY(!window->noBorder());
......@@ -221,7 +221,7 @@ void DecorationInputTest::testDoubleClick_data()
void KWin::DecorationInputTest::testDoubleClick()
{
Window *window = showWindow();
const auto [window, surface] = showWindow();
QVERIFY(window);
QVERIFY(window->isDecorated());
QVERIFY(!window->noBorder());
......@@ -271,7 +271,7 @@ void DecorationInputTest::testDoubleTap_data()
void KWin::DecorationInputTest::testDoubleTap()
{
Window *window = showWindow();
const auto [window, surface] = showWindow();
QVERIFY(window);
QVERIFY(window->isDecorated());
QVERIFY(!window->noBorder());
......@@ -313,7 +313,7 @@ void KWin::DecorationInputTest::testDoubleTap()
void DecorationInputTest::testHover()
{
Window *window = showWindow();
const auto [window, surface] = showWindow();
QVERIFY(window);
QVERIFY(window->isDecorated());
QVERIFY(!window->noBorder());
......@@ -372,7 +372,7 @@ void DecorationInputTest::testPressToMove_data()
void DecorationInputTest::testPressToMove()
{
Window *window = showWindow();
const auto [window, surface] = showWindow();
QVERIFY(window);
QVERIFY(window->isDecorated());
QVERIFY(!window->noBorder());
......@@ -431,7 +431,7 @@ void DecorationInputTest::testTapToMove_data()
void DecorationInputTest::testTapToMove()
{
Window *window = showWindow();
const auto [window, surface] = showWindow();
QVERIFY(window);
QVERIFY(window->isDecorated());
QVERIFY(!window->noBorder());
......@@ -497,7 +497,7 @@ void DecorationInputTest::testResizeOutsideWindow()
workspace()->slotReconfigure();
// now create window
Window *window = showWindow();
const auto [window, surface] = showWindow();
QVERIFY(window);
QVERIFY(window->isDecorated());
QVERIFY(!window->noBorder());
......@@ -594,7 +594,7 @@ void DecorationInputTest::testModifierClickUnrestrictedMove()
QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove);
// create a window
Window *window = showWindow();
const auto [window, surface] = showWindow();
QVERIFY(window);
QVERIFY(window->isDecorated());
QVERIFY(!window->noBorder());
......@@ -656,7 +656,7 @@ void DecorationInputTest::testModifierScrollOpacity()
group.sync();
workspace()->slotReconfigure();
Window *window = showWindow();
const auto [window, surface] = showWindow();
QVERIFY(window);
QVERIFY(window->isDecorated());
QVERIFY(!window->noBorder());
......@@ -715,7 +715,7 @@ void DecorationInputTest::testTouchEvents()
{
// this test verifies that the decoration gets a hover leave event on touch release
// see BUG 386231
Window *window = showWindow();
const auto [window, surface] = showWindow();
QVERIFY(window);
QVERIFY(window->isDecorated());
QVERIFY(!window->noBorder());
......@@ -764,7 +764,7 @@ void DecorationInputTest::testTooltipDoesntEatKeyEvents()
QSignalSpy enteredSpy(keyboard, &KWayland::Client::Keyboard::entered);
QVERIFY(enteredSpy.isValid());
Window *window = showWindow();
const auto [window, surface] = showWindow();
QVERIFY(window);
QVERIFY(window->isDecorated());
QVERIFY(!window->noBorder());
......
......@@ -83,12 +83,12 @@ void DontCrashCancelAnimationFromAnimationEndedTest::testScript()
using namespace KWayland::Client;
// create a window
KWayland::Client::Surface *surface = Test::createSurface(Test::waylandCompositor());
std::unique_ptr<KWayland::Client::Surface> surface{Test::createSurface()};
QVERIFY(surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface, surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
QVERIFY(shellSurface);
// let's render
auto window = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(window);
QCOMPARE(workspace()->activeWindow(), window);
......@@ -99,7 +99,7 @@ void DontCrashCancelAnimationFromAnimationEndedTest::testScript()
QSignalSpy windowDeletedSpy(window, &Window::windowClosed);
QVERIFY(windowDeletedSpy.isValid());
surface->deleteLater();
surface.reset();
QVERIFY(windowDeletedSpy.wait());
// make sure we animate
......
......@@ -188,12 +188,12 @@ void ScriptedEffectsTest::testEffectsHandler()
// create a window
using namespace KWayland::Client;
auto *surface = Test::createSurface(Test::waylandCompositor());
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
QVERIFY(surface);
auto *shellSurface = Test::createXdgToplevelSurface(surface, surface);
auto *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
QVERIFY(shellSurface);
shellSurface->set_title("WindowA");
auto *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
auto *c = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(c);
QCOMPARE(workspace()->activeWindow(), c);
......@@ -207,7 +207,7 @@ void ScriptedEffectsTest::testEffectsHandler()
c->unminimize();
waitFor("windowUnminimized - WindowA");
surface->deleteLater();
surface.reset();
waitFor("windowClosed - WindowA");
// desktop management
......@@ -267,12 +267,12 @@ void ScriptedEffectsTest::testAnimations()
// animated after window added connect
using namespace KWayland::Client;
auto *surface = Test::createSurface(Test::waylandCompositor());
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
QVERIFY(surface);
auto *shellSurface = Test::createXdgToplevelSurface(surface, surface);
auto *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
QVERIFY(shellSurface);
shellSurface->set_title("Window 1");
auto *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
auto *c = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(c);
QCOMPARE(workspace()->activeWindow(), c);
......@@ -374,12 +374,12 @@ void ScriptedEffectsTest::testFullScreenEffect()
QSignalSpy isActiveFullScreenEffectSpyOther(effectOther, &ScriptedEffect::isActiveFullScreenEffectChanged);
using namespace KWayland::Client;
auto *surface = Test::createSurface(Test::waylandCompositor());
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
QVERIFY(surface);
auto *shellSurface = Test::createXdgToplevelSurface(surface, surface);
auto *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
QVERIFY(shellSurface);
shellSurface->set_title("Window 1");
auto *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
auto *c = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(c);
QCOMPARE(workspace()->activeWindow(), c);
......@@ -438,11 +438,11 @@ void ScriptedEffectsTest::testKeepAlive()
// create a window
using namespace KWayland::Client;
auto *surface = Test::createSurface(Test::waylandCompositor());
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
QVERIFY(surface);
auto *shellSurface = Test::createXdgToplevelSurface(surface, surface);
auto *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
QVERIFY(shellSurface);
auto *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
auto *c = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(c);
QCOMPARE(workspace()->activeWindow(), c);
......@@ -450,7 +450,7 @@ void ScriptedEffectsTest::testKeepAlive()
QCOMPARE(effect->state().count(), 0);
// trigger windowClosed signal
surface->deleteLater();
surface.reset();
QVERIFY(effectOutputSpy.count() == 1 || effectOutputSpy.wait());
if (keepAlive) {
......@@ -484,11 +484,11 @@ void ScriptedEffectsTest::testGrab()
// create test window
using namespace KWayland::Client;
KWayland::Client::Surface *surface = Test::createSurface(Test::waylandCompositor());
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
QVERIFY(surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface, surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
QVERIFY(shellSurface);
Window *window = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(window);
QCOMPARE(workspace()->activeWindow(), window);
......@@ -517,11 +517,11 @@ void ScriptedEffectsTest::testGrabAlreadyGrabbedWindow()
// create test window
using namespace KWayland::Client;
KWayland::Client::Surface *surface = Test::createSurface(Test::waylandCompositor());
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
QVERIFY(surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface, surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
QVERIFY(shellSurface);
Window *window = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(window);
QCOMPARE(workspace()->activeWindow(), window);
......@@ -554,11 +554,11 @@ void ScriptedEffectsTest::testGrabAlreadyGrabbedWindowForced()
// create test window
using namespace KWayland::Client;
KWayland::Client::Surface *surface = Test::createSurface(Test::waylandCompositor());
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
QVERIFY(surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface, surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
QVERIFY(shellSurface);
Window *window = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(window);
QCOMPARE(workspace()->activeWindow(), window);
......@@ -585,11 +585,11 @@ void ScriptedEffectsTest::testUngrab()
// create test window
using namespace KWayland::Client;
KWayland::Client::Surface *surface = Test::createSurface(Test::waylandCompositor());
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
QVERIFY(surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface, surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
QVERIFY(shellSurface);
Window *window = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(window);
QCOMPARE(workspace()->activeWindow(), window);
......@@ -628,11 +628,11 @@ void ScriptedEffectsTest::testRedirect()
// create test window
using namespace KWayland::Client;
KWayland::Client::Surface *surface = Test::createSurface(Test::waylandCompositor());
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
QVERIFY(surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface, surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
QVERIFY(shellSurface);
Window *window = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(window);
QCOMPARE(workspace()->activeWindow(), window);
......@@ -706,11 +706,11 @@ void ScriptedEffectsTest::testComplete()
// create test window
using namespace KWayland::Client;
KWayland::Client::Surface *surface = Test::createSurface(Test::waylandCompositor());
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
QVERIFY(surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface, surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
QVERIFY(shellSurface);
Window *window = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
QVERIFY(window);
QCOMPARE(workspace()->activeWindow(), window);
......
......@@ -104,20 +104,20 @@ void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange()
// now create the two windows and make them overlap
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
QVERIFY(windowAddedSpy.isValid());
KWayland::Client::Surface *surface1 = Test::createSurface(Test::waylandCompositor());
std::unique_ptr<KWayland::Client::Surface> surface1 = Test::createSurface();
QVERIFY(surface1);
Test::XdgToplevel *shellSurface1 = Test::createXdgToplevelSurface(surface1, surface1);
Test::XdgToplevel *shellSurface1 = Test::createXdgToplevelSurface(surface1.get(), surface1.get());
QVERIFY(shellSurface1);
render(surface1);
render(surface1.get());
QVERIFY(windowAddedSpy.wait());
Window *window1 = workspace()->activeWindow();
QVERIFY(window1);
KWayland::Client::Surface *surface2 = Test::createSurface(Test::waylandCompositor());
std::unique_ptr<KWayland::Client::Surface> surface2 = Test::createSurface();
QVERIFY(surface2);
Test::XdgToplevel *shellSurface2 = Test::createXdgToplevelSurface(surface2, surface2);
Test::XdgToplevel *shellSurface2 = Test::createXdgToplevelSurface(surface2.get(), surface2.get());
QVERIFY(shellSurface2);
render(surface2);
render(surface2.get());
QVERIFY(windowAddedSpy.wait());
Window *window2 = workspace()->activeWindow();
......@@ -133,7 +133,7 @@ void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange()
QVERIFY(enteredSpy.wait());
QCOMPARE(enteredSpy.count(), 1);
// window 2 should have focus
QCOMPARE(pointer->enteredSurface(), surface2);
QCOMPARE(pointer->enteredSurface(), surface2.get());
// also on the server
QCOMPARE(waylandServer()->seat()->focusedPointerSurface(), window2->surface());
......@@ -145,17 +145,17 @@ void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange()
QCOMPARE(leftSpy.count(), 1);
// and an enter to window1
QCOMPARE(enteredSpy.count(), 2);
QCOMPARE(pointer->enteredSurface(), surface1);
QCOMPARE(pointer->enteredSurface(), surface1.get());
QCOMPARE(waylandServer()->seat()->focusedPointerSurface(), window1->surface());
// let's destroy window1, that should pass focus to window2 again
QSignalSpy windowClosedSpy(window1, &Window::windowClosed);
QVERIFY(windowClosedSpy.isValid());
surface1->deleteLater();
surface1.reset();
QVERIFY(windowClosedSpy.wait());
QVERIFY(enteredSpy.wait());
QCOMPARE(enteredSpy.count(), 3);
QCOMPARE(pointer->enteredSurface(), surface2);
QCOMPARE(pointer->enteredSurface(), surface2.get());
QCOMPARE(waylandServer()->seat()->focusedPointerSurface(), window2->surface());
}
......
......@@ -301,22 +301,22 @@ void InputMethodTest::testSwitchFocusedSurfaces()
std::unique_ptr<TextInput> textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat()));
QVector<Window *> windows;
QVector<KWayland::Client::Surface *> surfaces;
std::vector<std::unique_ptr<KWayland::Client::Surface>> surfaces;
QVector<Test::XdgToplevel *> toplevels;
// We create 3 surfaces
for (int i = 0; i < 3; ++i) {
auto surface = Test::createSurface();
auto shellSurface = Test::createXdgToplevelSurface(surface);
windows += Test::renderAndWaitForShown(surface, QSize(1280, 1024), Qt::red);
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
auto shellSurface = Test::createXdgToplevelSurface(surface.get());
windows += Test::renderAndWaitForShown(surface.get(), QSize(1280, 1024), Qt::red);
QCOMPARE(workspace()->activeWindow(), windows.constLast());
surfaces += surface;
surfaces.push_back(std::move(surface));
toplevels += shellSurface;
}
QCOMPARE(windowAddedSpy.count(), 3);
waylandServer()->seat()->setFocusedTextInputSurface(windows.constFirst()->surface());
QVERIFY(!kwinApp()->inputMethod()->isActive());
textInput->enable(surfaces.last());
textInput->enable(surfaces.back().get());
QVERIFY(!kwinApp()->inputMethod()->isActive());
waylandServer()->seat()->setFocusedTextInputSurface(windows.first()->surface());
QVERIFY(!kwinApp()->inputMethod()->isActive());
......
......@@ -445,7 +445,7 @@ public:
}
KWayland::Client::Surface *inputPanelSurface() const
{
return m_inputSurface;
return m_inputSurface.get();
}
auto *context() const
{
......@@ -460,7 +460,7 @@ protected:
void zwp_input_method_v1_deactivate(struct ::zwp_input_method_context_v1 *context) override;
private:
QPointer<KWayland::Client::Surface> m_inputSurface;
std::unique_ptr<KWayland::Client::Surface> m_inputSurface;
QtWayland::zwp_input_panel_surface_v1 *m_inputMethodSurface = nullptr;
QPointer<Window> m_window;
struct ::zwp_input_method_context_v1 *m_context = nullptr;
......@@ -581,7 +581,7 @@ bool waitForWaylandKeyboard();
void flushWaylandConnection();
KWayland::Client::Surface *createSurface(QObject *parent = nullptr);
std::unique_ptr<KWayland::Client::Surface> createSurface();
KWayland::Client::SubSurface *createSubSurface(KWayland::Client::Surface *surface,
KWayland::Client::Surface *parentSurface, QObject *parent = nullptr);
......
......@@ -70,7 +70,7 @@ private Q_SLOTS:
private:
void unlock();
Window *showWindow();
std::pair<Window *, std::unique_ptr<KWayland::Client::Surface>> showWindow();
KWayland::Client::ConnectionThread *m_connection = nullptr;
KWayland::Client::Compositor *m_compositor = nullptr;
KWayland::Client::Seat *m_seat = nullptr;
......@@ -147,22 +147,22 @@ void LockScreenTest::unlock()
}
}
Window *LockScreenTest::showWindow()
std::pair<Window *, std::unique_ptr<KWayland::Client::Surface>> LockScreenTest::showWindow()
{
using namespace KWayland::Client;
#define VERIFY(statement) \
if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__)) \
return nullptr;
return {nullptr, nullptr};
#define COMPARE(actual, expected) \
if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__)) \
return nullptr;
return {nullptr, nullptr};
KWayland::Client::Surface *surface = Test::createSurface(m_compositor);
VERIFY(surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface, surface);
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
VERIFY(surface.get());
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
VERIFY(shellSurface);
// let's render
auto window = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
VERIFY(window);
COMPARE(workspace()->activeWindow(), window);
......@@ -170,7 +170,7 @@ Window *LockScreenTest::showWindow()
#undef VERIFY
#undef COMPARE
return window;
return {window, std::move(surface)};
}
void LockScreenTest::initTestCase()
......@@ -243,7 +243,7 @@ void LockScreenTest::testPointer()
QSignalSpy leftSpy(pointer.get(), &Pointer::left);
QVERIFY(leftSpy.isValid());
Window *window = showWindow();
auto [window, surface] = showWindow();
QVERIFY(window);
// first move cursor into the center of the window
......@@ -290,7 +290,7 @@ void LockScreenTest::testPointerButton()
QSignalSpy buttonChangedSpy(pointer.get(), &Pointer::buttonStateChanged);
QVERIFY(buttonChangedSpy.isValid());
Window *window = showWindow();
auto [window, surface] = showWindow();
QVERIFY(window);
// first move cursor into the center of the window
......@@ -333,7 +333,7 @@ void LockScreenTest::testPointerAxis()
QSignalSpy enteredSpy(pointer.get(), &Pointer::entered);
QVERIFY(enteredSpy.isValid());
Window *window = showWindow();
auto [window, surface] = showWindow();
QVERIFY(window);
// first move cursor into the center of the window
......@@ -377,7 +377,7 @@ void LockScreenTest::testKeyboard()
QSignalSpy keyChangedSpy(keyboard.get(), &Keyboard::keyChanged);
QVERIFY(keyChangedSpy.isValid());
Window *window = showWindow();
auto [window, surface] = showWindow();
QVERIFY(window);
QVERIFY(enteredSpy.wait());
QTRY_COMPARE(enteredSpy.count(), 1);
......@@ -565,7 +565,7 @@ void LockScreenTest::testEffectsKeyboardAutorepeat()
void LockScreenTest::testMoveWindow()
{
using namespace KWayland::Client;
Window *window = showWindow();
auto [window, surface] = showWindow();
QVERIFY(window);
QSignalSpy clientStepUserMovedResizedSpy(window, &Window::clientStepUserMovedResized);
QVERIFY(clientStepUserMovedResizedSpy.isValid());
......@@ -742,7 +742,7 @@ void LockScreenTest::testTouch()
auto touch = m_seat->createTouch(m_seat);
QVERIFY(touch);
QVERIFY(touch->isValid());
Window *window = showWindow();
auto [window, surface] = showWindow();
QVERIFY(window);
QSignalSpy sequenceStartedSpy(touch, &Touch::sequenceStarted);
QVERIFY(sequenceStartedSpy.isValid());
......
......@@ -54,11 +54,11 @@ private Q_SLOTS:
private:
void setPlacementPolicy(Placement::Policy policy);
/*
* Create a window with the lifespan of parent and return relevant results for testing
* Create a window and return relevant results for testing
* defaultSize is the buffer size to use if the compositor returns an empty size in the first configure
* event.
*/
PlaceWindowResult createAndPlaceWindow(const QSize &defaultSize, QObject *parent);
std::pair<PlaceWindowResult, std::unique_ptr<KWayland::Client::Surface>> createAndPlaceWindow(const QSize &defaultSize);
};
void TestPlacement::init()
......@@ -101,13 +101,13 @@ void TestPlacement::setPlacementPolicy(Placement::Policy policy)
Workspace::self()->slotReconfigure();
}
PlaceWindowResult TestPlacement::createAndPlaceWindow(const QSize &defaultSize, QObject *parent)
std<