autotests: Port xdg-shell factory functions to unique_ptr
This commit is contained in:
parent
3f6a4eb1ea
commit
af7388c8a3
14 changed files with 148 additions and 134 deletions
|
@ -70,7 +70,7 @@ private Q_SLOTS:
|
|||
void testTooltipDoesntEatKeyEvents();
|
||||
|
||||
private:
|
||||
std::tuple<Window *, std::unique_ptr<KWayland::Client::Surface>, Test::XdgToplevel *> showWindow();
|
||||
std::tuple<Window *, std::unique_ptr<KWayland::Client::Surface>, std::unique_ptr<Test::XdgToplevel>> showWindow();
|
||||
};
|
||||
|
||||
#define MOTION(target) Test::pointerMotion(target, timestamp++)
|
||||
|
@ -79,7 +79,7 @@ private:
|
|||
|
||||
#define RELEASE Test::pointerButtonReleased(BTN_LEFT, timestamp++)
|
||||
|
||||
std::tuple<Window *, std::unique_ptr<KWayland::Client::Surface>, Test::XdgToplevel *> DecorationInputTest::showWindow()
|
||||
std::tuple<Window *, std::unique_ptr<KWayland::Client::Surface>, std::unique_ptr<Test::XdgToplevel>> DecorationInputTest::showWindow()
|
||||
{
|
||||
#define VERIFY(statement) \
|
||||
if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__)) \
|
||||
|
@ -90,9 +90,9 @@ std::tuple<Window *, std::unique_ptr<KWayland::Client::Surface>, Test::XdgToplev
|
|||
|
||||
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);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get(), Test::CreationSetup::CreateOnly);
|
||||
VERIFY(shellSurface.get());
|
||||
Test::XdgToplevelDecorationV1 *decoration = Test::createXdgToplevelDecorationV1(shellSurface.get(), shellSurface.get());
|
||||
VERIFY(decoration);
|
||||
|
||||
QSignalSpy decorationConfigureRequestedSpy(decoration, &Test::XdgToplevelDecorationV1::configureRequested);
|
||||
|
@ -112,7 +112,7 @@ std::tuple<Window *, std::unique_ptr<KWayland::Client::Surface>, Test::XdgToplev
|
|||
#undef VERIFY
|
||||
#undef COMPARE
|
||||
|
||||
return {window, std::move(surface), shellSurface};
|
||||
return {window, std::move(surface), std::move(shellSurface)};
|
||||
}
|
||||
|
||||
void DecorationInputTest::initTestCase()
|
||||
|
@ -253,7 +253,7 @@ void DecorationInputTest::testDoubleClickClose()
|
|||
quint32 timestamp = 1;
|
||||
MOTION(QPoint(window->frameGeometry().center().x(), window->frameMargins().top() / 2.0));
|
||||
|
||||
connect(shellSurface, &Test::XdgToplevel::closeRequested, this, [&surface = surface]() {
|
||||
connect(shellSurface.get(), &Test::XdgToplevel::closeRequested, this, [&surface = surface]() {
|
||||
surface.reset();
|
||||
});
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ void DontCrashCancelAnimationFromAnimationEndedTest::testScript()
|
|||
// create a window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface{Test::createSurface()};
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
// let's render
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
|
|
|
@ -182,7 +182,7 @@ void ScriptedEffectsTest::testEffectsHandler()
|
|||
// create a window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
auto *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
shellSurface->set_title("WindowA");
|
||||
auto *c = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
|
@ -265,7 +265,7 @@ void ScriptedEffectsTest::testAnimations()
|
|||
// animated after window added connect
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
auto *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
shellSurface->set_title("Window 1");
|
||||
auto *c = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
|
@ -371,7 +371,7 @@ void ScriptedEffectsTest::testFullScreenEffect()
|
|||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
auto *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
shellSurface->set_title("Window 1");
|
||||
auto *c = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
|
@ -433,7 +433,7 @@ void ScriptedEffectsTest::testKeepAlive()
|
|||
// create a window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
auto *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
auto *c = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
|
@ -479,7 +479,7 @@ void ScriptedEffectsTest::testGrab()
|
|||
// create test window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
|
@ -509,7 +509,7 @@ void ScriptedEffectsTest::testGrabAlreadyGrabbedWindow()
|
|||
// create test window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
|
@ -543,7 +543,7 @@ void ScriptedEffectsTest::testGrabAlreadyGrabbedWindowForced()
|
|||
// create test window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
|
@ -572,7 +572,7 @@ void ScriptedEffectsTest::testUngrab()
|
|||
// create test window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
|
@ -614,7 +614,7 @@ void ScriptedEffectsTest::testRedirect()
|
|||
// create test window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
|
@ -690,7 +690,7 @@ void ScriptedEffectsTest::testComplete()
|
|||
// create test window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
|
|
|
@ -101,7 +101,7 @@ void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface1 = Test::createSurface();
|
||||
QVERIFY(surface1);
|
||||
Test::XdgToplevel *shellSurface1 = Test::createXdgToplevelSurface(surface1.get(), surface1.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1 = Test::createXdgToplevelSurface(surface1.get());
|
||||
QVERIFY(shellSurface1);
|
||||
render(surface1.get());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -110,7 +110,7 @@ void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange()
|
|||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface2 = Test::createSurface();
|
||||
QVERIFY(surface2);
|
||||
Test::XdgToplevel *shellSurface2 = Test::createXdgToplevelSurface(surface2.get(), surface2.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2 = Test::createXdgToplevelSurface(surface2.get());
|
||||
QVERIFY(shellSurface2);
|
||||
render(surface2.get());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
|
|
@ -361,7 +361,7 @@ void InputMethodTest::testSwitchFocusedSurfaces()
|
|||
|
||||
QList<Window *> windows;
|
||||
std::vector<std::unique_ptr<KWayland::Client::Surface>> surfaces;
|
||||
QList<Test::XdgToplevel *> toplevels;
|
||||
std::vector<std::unique_ptr<Test::XdgToplevel>> toplevels;
|
||||
// We create 3 surfaces
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
|
@ -369,7 +369,7 @@ void InputMethodTest::testSwitchFocusedSurfaces()
|
|||
windows += Test::renderAndWaitForShown(surface.get(), QSize(1280, 1024), Qt::red);
|
||||
QCOMPARE(workspace()->activeWindow(), windows.constLast());
|
||||
surfaces.push_back(std::move(surface));
|
||||
toplevels += shellSurface;
|
||||
toplevels.push_back(std::move(shellSurface));
|
||||
}
|
||||
QCOMPARE(windowAddedSpy.count(), 3);
|
||||
waylandServer()->seat()->setFocusedTextInputSurface(windows.constFirst()->surface());
|
||||
|
@ -388,12 +388,6 @@ void InputMethodTest::testSwitchFocusedSurfaces()
|
|||
waylandServer()->seat()->setFocusedTextInputSurface(windows.first()->surface());
|
||||
QVERIFY(activateSpy.count() || activateSpy.wait());
|
||||
QVERIFY(!kwinApp()->inputMethod()->isActive());
|
||||
|
||||
// Destroy the test window.
|
||||
for (int i = 0; i < windows.count(); ++i) {
|
||||
delete toplevels[i];
|
||||
QVERIFY(Test::waitForWindowClosed(windows[i]));
|
||||
}
|
||||
}
|
||||
|
||||
void InputMethodTest::testV2V3SameClient()
|
||||
|
|
|
@ -700,17 +700,14 @@ QtWayland::zwp_input_panel_surface_v1 *createInputPanelSurfaceV1(KWayland::Clien
|
|||
|
||||
FractionalScaleV1 *createFractionalScaleV1(KWayland::Client::Surface *surface);
|
||||
|
||||
XdgToplevel *createXdgToplevelSurface(KWayland::Client::Surface *surface, QObject *parent = nullptr);
|
||||
XdgToplevel *createXdgToplevelSurface(KWayland::Client::Surface *surface,
|
||||
CreationSetup configureMode,
|
||||
QObject *parent = nullptr);
|
||||
std::unique_ptr<XdgToplevel> createXdgToplevelSurface(KWayland::Client::Surface *surface);
|
||||
std::unique_ptr<XdgToplevel> createXdgToplevelSurface(KWayland::Client::Surface *surface, CreationSetup configureMode);
|
||||
|
||||
XdgPositioner *createXdgPositioner();
|
||||
std::unique_ptr<XdgPositioner> createXdgPositioner();
|
||||
|
||||
XdgPopup *createXdgPopupSurface(KWayland::Client::Surface *surface, XdgSurface *parentSurface,
|
||||
XdgPositioner *positioner,
|
||||
CreationSetup configureMode = CreationSetup::CreateAndConfigure,
|
||||
QObject *parent = nullptr);
|
||||
std::unique_ptr<XdgPopup> createXdgPopupSurface(KWayland::Client::Surface *surface, XdgSurface *parentSurface,
|
||||
XdgPositioner *positioner,
|
||||
CreationSetup configureMode = CreationSetup::CreateAndConfigure);
|
||||
|
||||
XdgToplevelDecorationV1 *createXdgToplevelDecorationV1(XdgToplevel *toplevel, QObject *parent = nullptr);
|
||||
IdleInhibitorV1 *createIdleInhibitorV1(KWayland::Client::Surface *surface);
|
||||
|
|
|
@ -71,8 +71,14 @@ private Q_SLOTS:
|
|||
void testTouch();
|
||||
|
||||
private:
|
||||
struct WindowHandle
|
||||
{
|
||||
Window *window;
|
||||
std::unique_ptr<KWayland::Client::Surface> surface;
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface;
|
||||
};
|
||||
void unlock();
|
||||
std::pair<Window *, std::unique_ptr<KWayland::Client::Surface>> showWindow();
|
||||
WindowHandle showWindow();
|
||||
KWayland::Client::ConnectionThread *m_connection = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
KWayland::Client::Seat *m_seat = nullptr;
|
||||
|
@ -147,7 +153,7 @@ void LockScreenTest::unlock()
|
|||
}
|
||||
}
|
||||
|
||||
std::pair<Window *, std::unique_ptr<KWayland::Client::Surface>> LockScreenTest::showWindow()
|
||||
LockScreenTest::WindowHandle LockScreenTest::showWindow()
|
||||
{
|
||||
#define VERIFY(statement) \
|
||||
if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__)) \
|
||||
|
@ -158,8 +164,8 @@ std::pair<Window *, std::unique_ptr<KWayland::Client::Surface>> LockScreenTest::
|
|||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
VERIFY(surface.get());
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
VERIFY(shellSurface);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
VERIFY(shellSurface.get());
|
||||
// let's render
|
||||
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
|
||||
|
@ -169,7 +175,7 @@ std::pair<Window *, std::unique_ptr<KWayland::Client::Surface>> LockScreenTest::
|
|||
#undef VERIFY
|
||||
#undef COMPARE
|
||||
|
||||
return {window, std::move(surface)};
|
||||
return {window, std::move(surface), std::move(shellSurface)};
|
||||
}
|
||||
|
||||
void LockScreenTest::initTestCase()
|
||||
|
@ -235,7 +241,7 @@ void LockScreenTest::testPointer()
|
|||
QSignalSpy enteredSpy(pointer.get(), &KWayland::Client::Pointer::entered);
|
||||
QSignalSpy leftSpy(pointer.get(), &KWayland::Client::Pointer::left);
|
||||
|
||||
auto [window, surface] = showWindow();
|
||||
auto [window, surface, shellSurface] = showWindow();
|
||||
QVERIFY(window);
|
||||
|
||||
// first move cursor into the center of the window
|
||||
|
@ -278,7 +284,7 @@ void LockScreenTest::testPointerButton()
|
|||
QSignalSpy enteredSpy(pointer.get(), &KWayland::Client::Pointer::entered);
|
||||
QSignalSpy buttonChangedSpy(pointer.get(), &KWayland::Client::Pointer::buttonStateChanged);
|
||||
|
||||
auto [window, surface] = showWindow();
|
||||
auto [window, surface, shellSurface] = showWindow();
|
||||
QVERIFY(window);
|
||||
|
||||
// first move cursor into the center of the window
|
||||
|
@ -317,7 +323,7 @@ void LockScreenTest::testPointerAxis()
|
|||
QSignalSpy axisChangedSpy(pointer.get(), &KWayland::Client::Pointer::axisChanged);
|
||||
QSignalSpy enteredSpy(pointer.get(), &KWayland::Client::Pointer::entered);
|
||||
|
||||
auto [window, surface] = showWindow();
|
||||
auto [window, surface, shellSurface] = showWindow();
|
||||
QVERIFY(window);
|
||||
|
||||
// first move cursor into the center of the window
|
||||
|
@ -356,7 +362,7 @@ void LockScreenTest::testKeyboard()
|
|||
QSignalSpy leftSpy(keyboard.get(), &KWayland::Client::Keyboard::left);
|
||||
QSignalSpy keyChangedSpy(keyboard.get(), &KWayland::Client::Keyboard::keyChanged);
|
||||
|
||||
auto [window, surface] = showWindow();
|
||||
auto [window, surface, shellSurface] = showWindow();
|
||||
QVERIFY(window);
|
||||
QVERIFY(enteredSpy.wait());
|
||||
QTRY_COMPARE(enteredSpy.count(), 1);
|
||||
|
@ -553,7 +559,7 @@ void LockScreenTest::testEffectsKeyboardAutorepeat()
|
|||
|
||||
void LockScreenTest::testMoveWindow()
|
||||
{
|
||||
auto [window, surface] = showWindow();
|
||||
auto [window, surface, shellSurface] = showWindow();
|
||||
QVERIFY(window);
|
||||
QSignalSpy interactiveMoveResizeSteppedSpy(window, &Window::interactiveMoveResizeStepped);
|
||||
quint32 timestamp = 1;
|
||||
|
@ -737,7 +743,7 @@ void LockScreenTest::testTouch()
|
|||
auto touch = m_seat->createTouch(m_seat);
|
||||
QVERIFY(touch);
|
||||
QVERIFY(touch->isValid());
|
||||
auto [window, surface] = showWindow();
|
||||
auto [window, surface, shellSurface] = showWindow();
|
||||
QVERIFY(window);
|
||||
QSignalSpy sequenceStartedSpy(touch, &KWayland::Client::Touch::sequenceStarted);
|
||||
QSignalSpy cancelSpy(touch, &KWayland::Client::Touch::sequenceCanceled);
|
||||
|
|
|
@ -25,13 +25,6 @@ using namespace KWin;
|
|||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_placement-0");
|
||||
|
||||
struct PlaceWindowResult
|
||||
{
|
||||
QSizeF initiallyConfiguredSize;
|
||||
Test::XdgToplevel::States initiallyConfiguredStates;
|
||||
QRectF finalGeometry;
|
||||
};
|
||||
|
||||
class TestPlacement : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -56,12 +49,24 @@ private Q_SLOTS:
|
|||
|
||||
private:
|
||||
void setPlacementPolicy(PlacementPolicy policy);
|
||||
struct WindowHandle
|
||||
{
|
||||
Window *window;
|
||||
std::unique_ptr<KWayland::Client::Surface> surface;
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface;
|
||||
};
|
||||
struct PlaceWindowResult
|
||||
{
|
||||
QSizeF initiallyConfiguredSize;
|
||||
Test::XdgToplevel::States initiallyConfiguredStates;
|
||||
QRectF finalGeometry;
|
||||
};
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
std::pair<PlaceWindowResult, std::unique_ptr<KWayland::Client::Surface>> createAndPlaceWindow(const QSize &defaultSize);
|
||||
std::tuple<PlaceWindowResult, WindowHandle> createAndPlaceWindow(const QSize &defaultSize);
|
||||
};
|
||||
|
||||
void TestPlacement::init()
|
||||
|
@ -105,15 +110,15 @@ void TestPlacement::setPlacementPolicy(PlacementPolicy policy)
|
|||
Workspace::self()->slotReconfigure();
|
||||
}
|
||||
|
||||
std::pair<PlaceWindowResult, std::unique_ptr<KWayland::Client::Surface>> TestPlacement::createAndPlaceWindow(const QSize &defaultSize)
|
||||
std::tuple<TestPlacement::PlaceWindowResult, TestPlacement::WindowHandle> TestPlacement::createAndPlaceWindow(const QSize &defaultSize)
|
||||
{
|
||||
PlaceWindowResult rc;
|
||||
|
||||
// create a new window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
auto shellSurface = Test::createXdgToplevelSurface(surface.get(), Test::CreationSetup::CreateOnly, surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get(), Test::CreationSetup::CreateOnly);
|
||||
|
||||
QSignalSpy toplevelConfigureRequestedSpy(shellSurface, &Test::XdgToplevel::configureRequested);
|
||||
QSignalSpy toplevelConfigureRequestedSpy(shellSurface.get(), &Test::XdgToplevel::configureRequested);
|
||||
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
|
||||
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
||||
surfaceConfigureRequestedSpy.wait();
|
||||
|
@ -131,7 +136,11 @@ std::pair<PlaceWindowResult, std::unique_ptr<KWayland::Client::Surface>> TestPla
|
|||
auto window = Test::renderAndWaitForShown(surface.get(), size.toSize(), Qt::red);
|
||||
|
||||
rc.finalGeometry = window->frameGeometry();
|
||||
return {rc, std::move(surface)};
|
||||
return {rc, WindowHandle{
|
||||
.window = window,
|
||||
.surface = std::move(surface),
|
||||
.shellSurface = std::move(shellSurface),
|
||||
}};
|
||||
}
|
||||
|
||||
void TestPlacement::testPlaceSmart()
|
||||
|
@ -150,11 +159,11 @@ void TestPlacement::testPlaceSmart()
|
|||
|
||||
setPlacementPolicy(PlacementSmart);
|
||||
|
||||
std::vector<std::unique_ptr<KWayland::Client::Surface>> surfaces;
|
||||
std::vector<WindowHandle> handles;
|
||||
|
||||
for (const QRect &desiredGeometry : desiredGeometries) {
|
||||
auto [windowPlacement, surface] = createAndPlaceWindow(QSize(600, 500));
|
||||
surfaces.push_back(std::move(surface));
|
||||
auto [windowPlacement, handle] = createAndPlaceWindow(QSize(600, 500));
|
||||
handles.push_back(std::move(handle));
|
||||
|
||||
// smart placement shouldn't define a size on windows
|
||||
QCOMPARE(windowPlacement.initiallyConfiguredSize, QSize(0, 0));
|
||||
|
@ -181,15 +190,15 @@ void TestPlacement::testPlaceMaximized()
|
|||
QVERIFY(panelConfigureRequestedSpy.wait());
|
||||
Test::renderAndWaitForShown(panelSurface.get(), panelConfigureRequestedSpy.last().at(1).toSize(), Qt::blue);
|
||||
|
||||
std::vector<std::unique_ptr<KWayland::Client::Surface>> surfaces;
|
||||
std::vector<WindowHandle> handles;
|
||||
|
||||
// all windows should be initially maximized with an initial configure size sent
|
||||
for (int i = 0; i < 4; i++) {
|
||||
auto [windowPlacement, surface] = createAndPlaceWindow(QSize(600, 500));
|
||||
auto [windowPlacement, handle] = createAndPlaceWindow(QSize(600, 500));
|
||||
QVERIFY(windowPlacement.initiallyConfiguredStates & Test::XdgToplevel::State::Maximized);
|
||||
QCOMPARE(windowPlacement.initiallyConfiguredSize, QSize(1280, 1024 - 20));
|
||||
QCOMPARE(windowPlacement.finalGeometry, QRect(0, 20, 1280, 1024 - 20)); // under the panel
|
||||
surfaces.push_back(std::move(surface));
|
||||
handles.push_back(std::move(handle));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,14 +217,14 @@ void TestPlacement::testPlaceMaximizedLeavesFullscreen()
|
|||
QVERIFY(panelConfigureRequestedSpy.wait());
|
||||
Test::renderAndWaitForShown(panelSurface.get(), panelConfigureRequestedSpy.last().at(1).toSize(), Qt::blue);
|
||||
|
||||
std::vector<std::unique_ptr<KWayland::Client::Surface>> surfaces;
|
||||
std::vector<WindowHandle> handles;
|
||||
|
||||
// all windows should be initially fullscreen with an initial configure size sent, despite the policy
|
||||
for (int i = 0; i < 4; i++) {
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
auto shellSurface = Test::createXdgToplevelSurface(surface.get(), Test::CreationSetup::CreateOnly, surface.get());
|
||||
auto shellSurface = Test::createXdgToplevelSurface(surface.get(), Test::CreationSetup::CreateOnly);
|
||||
shellSurface->set_fullscreen(nullptr);
|
||||
QSignalSpy toplevelConfigureRequestedSpy(shellSurface, &Test::XdgToplevel::configureRequested);
|
||||
QSignalSpy toplevelConfigureRequestedSpy(shellSurface.get(), &Test::XdgToplevel::configureRequested);
|
||||
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
|
||||
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
||||
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
||||
|
@ -230,7 +239,11 @@ void TestPlacement::testPlaceMaximizedLeavesFullscreen()
|
|||
QCOMPARE(initiallyConfiguredSize, QSize(1280, 1024));
|
||||
QCOMPARE(window->frameGeometry(), QRect(0, 0, 1280, 1024));
|
||||
|
||||
surfaces.push_back(std::move(surface));
|
||||
handles.emplace_back(WindowHandle{
|
||||
.window = window,
|
||||
.surface = std::move(surface),
|
||||
.shellSurface = std::move(shellSurface),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ void PointerInputTest::testWarpingUpdatesFocus()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
render(surface.get());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -227,7 +227,7 @@ void PointerInputTest::testWarpingGeneratesPointerMotion()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
render(surface.get());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -305,7 +305,7 @@ void PointerInputTest::testUpdateFocusAfterScreenChange()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
render(surface.get(), QSize(1280, 1024));
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -490,7 +490,7 @@ void PointerInputTest::testModifierClickUnrestrictedMove()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
render(surface.get());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -555,10 +555,10 @@ void PointerInputTest::testModifierClickUnrestrictedFullscreenMove()
|
|||
// create a window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
shellSurface->set_fullscreen(nullptr);
|
||||
QSignalSpy toplevelConfigureRequestedSpy(shellSurface, &Test::XdgToplevel::configureRequested);
|
||||
QSignalSpy toplevelConfigureRequestedSpy(shellSurface.get(), &Test::XdgToplevel::configureRequested);
|
||||
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
|
||||
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
||||
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
|
||||
|
@ -610,7 +610,7 @@ void PointerInputTest::testModifierClickUnrestrictedMoveGlobalShortcutsDisabled(
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
render(surface.get());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -681,7 +681,7 @@ void PointerInputTest::testModifierScrollOpacity()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
render(surface.get());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -739,7 +739,7 @@ void PointerInputTest::testModifierScrollOpacityGlobalShortcutsDisabled()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
render(surface.get());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -786,7 +786,7 @@ void PointerInputTest::testScrollAction()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface1 = Test::createSurface();
|
||||
QVERIFY(surface1);
|
||||
Test::XdgToplevel *shellSurface1 = Test::createXdgToplevelSurface(surface1.get(), surface1.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1 = Test::createXdgToplevelSurface(surface1.get());
|
||||
QVERIFY(shellSurface1);
|
||||
render(surface1.get());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -794,7 +794,7 @@ void PointerInputTest::testScrollAction()
|
|||
QVERIFY(window1);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface2 = Test::createSurface();
|
||||
QVERIFY(surface2);
|
||||
Test::XdgToplevel *shellSurface2 = Test::createXdgToplevelSurface(surface2.get(), surface2.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2 = Test::createXdgToplevelSurface(surface2.get());
|
||||
QVERIFY(shellSurface2);
|
||||
render(surface2.get());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -841,7 +841,7 @@ void PointerInputTest::testFocusFollowsMouse()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface1 = Test::createSurface();
|
||||
QVERIFY(surface1);
|
||||
Test::XdgToplevel *shellSurface1 = Test::createXdgToplevelSurface(surface1.get(), surface1.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1 = Test::createXdgToplevelSurface(surface1.get());
|
||||
QVERIFY(shellSurface1);
|
||||
render(surface1.get(), QSize(800, 800));
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -849,7 +849,7 @@ void PointerInputTest::testFocusFollowsMouse()
|
|||
QVERIFY(window1);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface2 = Test::createSurface();
|
||||
QVERIFY(surface2);
|
||||
Test::XdgToplevel *shellSurface2 = Test::createXdgToplevelSurface(surface2.get(), surface2.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2 = Test::createXdgToplevelSurface(surface2.get());
|
||||
QVERIFY(shellSurface2);
|
||||
render(surface2.get(), QSize(800, 800));
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -923,7 +923,7 @@ void PointerInputTest::testMouseActionInactiveWindow()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface1 = Test::createSurface();
|
||||
QVERIFY(surface1);
|
||||
Test::XdgToplevel *shellSurface1 = Test::createXdgToplevelSurface(surface1.get(), surface1.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1 = Test::createXdgToplevelSurface(surface1.get());
|
||||
QVERIFY(shellSurface1);
|
||||
render(surface1.get(), QSize(800, 800));
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -931,7 +931,7 @@ void PointerInputTest::testMouseActionInactiveWindow()
|
|||
QVERIFY(window1);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface2 = Test::createSurface();
|
||||
QVERIFY(surface2);
|
||||
Test::XdgToplevel *shellSurface2 = Test::createXdgToplevelSurface(surface2.get(), surface2.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2 = Test::createXdgToplevelSurface(surface2.get());
|
||||
QVERIFY(shellSurface2);
|
||||
render(surface2.get(), QSize(800, 800));
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -1008,7 +1008,7 @@ void PointerInputTest::testMouseActionActiveWindow()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface1 = Test::createSurface();
|
||||
QVERIFY(surface1);
|
||||
Test::XdgToplevel *shellSurface1 = Test::createXdgToplevelSurface(surface1.get(), surface1.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1 = Test::createXdgToplevelSurface(surface1.get());
|
||||
QVERIFY(shellSurface1);
|
||||
render(surface1.get(), QSize(800, 800));
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -1017,7 +1017,7 @@ void PointerInputTest::testMouseActionActiveWindow()
|
|||
QSignalSpy window1DestroyedSpy(window1, &QObject::destroyed);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface2 = Test::createSurface();
|
||||
QVERIFY(surface2);
|
||||
Test::XdgToplevel *shellSurface2 = Test::createXdgToplevelSurface(surface2.get(), surface2.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2 = Test::createXdgToplevelSurface(surface2.get());
|
||||
QVERIFY(shellSurface2);
|
||||
render(surface2.get(), QSize(800, 800));
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -1084,7 +1084,7 @@ void PointerInputTest::testCursorImage()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
render(surface.get());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -1214,7 +1214,7 @@ void PointerInputTest::testEffectOverrideCursorImage()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
render(surface.get());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -1279,7 +1279,7 @@ void PointerInputTest::testPopup()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
render(surface.get());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -1304,9 +1304,9 @@ void PointerInputTest::testPopup()
|
|||
positioner->set_gravity(Test::XdgPositioner::gravity_bottom_right);
|
||||
std::unique_ptr<KWayland::Client::Surface> popupSurface = Test::createSurface();
|
||||
QVERIFY(popupSurface);
|
||||
Test::XdgPopup *popupShellSurface = Test::createXdgPopupSurface(popupSurface.get(), shellSurface->xdgSurface(), positioner.get());
|
||||
std::unique_ptr<Test::XdgPopup> popupShellSurface = Test::createXdgPopupSurface(popupSurface.get(), shellSurface->xdgSurface(), positioner.get());
|
||||
QVERIFY(popupShellSurface);
|
||||
QSignalSpy doneReceivedSpy(popupShellSurface, &Test::XdgPopup::doneReceived);
|
||||
QSignalSpy doneReceivedSpy(popupShellSurface.get(), &Test::XdgPopup::doneReceived);
|
||||
popupShellSurface->grab(*Test::waylandSeat(), 0); // FIXME: Serial.
|
||||
render(popupSurface.get(), QSize(100, 50));
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -1385,9 +1385,9 @@ void PointerInputTest::testDecoCancelsPopup()
|
|||
positioner->set_gravity(Test::XdgPositioner::gravity_bottom_right);
|
||||
std::unique_ptr<KWayland::Client::Surface> popupSurface = Test::createSurface();
|
||||
QVERIFY(popupSurface);
|
||||
Test::XdgPopup *popupShellSurface = Test::createXdgPopupSurface(popupSurface.get(), shellSurface->xdgSurface(), positioner.get());
|
||||
std::unique_ptr<Test::XdgPopup> popupShellSurface = Test::createXdgPopupSurface(popupSurface.get(), shellSurface->xdgSurface(), positioner.get());
|
||||
QVERIFY(popupShellSurface);
|
||||
QSignalSpy doneReceivedSpy(popupShellSurface, &Test::XdgPopup::doneReceived);
|
||||
QSignalSpy doneReceivedSpy(popupShellSurface.get(), &Test::XdgPopup::doneReceived);
|
||||
popupShellSurface->grab(*Test::waylandSeat(), 0); // FIXME: Serial.
|
||||
auto popupWindow = Test::renderAndWaitForShown(popupSurface.get(), QSize(100, 50), Qt::red);
|
||||
QVERIFY(popupWindow);
|
||||
|
@ -1422,7 +1422,7 @@ void PointerInputTest::testWindowUnderCursorWhileButtonPressed()
|
|||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
render(surface.get());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
@ -1445,7 +1445,7 @@ void PointerInputTest::testWindowUnderCursorWhileButtonPressed()
|
|||
positioner->set_gravity(Test::XdgPositioner::gravity_bottom_right);
|
||||
std::unique_ptr<KWayland::Client::Surface> popupSurface = Test::createSurface();
|
||||
QVERIFY(popupSurface);
|
||||
Test::XdgPopup *popupShellSurface = Test::createXdgPopupSurface(popupSurface.get(), shellSurface->xdgSurface(), positioner.get());
|
||||
std::unique_ptr<Test::XdgPopup> popupShellSurface = Test::createXdgPopupSurface(popupSurface.get(), shellSurface->xdgSurface(), positioner.get());
|
||||
QVERIFY(popupShellSurface);
|
||||
render(popupSurface.get(), QSize(99, 49));
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
|
|
|
@ -84,7 +84,7 @@ void StackingOrderTest::testTransientIsAboveParent()
|
|||
// Create the parent.
|
||||
std::unique_ptr<KWayland::Client::Surface> parentSurface = Test::createSurface();
|
||||
QVERIFY(parentSurface);
|
||||
std::unique_ptr<Test::XdgToplevel> parentShellSurface(Test::createXdgToplevelSurface(parentSurface.get(), parentSurface.get()));
|
||||
std::unique_ptr<Test::XdgToplevel> parentShellSurface(Test::createXdgToplevelSurface(parentSurface.get()));
|
||||
QVERIFY(parentShellSurface);
|
||||
Window *parent = Test::renderAndWaitForShown(parentSurface.get(), QSize(256, 256), Qt::blue);
|
||||
QVERIFY(parent);
|
||||
|
@ -97,7 +97,7 @@ void StackingOrderTest::testTransientIsAboveParent()
|
|||
// Create the transient.
|
||||
std::unique_ptr<KWayland::Client::Surface> transientSurface = Test::createSurface();
|
||||
QVERIFY(transientSurface);
|
||||
std::unique_ptr<Test::XdgToplevel> transientShellSurface(Test::createXdgToplevelSurface(transientSurface.get(), transientSurface.get()));
|
||||
std::unique_ptr<Test::XdgToplevel> transientShellSurface(Test::createXdgToplevelSurface(transientSurface.get()));
|
||||
QVERIFY(transientShellSurface);
|
||||
transientShellSurface->set_parent(parentShellSurface->object());
|
||||
Window *transient = Test::renderAndWaitForShown(transientSurface.get(), QSize(128, 128), Qt::red);
|
||||
|
@ -123,7 +123,7 @@ void StackingOrderTest::testRaiseTransient()
|
|||
// Create the parent.
|
||||
std::unique_ptr<KWayland::Client::Surface> parentSurface = Test::createSurface();
|
||||
QVERIFY(parentSurface);
|
||||
std::unique_ptr<Test::XdgToplevel> parentShellSurface(Test::createXdgToplevelSurface(parentSurface.get(), parentSurface.get()));
|
||||
std::unique_ptr<Test::XdgToplevel> parentShellSurface(Test::createXdgToplevelSurface(parentSurface.get()));
|
||||
QVERIFY(parentShellSurface);
|
||||
Window *parent = Test::renderAndWaitForShown(parentSurface.get(), QSize(256, 256), Qt::blue);
|
||||
QVERIFY(parent);
|
||||
|
@ -136,7 +136,7 @@ void StackingOrderTest::testRaiseTransient()
|
|||
// Create the transient.
|
||||
std::unique_ptr<KWayland::Client::Surface> transientSurface = Test::createSurface();
|
||||
QVERIFY(transientSurface);
|
||||
std::unique_ptr<Test::XdgToplevel> transientShellSurface(Test::createXdgToplevelSurface(transientSurface.get(), transientSurface.get()));
|
||||
std::unique_ptr<Test::XdgToplevel> transientShellSurface(Test::createXdgToplevelSurface(transientSurface.get()));
|
||||
QVERIFY(transientShellSurface);
|
||||
transientShellSurface->set_parent(parentShellSurface->object());
|
||||
Window *transient = Test::renderAndWaitForShown(transientSurface.get(), QSize(128, 128), Qt::red);
|
||||
|
@ -150,7 +150,7 @@ void StackingOrderTest::testRaiseTransient()
|
|||
// Create a window that doesn't have any relationship to the parent or the transient.
|
||||
std::unique_ptr<KWayland::Client::Surface> anotherSurface = Test::createSurface();
|
||||
QVERIFY(anotherSurface);
|
||||
std::unique_ptr<Test::XdgToplevel> anotherShellSurface(Test::createXdgToplevelSurface(anotherSurface.get(), anotherSurface.get()));
|
||||
std::unique_ptr<Test::XdgToplevel> anotherShellSurface(Test::createXdgToplevelSurface(anotherSurface.get()));
|
||||
QVERIFY(anotherShellSurface);
|
||||
Window *anotherWindow = Test::renderAndWaitForShown(anotherSurface.get(), QSize(128, 128), Qt::green);
|
||||
QVERIFY(anotherWindow);
|
||||
|
@ -200,8 +200,7 @@ void StackingOrderTest::testDeletedTransient()
|
|||
// Create the parent.
|
||||
std::unique_ptr<KWayland::Client::Surface> parentSurface = Test::createSurface();
|
||||
QVERIFY(parentSurface);
|
||||
std::unique_ptr<Test::XdgToplevel>
|
||||
parentShellSurface(Test::createXdgToplevelSurface(parentSurface.get(), parentSurface.get()));
|
||||
std::unique_ptr<Test::XdgToplevel> parentShellSurface(Test::createXdgToplevelSurface(parentSurface.get()));
|
||||
QVERIFY(parentShellSurface);
|
||||
Window *parent = Test::renderAndWaitForShown(parentSurface.get(), QSize(256, 256), Qt::blue);
|
||||
QVERIFY(parent);
|
||||
|
@ -213,7 +212,7 @@ void StackingOrderTest::testDeletedTransient()
|
|||
// Create the first transient.
|
||||
std::unique_ptr<KWayland::Client::Surface> transient1Surface = Test::createSurface();
|
||||
QVERIFY(transient1Surface);
|
||||
std::unique_ptr<Test::XdgToplevel> transient1ShellSurface(Test::createXdgToplevelSurface(transient1Surface.get(), transient1Surface.get()));
|
||||
std::unique_ptr<Test::XdgToplevel> transient1ShellSurface(Test::createXdgToplevelSurface(transient1Surface.get()));
|
||||
QVERIFY(transient1ShellSurface);
|
||||
transient1ShellSurface->set_parent(parentShellSurface->object());
|
||||
Window *transient1 = Test::renderAndWaitForShown(transient1Surface.get(), QSize(128, 128), Qt::red);
|
||||
|
@ -227,7 +226,7 @@ void StackingOrderTest::testDeletedTransient()
|
|||
// Create the second transient.
|
||||
std::unique_ptr<KWayland::Client::Surface> transient2Surface = Test::createSurface();
|
||||
QVERIFY(transient2Surface);
|
||||
std::unique_ptr<Test::XdgToplevel> transient2ShellSurface(Test::createXdgToplevelSurface(transient2Surface.get(), transient2Surface.get()));
|
||||
std::unique_ptr<Test::XdgToplevel> transient2ShellSurface(Test::createXdgToplevelSurface(transient2Surface.get()));
|
||||
QVERIFY(transient2ShellSurface);
|
||||
transient2ShellSurface->set_parent(transient1ShellSurface->object());
|
||||
Window *transient2 = Test::renderAndWaitForShown(transient2Surface.get(), QSize(128, 128), Qt::red);
|
||||
|
@ -517,7 +516,7 @@ void StackingOrderTest::testRaiseGroupTransient()
|
|||
// Create a Wayland window that is not a member of the window group.
|
||||
std::unique_ptr<KWayland::Client::Surface> anotherSurface = Test::createSurface();
|
||||
QVERIFY(anotherSurface);
|
||||
std::unique_ptr<Test::XdgToplevel> anotherShellSurface(Test::createXdgToplevelSurface(anotherSurface.get(), anotherSurface.get()));
|
||||
std::unique_ptr<Test::XdgToplevel> anotherShellSurface(Test::createXdgToplevelSurface(anotherSurface.get()));
|
||||
QVERIFY(anotherShellSurface);
|
||||
Window *anotherWindow = Test::renderAndWaitForShown(anotherSurface.get(), QSize(128, 128), Qt::green);
|
||||
QVERIFY(anotherWindow);
|
||||
|
@ -759,7 +758,7 @@ void StackingOrderTest::testKeepAbove()
|
|||
// Create the first window.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface1 = Test::createSurface();
|
||||
QVERIFY(surface1);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.get(), surface1.get()));
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.get()));
|
||||
QVERIFY(shellSurface1);
|
||||
Window *window1 = Test::renderAndWaitForShown(surface1.get(), QSize(128, 128), Qt::green);
|
||||
QVERIFY(window1);
|
||||
|
@ -771,7 +770,7 @@ void StackingOrderTest::testKeepAbove()
|
|||
// Create the second window.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface2 = Test::createSurface();
|
||||
QVERIFY(surface2);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.get(), surface2.get()));
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.get()));
|
||||
QVERIFY(shellSurface2);
|
||||
Window *window2 = Test::renderAndWaitForShown(surface2.get(), QSize(128, 128), Qt::green);
|
||||
QVERIFY(window2);
|
||||
|
@ -803,7 +802,7 @@ void StackingOrderTest::testKeepBelow()
|
|||
// Create the first window.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface1 = Test::createSurface();
|
||||
QVERIFY(surface1);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.get(), surface1.get()));
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.get()));
|
||||
QVERIFY(shellSurface1);
|
||||
Window *window1 = Test::renderAndWaitForShown(surface1.get(), QSize(128, 128), Qt::green);
|
||||
QVERIFY(window1);
|
||||
|
@ -815,7 +814,7 @@ void StackingOrderTest::testKeepBelow()
|
|||
// Create the second window.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface2 = Test::createSurface();
|
||||
QVERIFY(surface2);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.get(), surface2.get()));
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.get()));
|
||||
QVERIFY(shellSurface2);
|
||||
Window *window2 = Test::renderAndWaitForShown(surface2.get(), QSize(128, 128), Qt::green);
|
||||
QVERIFY(window2);
|
||||
|
@ -850,7 +849,7 @@ void StackingOrderTest::testPreserveRelativeWindowStacking()
|
|||
for (int i = 0; i < windowsQuantity; i++) {
|
||||
surfaces[i] = Test::createSurface();
|
||||
QVERIFY(surfaces[i]);
|
||||
shellSurfaces[i] = std::unique_ptr<Test::XdgToplevel>(Test::createXdgToplevelSurface(surfaces[i].get(), surfaces[i].get()));
|
||||
shellSurfaces[i] = Test::createXdgToplevelSurface(surfaces[i].get());
|
||||
QVERIFY(shellSurfaces[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -984,12 +984,12 @@ static void waitForConfigured(XdgSurface *shellSurface)
|
|||
shellSurface->ack_configure(surfaceConfigureRequestedSpy.last().first().toUInt());
|
||||
}
|
||||
|
||||
XdgToplevel *createXdgToplevelSurface(KWayland::Client::Surface *surface, QObject *parent)
|
||||
std::unique_ptr<XdgToplevel> createXdgToplevelSurface(KWayland::Client::Surface *surface)
|
||||
{
|
||||
return createXdgToplevelSurface(surface, CreationSetup::CreateAndConfigure, parent);
|
||||
return createXdgToplevelSurface(surface, CreationSetup::CreateAndConfigure);
|
||||
}
|
||||
|
||||
XdgToplevel *createXdgToplevelSurface(KWayland::Client::Surface *surface, CreationSetup configureMode, QObject *parent)
|
||||
std::unique_ptr<XdgToplevel> createXdgToplevelSurface(KWayland::Client::Surface *surface, CreationSetup configureMode)
|
||||
{
|
||||
XdgShell *shell = s_waylandConnection.xdgShell;
|
||||
|
||||
|
@ -999,7 +999,7 @@ XdgToplevel *createXdgToplevelSurface(KWayland::Client::Surface *surface, Creati
|
|||
}
|
||||
|
||||
XdgSurface *xdgSurface = new XdgSurface(shell, surface);
|
||||
XdgToplevel *xdgToplevel = new XdgToplevel(xdgSurface, parent);
|
||||
std::unique_ptr<XdgToplevel> xdgToplevel = std::make_unique<XdgToplevel>(xdgSurface);
|
||||
|
||||
if (configureMode == CreationSetup::CreateAndConfigure) {
|
||||
waitForConfigured(xdgSurface);
|
||||
|
@ -1008,7 +1008,7 @@ XdgToplevel *createXdgToplevelSurface(KWayland::Client::Surface *surface, Creati
|
|||
return xdgToplevel;
|
||||
}
|
||||
|
||||
XdgPositioner *createXdgPositioner()
|
||||
std::unique_ptr<XdgPositioner> createXdgPositioner()
|
||||
{
|
||||
XdgShell *shell = s_waylandConnection.xdgShell;
|
||||
|
||||
|
@ -1017,11 +1017,10 @@ XdgPositioner *createXdgPositioner()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return new XdgPositioner(shell);
|
||||
return std::make_unique<XdgPositioner>(shell);
|
||||
}
|
||||
|
||||
XdgPopup *createXdgPopupSurface(KWayland::Client::Surface *surface, XdgSurface *parentSurface, XdgPositioner *positioner,
|
||||
CreationSetup configureMode, QObject *parent)
|
||||
std::unique_ptr<XdgPopup> createXdgPopupSurface(KWayland::Client::Surface *surface, XdgSurface *parentSurface, XdgPositioner *positioner, CreationSetup configureMode)
|
||||
{
|
||||
XdgShell *shell = s_waylandConnection.xdgShell;
|
||||
|
||||
|
@ -1031,7 +1030,7 @@ XdgPopup *createXdgPopupSurface(KWayland::Client::Surface *surface, XdgSurface *
|
|||
}
|
||||
|
||||
XdgSurface *xdgSurface = new XdgSurface(shell, surface);
|
||||
XdgPopup *xdgPopup = new XdgPopup(xdgSurface, parentSurface, positioner, parent);
|
||||
std::unique_ptr<XdgPopup> xdgPopup = std::make_unique<XdgPopup>(xdgSurface, parentSurface, positioner);
|
||||
|
||||
if (configureMode == CreationSetup::CreateAndConfigure) {
|
||||
waitForConfigured(xdgSurface);
|
||||
|
|
|
@ -46,7 +46,13 @@ private Q_SLOTS:
|
|||
void testGestureDetection();
|
||||
|
||||
private:
|
||||
std::pair<Window *, std::unique_ptr<KWayland::Client::Surface>> showWindow(bool decorated = false);
|
||||
struct WindowHandle
|
||||
{
|
||||
Window *window;
|
||||
std::unique_ptr<KWayland::Client::Surface> surface;
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface;
|
||||
};
|
||||
WindowHandle showWindow(bool decorated = false);
|
||||
KWayland::Client::Touch *m_touch = nullptr;
|
||||
};
|
||||
|
||||
|
@ -87,7 +93,7 @@ void TouchInputTest::cleanup()
|
|||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
std::pair<Window *, std::unique_ptr<KWayland::Client::Surface>> TouchInputTest::showWindow(bool decorated)
|
||||
TouchInputTest::WindowHandle TouchInputTest::showWindow(bool decorated)
|
||||
{
|
||||
#define VERIFY(statement) \
|
||||
if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__)) \
|
||||
|
@ -98,10 +104,10 @@ std::pair<Window *, std::unique_ptr<KWayland::Client::Surface>> TouchInputTest::
|
|||
|
||||
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);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get(), Test::CreationSetup::CreateOnly);
|
||||
VERIFY(shellSurface.get());
|
||||
if (decorated) {
|
||||
auto decoration = Test::createXdgToplevelDecorationV1(shellSurface, shellSurface);
|
||||
auto decoration = Test::createXdgToplevelDecorationV1(shellSurface.get(), shellSurface.get());
|
||||
decoration->set_mode(Test::XdgToplevelDecorationV1::mode_server_side);
|
||||
}
|
||||
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
|
||||
|
@ -117,7 +123,7 @@ std::pair<Window *, std::unique_ptr<KWayland::Client::Surface>> TouchInputTest::
|
|||
#undef VERIFY
|
||||
#undef COMPARE
|
||||
|
||||
return {window, std::move(surface)};
|
||||
return {window, std::move(surface), std::move(shellSurface)};
|
||||
}
|
||||
|
||||
void TouchInputTest::testTouchHidesCursor()
|
||||
|
@ -155,7 +161,7 @@ void TouchInputTest::testMultipleTouchPoints_data()
|
|||
void TouchInputTest::testMultipleTouchPoints()
|
||||
{
|
||||
QFETCH(bool, decorated);
|
||||
auto [window, surface] = showWindow(decorated);
|
||||
auto [window, surface, shellSurface] = showWindow(decorated);
|
||||
QCOMPARE(window->isDecorated(), decorated);
|
||||
window->move(QPoint(100, 100));
|
||||
QVERIFY(window);
|
||||
|
@ -210,7 +216,7 @@ void TouchInputTest::testMultipleTouchPoints()
|
|||
|
||||
void TouchInputTest::testCancel()
|
||||
{
|
||||
auto [window, surface] = showWindow();
|
||||
auto [window, surface, shellSurface] = showWindow();
|
||||
window->move(QPoint(100, 100));
|
||||
QVERIFY(window);
|
||||
QSignalSpy sequenceStartedSpy(m_touch, &KWayland::Client::Touch::sequenceStarted);
|
||||
|
@ -233,9 +239,9 @@ void TouchInputTest::testTouchMouseAction()
|
|||
// this test verifies that a touch down on an inactive window will activate it
|
||||
|
||||
// create two windows
|
||||
auto [c1, surface] = showWindow();
|
||||
auto [c1, surface, shellSurface] = showWindow();
|
||||
QVERIFY(c1);
|
||||
auto [c2, surface2] = showWindow();
|
||||
auto [c2, surface2, shellSurface2] = showWindow();
|
||||
QVERIFY(c2);
|
||||
|
||||
QVERIFY(!c1->isActive());
|
||||
|
|
|
@ -423,7 +423,7 @@ void TransientPlacementTest::testXdgPopup()
|
|||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
auto parentShellSurface = Test::createXdgToplevelSurface(surface.get(), Test::waylandCompositor());
|
||||
std::unique_ptr<Test::XdgToplevel> parentShellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(parentShellSurface);
|
||||
auto parent = Test::renderAndWaitForShown(surface.get(), parentSize, Qt::blue);
|
||||
QVERIFY(parent);
|
||||
|
@ -522,7 +522,7 @@ void TransientPlacementTest::testXdgPopupWithPanel()
|
|||
QVERIFY(Test::waitForWindowClosed(transient));
|
||||
|
||||
// now parent to fullscreen - on fullscreen the panel is ignored
|
||||
QSignalSpy toplevelConfigureRequestedSpy(parentShellSurface, &Test::XdgToplevel::configureRequested);
|
||||
QSignalSpy toplevelConfigureRequestedSpy(parentShellSurface.get(), &Test::XdgToplevel::configureRequested);
|
||||
QSignalSpy surfaceConfigureRequestedSpy(parentShellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
|
||||
parent->setFullScreen(true);
|
||||
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
||||
|
@ -542,7 +542,7 @@ void TransientPlacementTest::testXdgPopupWithPanel()
|
|||
positioner2->set_size(200, 200);
|
||||
positioner2->set_anchor_rect(anchorRect2.x(), anchorRect2.y(), anchorRect2.width(), anchorRect2.height());
|
||||
positioner2->set_constraint_adjustment(Test::XdgPositioner::constraint_adjustment_slide_x | Test::XdgPositioner::constraint_adjustment_slide_y);
|
||||
transientShellSurface.reset(Test::createXdgPopupSurface(transientSurface.get(), parentShellSurface->xdgSurface(), positioner2.get()));
|
||||
transientShellSurface = Test::createXdgPopupSurface(transientSurface.get(), parentShellSurface->xdgSurface(), positioner2.get());
|
||||
transient = Test::renderAndWaitForShown(transientSurface.get(), QSize(200, 200), Qt::red);
|
||||
QVERIFY(transient);
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ void TestXdgShellWindowRules::createTestWindow(ClientFlags flags)
|
|||
: Test::XdgToplevelDecorationV1::mode_client_side;
|
||||
// Create an xdg surface.
|
||||
m_surface = Test::createSurface();
|
||||
m_shellSurface.reset(Test::createXdgToplevelSurface(m_surface.get(), Test::CreationSetup::CreateOnly, m_surface.get()));
|
||||
m_shellSurface = Test::createXdgToplevelSurface(m_surface.get(), Test::CreationSetup::CreateOnly);
|
||||
Test::XdgToplevelDecorationV1 *decoration = Test::createXdgToplevelDecorationV1(m_shellSurface.get(), m_shellSurface.get());
|
||||
|
||||
// Add signal watchers
|
||||
|
|
Loading…
Reference in a new issue