autotests: Remove XdgShellSurfaceType enum

Currently, it has only one item - XdgShellStable.
icc-effect-master
Vlad Zahorodnii 2020-09-09 12:54:44 +03:00
parent 81a9b824cf
commit 3805f212ec
17 changed files with 237 additions and 878 deletions

View File

@ -47,7 +47,6 @@ private Q_SLOTS:
void cleanup(); void cleanup();
void testGetWindowInfoInvalidUuid(); void testGetWindowInfoInvalidUuid();
void testGetWindowInfoXdgShellClient_data();
void testGetWindowInfoXdgShellClient(); void testGetWindowInfoXdgShellClient();
void testGetWindowInfoX11Client(); void testGetWindowInfoX11Client();
}; };
@ -97,21 +96,13 @@ void TestDbusInterface::testGetWindowInfoInvalidUuid()
QVERIFY(windowData.empty()); QVERIFY(windowData.empty());
} }
void TestDbusInterface::testGetWindowInfoXdgShellClient_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestDbusInterface::testGetWindowInfoXdgShellClient() void TestDbusInterface::testGetWindowInfoXdgShellClient()
{ {
QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded);
QVERIFY(clientAddedSpy.isValid()); QVERIFY(clientAddedSpy.isValid());
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
shellSurface->setAppId(QByteArrayLiteral("org.kde.foo")); shellSurface->setAppId(QByteArrayLiteral("org.kde.foo"));
shellSurface->setTitle(QStringLiteral("Test window")); shellSurface->setTitle(QStringLiteral("Test window"));

View File

@ -39,7 +39,6 @@ private Q_SLOTS:
void topLevelTest(); void topLevelTest();
void testX11Client(); void testX11Client();
void testX11Unmanaged(); void testX11Unmanaged();
void testWaylandClient_data();
void testWaylandClient(); void testWaylandClient();
void testInternalWindow(); void testInternalWindow();
void testClosingDebugConsole(); void testClosingDebugConsole();
@ -284,13 +283,6 @@ void DebugConsoleTest::testX11Unmanaged()
QVERIFY(!model2.hasChildren(model2.index(1, 0, QModelIndex()))); QVERIFY(!model2.hasChildren(model2.index(1, 0, QModelIndex())));
} }
void DebugConsoleTest::testWaylandClient_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void DebugConsoleTest::testWaylandClient() void DebugConsoleTest::testWaylandClient()
{ {
DebugConsoleModel model; DebugConsoleModel model;
@ -317,8 +309,7 @@ void DebugConsoleTest::testWaylandClient()
using namespace KWayland::Client; using namespace KWayland::Client;
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QVERIFY(surface->isValid()); QVERIFY(surface->isValid());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
QVERIFY(!shellSurface.isNull()); QVERIFY(!shellSurface.isNull());
Test::render(surface.data(), QSize(10, 10), Qt::red); Test::render(surface.data(), QSize(10, 10), Qt::red);

View File

@ -57,7 +57,6 @@ private Q_SLOTS:
void testDoubleClick(); void testDoubleClick();
void testDoubleTap_data(); void testDoubleTap_data();
void testDoubleTap(); void testDoubleTap();
void testHover_data();
void testHover(); void testHover();
void testPressToMove_data(); void testPressToMove_data();
void testPressToMove(); void testPressToMove();
@ -69,13 +68,11 @@ private Q_SLOTS:
void testModifierClickUnrestrictedMove(); void testModifierClickUnrestrictedMove();
void testModifierScrollOpacity_data(); void testModifierScrollOpacity_data();
void testModifierScrollOpacity(); void testModifierScrollOpacity();
void testTouchEvents_data();
void testTouchEvents(); void testTouchEvents();
void testTooltipDoesntEatKeyEvents_data();
void testTooltipDoesntEatKeyEvents(); void testTooltipDoesntEatKeyEvents();
private: private:
AbstractClient *showWindow(Test::XdgShellSurfaceType type); AbstractClient *showWindow();
}; };
#define MOTION(target) \ #define MOTION(target) \
@ -87,7 +84,7 @@ private:
#define RELEASE \ #define RELEASE \
kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++) kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++)
AbstractClient *DecorationInputTest::showWindow(Test::XdgShellSurfaceType type) AbstractClient *DecorationInputTest::showWindow()
{ {
using namespace KWayland::Client; using namespace KWayland::Client;
#define VERIFY(statement) \ #define VERIFY(statement) \
@ -99,7 +96,7 @@ AbstractClient *DecorationInputTest::showWindow(Test::XdgShellSurfaceType type)
Surface *surface = Test::createSurface(Test::waylandCompositor()); Surface *surface = Test::createSurface(Test::waylandCompositor());
VERIFY(surface); VERIFY(surface);
XdgShellSurface *shellSurface = Test::createXdgShellSurface(type, surface, surface); XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface);
VERIFY(shellSurface); VERIFY(shellSurface);
auto deco = Test::waylandServerSideDecoration()->create(surface, surface); auto deco = Test::waylandServerSideDecoration()->create(surface, surface);
QSignalSpy decoSpy(deco, &ServerSideDecoration::modeChanged); QSignalSpy decoSpy(deco, &ServerSideDecoration::modeChanged);
@ -166,17 +163,15 @@ void DecorationInputTest::testAxis_data()
{ {
QTest::addColumn<QPoint>("decoPoint"); QTest::addColumn<QPoint>("decoPoint");
QTest::addColumn<Qt::WindowFrameSection>("expectedSection"); QTest::addColumn<Qt::WindowFrameSection>("expectedSection");
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("topLeft|xdgWmBase") << QPoint(0, 0) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("topLeft") << QPoint(0, 0) << Qt::TopLeftSection;
QTest::newRow("top|xdgWmBase") << QPoint(250, 0) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("top") << QPoint(250, 0) << Qt::TopSection;
QTest::newRow("topRight|xdgWmBase") << QPoint(499, 0) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("topRight") << QPoint(499, 0) << Qt::TopRightSection;
} }
void DecorationInputTest::testAxis() void DecorationInputTest::testAxis()
{ {
QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow();
AbstractClient *c = showWindow(type);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->isDecorated()); QVERIFY(c->isDecorated());
QVERIFY(!c->noBorder()); QVERIFY(!c->noBorder());
@ -217,17 +212,15 @@ void DecorationInputTest::testDoubleClick_data()
{ {
QTest::addColumn<QPoint>("decoPoint"); QTest::addColumn<QPoint>("decoPoint");
QTest::addColumn<Qt::WindowFrameSection>("expectedSection"); QTest::addColumn<Qt::WindowFrameSection>("expectedSection");
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("topLeft|xdgWmBase") << QPoint(0, 0) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("topLeft") << QPoint(0, 0) << Qt::TopLeftSection;
QTest::newRow("top|xdgWmBase") << QPoint(250, 0) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("top") << QPoint(250, 0) << Qt::TopSection;
QTest::newRow("topRight|xdgWmBase") << QPoint(499, 0) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("topRight") << QPoint(499, 0) << Qt::TopRightSection;
} }
void KWin::DecorationInputTest::testDoubleClick() void KWin::DecorationInputTest::testDoubleClick()
{ {
QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow();
AbstractClient *c = showWindow(type);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->isDecorated()); QVERIFY(c->isDecorated());
QVERIFY(!c->noBorder()); QVERIFY(!c->noBorder());
@ -269,17 +262,15 @@ void DecorationInputTest::testDoubleTap_data()
{ {
QTest::addColumn<QPoint>("decoPoint"); QTest::addColumn<QPoint>("decoPoint");
QTest::addColumn<Qt::WindowFrameSection>("expectedSection"); QTest::addColumn<Qt::WindowFrameSection>("expectedSection");
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("topLeft|xdgWmBase") << QPoint(10, 10) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("topLeft") << QPoint(10, 10) << Qt::TopLeftSection;
QTest::newRow("top|xdgWmBase") << QPoint(260, 10) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("top") << QPoint(260, 10) << Qt::TopSection;
QTest::newRow("topRight|xdgWmBase") << QPoint(509, 10) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("topRight") << QPoint(509, 10) << Qt::TopRightSection;
} }
void KWin::DecorationInputTest::testDoubleTap() void KWin::DecorationInputTest::testDoubleTap()
{ {
QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow();
AbstractClient *c = showWindow(type);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->isDecorated()); QVERIFY(c->isDecorated());
QVERIFY(!c->noBorder()); QVERIFY(!c->noBorder());
@ -319,17 +310,9 @@ void KWin::DecorationInputTest::testDoubleTap()
QVERIFY(c->isOnAllDesktops()); QVERIFY(c->isOnAllDesktops());
} }
void DecorationInputTest::testHover_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void DecorationInputTest::testHover() void DecorationInputTest::testHover()
{ {
QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow();
AbstractClient *c = showWindow(type);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->isDecorated()); QVERIFY(c->isDecorated());
QVERIFY(!c->noBorder()); QVERIFY(!c->noBorder());
@ -379,18 +362,16 @@ void DecorationInputTest::testPressToMove_data()
QTest::addColumn<QPoint>("offset"); QTest::addColumn<QPoint>("offset");
QTest::addColumn<QPoint>("offset2"); QTest::addColumn<QPoint>("offset2");
QTest::addColumn<QPoint>("offset3"); QTest::addColumn<QPoint>("offset3");
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("To right|xdgWmBase") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("To right") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0);
QTest::newRow("To left|xdgWmBase") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("To left") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0);
QTest::newRow("To bottom|xdgWmBase") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("To bottom") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30);
QTest::newRow("To top|xdgWmBase") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("To top") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30);
} }
void DecorationInputTest::testPressToMove() void DecorationInputTest::testPressToMove()
{ {
QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow();
AbstractClient *c = showWindow(type);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->isDecorated()); QVERIFY(c->isDecorated());
QVERIFY(!c->noBorder()); QVERIFY(!c->noBorder());
@ -440,18 +421,16 @@ void DecorationInputTest::testTapToMove_data()
QTest::addColumn<QPoint>("offset"); QTest::addColumn<QPoint>("offset");
QTest::addColumn<QPoint>("offset2"); QTest::addColumn<QPoint>("offset2");
QTest::addColumn<QPoint>("offset3"); QTest::addColumn<QPoint>("offset3");
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("To right|xdgWmBase") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("To right") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0);
QTest::newRow("To left|xdgWmBase") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("To left") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0);
QTest::newRow("To bottom|xdgWmBase") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("To bottom") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30);
QTest::newRow("To top|xdgWmBase") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::XdgShellSurfaceType::XdgShellStable; QTest::newRow("To top") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30);
} }
void DecorationInputTest::testTapToMove() void DecorationInputTest::testTapToMove()
{ {
QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow();
AbstractClient *c = showWindow(type);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->isDecorated()); QVERIFY(c->isDecorated());
QVERIFY(!c->noBorder()); QVERIFY(!c->noBorder());
@ -499,13 +478,12 @@ void DecorationInputTest::testTapToMove()
void DecorationInputTest::testResizeOutsideWindow_data() void DecorationInputTest::testResizeOutsideWindow_data()
{ {
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::addColumn<Qt::Edge>("edge"); QTest::addColumn<Qt::Edge>("edge");
QTest::addColumn<Qt::CursorShape>("expectedCursor"); QTest::addColumn<Qt::CursorShape>("expectedCursor");
QTest::newRow("xdgWmBase - left") << Test::XdgShellSurfaceType::XdgShellStable << Qt::LeftEdge << Qt::SizeHorCursor; QTest::newRow("left") << Qt::LeftEdge << Qt::SizeHorCursor;
QTest::newRow("xdgWmBase - right") << Test::XdgShellSurfaceType::XdgShellStable << Qt::RightEdge << Qt::SizeHorCursor; QTest::newRow("right") << Qt::RightEdge << Qt::SizeHorCursor;
QTest::newRow("xdgWmBase - bottom") << Test::XdgShellSurfaceType::XdgShellStable << Qt::BottomEdge << Qt::SizeVerCursor; QTest::newRow("bottom") << Qt::BottomEdge << Qt::SizeVerCursor;
} }
void DecorationInputTest::testResizeOutsideWindow() void DecorationInputTest::testResizeOutsideWindow()
@ -518,8 +496,7 @@ void DecorationInputTest::testResizeOutsideWindow()
workspace()->slotReconfigure(); workspace()->slotReconfigure();
// now create window // now create window
QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow();
AbstractClient *c = showWindow(type);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->isDecorated()); QVERIFY(c->isDecorated());
QVERIFY(!c->noBorder()); QVERIFY(!c->noBorder());
@ -563,45 +540,38 @@ void DecorationInputTest::testModifierClickUnrestrictedMove_data()
QTest::addColumn<int>("mouseButton"); QTest::addColumn<int>("mouseButton");
QTest::addColumn<QString>("modKey"); QTest::addColumn<QString>("modKey");
QTest::addColumn<bool>("capsLock"); QTest::addColumn<bool>("capsLock");
QTest::addColumn<Test::XdgShellSurfaceType>("surfaceType");
const QString alt = QStringLiteral("Alt"); const QString alt = QStringLiteral("Alt");
const QString meta = QStringLiteral("Meta"); const QString meta = QStringLiteral("Meta");
const QVector<std::pair<Test::XdgShellSurfaceType, QByteArray>> surfaceTypes{ QTest::newRow("Left Alt + Left Click") << KEY_LEFTALT << BTN_LEFT << alt << false;
{ Test::XdgShellSurfaceType::XdgShellStable, QByteArrayLiteral("XdgWmBase") }, QTest::newRow("Left Alt + Right Click") << KEY_LEFTALT << BTN_RIGHT << alt << false;
}; QTest::newRow("Left Alt + Middle Click") << KEY_LEFTALT << BTN_MIDDLE << alt << false;
QTest::newRow("Right Alt + Left Click") << KEY_RIGHTALT << BTN_LEFT << alt << false;
QTest::newRow("Right Alt + Right Click") << KEY_RIGHTALT << BTN_RIGHT << alt << false;
QTest::newRow("Right Alt + Middle Click") << KEY_RIGHTALT << BTN_MIDDLE << alt << false;
// now everything with meta
QTest::newRow("Left Meta + Left Click") << KEY_LEFTMETA << BTN_LEFT << meta << false;
QTest::newRow("Left Meta + Right Click") << KEY_LEFTMETA << BTN_RIGHT << meta << false;
QTest::newRow("Left Meta + Middle Click") << KEY_LEFTMETA << BTN_MIDDLE << meta << false;
QTest::newRow("Right Meta + Left Click") << KEY_RIGHTMETA << BTN_LEFT << meta << false;
QTest::newRow("Right Meta + Right Click") << KEY_RIGHTMETA << BTN_RIGHT << meta << false;
QTest::newRow("Right Meta + Middle Click") << KEY_RIGHTMETA << BTN_MIDDLE << meta << false;
for (const auto &type : surfaceTypes) { // and with capslock
QTest::newRow("Left Alt + Left Click" + type.second) << KEY_LEFTALT << BTN_LEFT << alt << false << type.first; QTest::newRow("Left Alt + Left Click/CapsLock") << KEY_LEFTALT << BTN_LEFT << alt << true;
QTest::newRow("Left Alt + Right Click" + type.second) << KEY_LEFTALT << BTN_RIGHT << alt << false << type.first; QTest::newRow("Left Alt + Right Click/CapsLock") << KEY_LEFTALT << BTN_RIGHT << alt << true;
QTest::newRow("Left Alt + Middle Click" + type.second) << KEY_LEFTALT << BTN_MIDDLE << alt << false << type.first; QTest::newRow("Left Alt + Middle Click/CapsLock") << KEY_LEFTALT << BTN_MIDDLE << alt << true;
QTest::newRow("Right Alt + Left Click" + type.second) << KEY_RIGHTALT << BTN_LEFT << alt << false << type.first; QTest::newRow("Right Alt + Left Click/CapsLock") << KEY_RIGHTALT << BTN_LEFT << alt << true;
QTest::newRow("Right Alt + Right Click" + type.second) << KEY_RIGHTALT << BTN_RIGHT << alt << false << type.first; QTest::newRow("Right Alt + Right Click/CapsLock") << KEY_RIGHTALT << BTN_RIGHT << alt << true;
QTest::newRow("Right Alt + Middle Click" + type.second) << KEY_RIGHTALT << BTN_MIDDLE << alt << false << type.first; QTest::newRow("Right Alt + Middle Click/CapsLock") << KEY_RIGHTALT << BTN_MIDDLE << alt << true;
// now everything with meta // now everything with meta
QTest::newRow("Left Meta + Left Click" + type.second) << KEY_LEFTMETA << BTN_LEFT << meta << false << type.first; QTest::newRow("Left Meta + Left Click/CapsLock") << KEY_LEFTMETA << BTN_LEFT << meta << true;
QTest::newRow("Left Meta + Right Click" + type.second) << KEY_LEFTMETA << BTN_RIGHT << meta << false << type.first; QTest::newRow("Left Meta + Right Click/CapsLock") << KEY_LEFTMETA << BTN_RIGHT << meta << true;
QTest::newRow("Left Meta + Middle Click" + type.second) << KEY_LEFTMETA << BTN_MIDDLE << meta << false << type.first; QTest::newRow("Left Meta + Middle Click/CapsLock") << KEY_LEFTMETA << BTN_MIDDLE << meta << true;
QTest::newRow("Right Meta + Left Click" + type.second) << KEY_RIGHTMETA << BTN_LEFT << meta << false << type.first; QTest::newRow("Right Meta + Left Click/CapsLock") << KEY_RIGHTMETA << BTN_LEFT << meta << true;
QTest::newRow("Right Meta + Right Click" + type.second) << KEY_RIGHTMETA << BTN_RIGHT << meta << false << type.first; QTest::newRow("Right Meta + Right Click/CapsLock") << KEY_RIGHTMETA << BTN_RIGHT << meta << true;
QTest::newRow("Right Meta + Middle Click" + type.second) << KEY_RIGHTMETA << BTN_MIDDLE << meta << false << type.first; QTest::newRow("Right Meta + Middle Click/CapsLock") << KEY_RIGHTMETA << BTN_MIDDLE << meta << true;
// and with capslock
QTest::newRow("Left Alt + Left Click/CapsLock" + type.second) << KEY_LEFTALT << BTN_LEFT << alt << true << type.first;
QTest::newRow("Left Alt + Right Click/CapsLock" + type.second) << KEY_LEFTALT << BTN_RIGHT << alt << true << type.first;
QTest::newRow("Left Alt + Middle Click/CapsLock" + type.second) << KEY_LEFTALT << BTN_MIDDLE << alt << true << type.first;
QTest::newRow("Right Alt + Left Click/CapsLock" + type.second) << KEY_RIGHTALT << BTN_LEFT << alt << true << type.first;
QTest::newRow("Right Alt + Right Click/CapsLock" + type.second) << KEY_RIGHTALT << BTN_RIGHT << alt << true << type.first;
QTest::newRow("Right Alt + Middle Click/CapsLock" + type.second) << KEY_RIGHTALT << BTN_MIDDLE << alt << true << type.first;
// now everything with meta
QTest::newRow("Left Meta + Left Click/CapsLock" + type.second) << KEY_LEFTMETA << BTN_LEFT << meta << true << type.first;
QTest::newRow("Left Meta + Right Click/CapsLock" + type.second) << KEY_LEFTMETA << BTN_RIGHT << meta << true << type.first;
QTest::newRow("Left Meta + Middle Click/CapsLock" + type.second) << KEY_LEFTMETA << BTN_MIDDLE << meta << true << type.first;
QTest::newRow("Right Meta + Left Click/CapsLock" + type.second) << KEY_RIGHTMETA << BTN_LEFT << meta << true << type.first;
QTest::newRow("Right Meta + Right Click/CapsLock" + type.second) << KEY_RIGHTMETA << BTN_RIGHT << meta << true << type.first;
QTest::newRow("Right Meta + Middle Click/CapsLock" + type.second) << KEY_RIGHTMETA << BTN_MIDDLE << meta << true << type.first;
}
} }
void DecorationInputTest::testModifierClickUnrestrictedMove() void DecorationInputTest::testModifierClickUnrestrictedMove()
@ -623,8 +593,7 @@ void DecorationInputTest::testModifierClickUnrestrictedMove()
QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove);
// create a window // create a window
QFETCH(Test::XdgShellSurfaceType, surfaceType); AbstractClient *c = showWindow();
AbstractClient *c = showWindow(surfaceType);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->isDecorated()); QVERIFY(c->isDecorated());
QVERIFY(!c->noBorder()); QVERIFY(!c->noBorder());
@ -660,25 +629,18 @@ void DecorationInputTest::testModifierScrollOpacity_data()
QTest::addColumn<int>("modifierKey"); QTest::addColumn<int>("modifierKey");
QTest::addColumn<QString>("modKey"); QTest::addColumn<QString>("modKey");
QTest::addColumn<bool>("capsLock"); QTest::addColumn<bool>("capsLock");
QTest::addColumn<Test::XdgShellSurfaceType>("surfaceType");
const QString alt = QStringLiteral("Alt"); const QString alt = QStringLiteral("Alt");
const QString meta = QStringLiteral("Meta"); const QString meta = QStringLiteral("Meta");
const QVector<std::pair<Test::XdgShellSurfaceType, QByteArray>> surfaceTypes{ QTest::newRow("Left Alt") << KEY_LEFTALT << alt << false;
{ Test::XdgShellSurfaceType::XdgShellStable, QByteArrayLiteral("XdgWmBase") }, QTest::newRow("Right Alt") << KEY_RIGHTALT << alt << false;
}; QTest::newRow("Left Meta") << KEY_LEFTMETA << meta << false;
QTest::newRow("Right Meta") << KEY_RIGHTMETA << meta << false;
for (const auto &type : surfaceTypes) { QTest::newRow("Left Alt/CapsLock") << KEY_LEFTALT << alt << true;
QTest::newRow("Left Alt" + type.second) << KEY_LEFTALT << alt << false << type.first; QTest::newRow("Right Alt/CapsLock") << KEY_RIGHTALT << alt << true;
QTest::newRow("Right Alt" + type.second) << KEY_RIGHTALT << alt << false << type.first; QTest::newRow("Left Meta/CapsLock") << KEY_LEFTMETA << meta << true;
QTest::newRow("Left Meta" + type.second) << KEY_LEFTMETA << meta << false << type.first; QTest::newRow("Right Meta/CapsLock") << KEY_RIGHTMETA << meta << true;
QTest::newRow("Right Meta" + type.second) << KEY_RIGHTMETA << meta << false << type.first;
QTest::newRow("Left Alt/CapsLock" + type.second) << KEY_LEFTALT << alt << true << type.first;
QTest::newRow("Right Alt/CapsLock" + type.second) << KEY_RIGHTALT << alt << true << type.first;
QTest::newRow("Left Meta/CapsLock" + type.second) << KEY_LEFTMETA << meta << true << type.first;
QTest::newRow("Right Meta/CapsLock" + type.second) << KEY_RIGHTMETA << meta << true << type.first;
}
} }
void DecorationInputTest::testModifierScrollOpacity() void DecorationInputTest::testModifierScrollOpacity()
@ -693,8 +655,7 @@ void DecorationInputTest::testModifierScrollOpacity()
group.sync(); group.sync();
workspace()->slotReconfigure(); workspace()->slotReconfigure();
QFETCH(Test::XdgShellSurfaceType, surfaceType); AbstractClient *c = showWindow();
AbstractClient *c = showWindow(surfaceType);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->isDecorated()); QVERIFY(c->isDecorated());
QVERIFY(!c->noBorder()); QVERIFY(!c->noBorder());
@ -723,13 +684,6 @@ void DecorationInputTest::testModifierScrollOpacity()
} }
} }
void DecorationInputTest::testTouchEvents_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
class EventHelper : public QObject class EventHelper : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -757,8 +711,7 @@ void DecorationInputTest::testTouchEvents()
{ {
// this test verifies that the decoration gets a hover leave event on touch release // this test verifies that the decoration gets a hover leave event on touch release
// see BUG 386231 // see BUG 386231
QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow();
AbstractClient *c = showWindow(type);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->isDecorated()); QVERIFY(c->isDecorated());
QVERIFY(!c->noBorder()); QVERIFY(!c->noBorder());
@ -796,13 +749,6 @@ void DecorationInputTest::testTouchEvents()
QCOMPARE(hoverLeaveSpy.count(), 2); QCOMPARE(hoverLeaveSpy.count(), 2);
} }
void DecorationInputTest::testTooltipDoesntEatKeyEvents_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void DecorationInputTest::testTooltipDoesntEatKeyEvents() void DecorationInputTest::testTooltipDoesntEatKeyEvents()
{ {
// this test verifies that a tooltip on the decoration does not steal key events // this test verifies that a tooltip on the decoration does not steal key events
@ -814,8 +760,7 @@ void DecorationInputTest::testTooltipDoesntEatKeyEvents()
QSignalSpy enteredSpy(keyboard, &KWayland::Client::Keyboard::entered); QSignalSpy enteredSpy(keyboard, &KWayland::Client::Keyboard::entered);
QVERIFY(enteredSpy.isValid()); QVERIFY(enteredSpy.isValid());
QFETCH(Test::XdgShellSurfaceType, type); AbstractClient *c = showWindow();
AbstractClient *c = showWindow(type);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->isDecorated()); QVERIFY(c->isDecorated());
QVERIFY(!c->noBorder()); QVERIFY(!c->noBorder());

View File

@ -36,7 +36,6 @@ private Q_SLOTS:
void init(); void init();
void initTestCase(); void initTestCase();
void cleanup(); void cleanup();
void testMoveCursorOverDeco_data();
void testMoveCursorOverDeco(); void testMoveCursorOverDeco();
}; };
@ -73,22 +72,14 @@ void DontCrashCursorPhysicalSizeEmpty::initTestCase()
QVERIFY(applicationStartedSpy.wait()); QVERIFY(applicationStartedSpy.wait());
} }
void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco() void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco()
{ {
// This test ensures that there is no endless recursion if the cursor theme cannot be created // 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 // a reason for creation failure could be physical size not existing
// see BUG: 390314 // see BUG: 390314
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type);
Test::waylandServerSideDecoration()->create(surface.data(), surface.data()); Test::waylandServerSideDecoration()->create(surface.data(), surface.data());
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(c); QVERIFY(c);

View File

@ -38,7 +38,6 @@ private Q_SLOTS:
void initTestCase(); void initTestCase();
void init(); void init();
void cleanup(); void cleanup();
void testCreateWindow_data();
void testCreateWindow(); void testCreateWindow();
}; };
@ -84,13 +83,6 @@ void DontCrashNoBorder::cleanup()
Test::destroyWaylandConnection(); Test::destroyWaylandConnection();
} }
void DontCrashNoBorder::testCreateWindow_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void DontCrashNoBorder::testCreateWindow() void DontCrashNoBorder::testCreateWindow()
{ {
// create a window and ensure that this doesn't crash // create a window and ensure that this doesn't crash
@ -98,8 +90,7 @@ void DontCrashNoBorder::testCreateWindow()
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull()); QVERIFY(!surface.isNull());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
QVERIFY(shellSurface); QVERIFY(shellSurface);
QScopedPointer<ServerSideDecoration> deco(Test::waylandServerSideDecoration()->create(surface.data())); QScopedPointer<ServerSideDecoration> deco(Test::waylandServerSideDecoration()->create(surface.data()));
QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged); QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged);

View File

@ -36,7 +36,6 @@ private Q_SLOTS:
void init(); void init();
void cleanup(); void cleanup();
void testMaximizeRestore_data();
void testMaximizeRestore(); void testMaximizeRestore();
}; };
@ -82,13 +81,6 @@ void MaximizeAnimationTest::cleanup()
Test::destroyWaylandConnection(); Test::destroyWaylandConnection();
} }
void MaximizeAnimationTest::testMaximizeRestore_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void MaximizeAnimationTest::testMaximizeRestore() void MaximizeAnimationTest::testMaximizeRestore()
{ {
// This test verifies that the maximize effect animates a client // This test verifies that the maximize effect animates a client
@ -100,8 +92,7 @@ void MaximizeAnimationTest::testMaximizeRestore()
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull()); QVERIFY(!surface.isNull());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly));
QScopedPointer<XdgShellSurface> shellSurface(createXdgShellSurface(type, surface.data(), nullptr, Test::CreationSetup::CreateOnly));
// Wait for the initial configure event. // Wait for the initial configure event.
XdgShellSurface::States states; XdgShellSurface::States states;

View File

@ -33,7 +33,6 @@ private Q_SLOTS:
void init(); void init();
void cleanup(); void cleanup();
void testInhibit_data();
void testInhibit(); void testInhibit();
void testDontInhibitWhenNotOnCurrentDesktop(); void testDontInhibitWhenNotOnCurrentDesktop();
void testDontInhibitWhenMinimized(); void testDontInhibitWhenMinimized();
@ -70,13 +69,6 @@ void TestIdleInhibition::cleanup()
QCOMPARE(VirtualDesktopManager::self()->count(), 1u); QCOMPARE(VirtualDesktopManager::self()->count(), 1u);
} }
void TestIdleInhibition::testInhibit_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestIdleInhibition::testInhibit() void TestIdleInhibition::testInhibit()
{ {
auto idle = waylandServer()->display()->findChild<IdleInterface*>(); auto idle = waylandServer()->display()->findChild<IdleInterface*>();
@ -87,8 +79,7 @@ void TestIdleInhibition::testInhibit()
// now create window // now create window
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
// now create inhibition on window // now create inhibition on window
QScopedPointer<IdleInhibitor> inhibitor(Test::waylandIdleInhibitManager()->createInhibitor(surface.data())); QScopedPointer<IdleInhibitor> inhibitor(Test::waylandIdleInhibitManager()->createInhibitor(surface.data()));

View File

@ -40,7 +40,6 @@ private Q_SLOTS:
void initTestCase(); void initTestCase();
void init(); void init();
void cleanup(); void cleanup();
void testPointerFocusUpdatesOnStackingOrderChange_data();
void testPointerFocusUpdatesOnStackingOrderChange(); void testPointerFocusUpdatesOnStackingOrderChange();
private: private:
@ -87,13 +86,6 @@ void InputStackingOrderTest::render(KWayland::Client::Surface *surface)
Test::flushWaylandConnection(); Test::flushWaylandConnection();
} }
void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange() void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange()
{ {
// this test creates two windows which overlap // this test creates two windows which overlap
@ -115,8 +107,7 @@ void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange()
QVERIFY(clientAddedSpy.isValid()); QVERIFY(clientAddedSpy.isValid());
Surface *surface1 = Test::createSurface(Test::waylandCompositor()); Surface *surface1 = Test::createSurface(Test::waylandCompositor());
QVERIFY(surface1); QVERIFY(surface1);
QFETCH(Test::XdgShellSurfaceType, type); XdgShellSurface *shellSurface1 = Test::createXdgShellStableSurface(surface1, surface1);
XdgShellSurface *shellSurface1 = Test::createXdgShellSurface(type, surface1, surface1);
QVERIFY(shellSurface1); QVERIFY(shellSurface1);
render(surface1); render(surface1);
QVERIFY(clientAddedSpy.wait()); QVERIFY(clientAddedSpy.wait());
@ -125,7 +116,7 @@ void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange()
Surface *surface2 = Test::createSurface(Test::waylandCompositor()); Surface *surface2 = Test::createSurface(Test::waylandCompositor());
QVERIFY(surface2); QVERIFY(surface2);
XdgShellSurface *shellSurface2 = Test::createXdgShellSurface(type, surface2, surface2); XdgShellSurface *shellSurface2 = Test::createXdgShellStableSurface(surface2, surface2);
QVERIFY(shellSurface2); QVERIFY(shellSurface2);
render(surface2); render(surface2);
QVERIFY(clientAddedSpy.wait()); QVERIFY(clientAddedSpy.wait());

View File

@ -171,10 +171,6 @@ LayerSurfaceV1 *createLayerSurfaceV1(KWayland::Client::Surface *surface,
KWayland::Client::Output *output = nullptr, KWayland::Client::Output *output = nullptr,
LayerShellV1::layer layer = LayerShellV1::layer_top); LayerShellV1::layer layer = LayerShellV1::layer_top);
enum class XdgShellSurfaceType {
XdgShellStable
};
enum class CreationSetup { enum class CreationSetup {
CreateOnly, CreateOnly,
CreateAndConfigure, /// commit and wait for the configure event, making this surface ready to commit buffers CreateAndConfigure, /// commit and wait for the configure event, making this surface ready to commit buffers
@ -183,11 +179,6 @@ enum class CreationSetup {
QtWayland::zwp_input_panel_surface_v1 *createInputPanelSurfaceV1(KWayland::Client::Surface *surface, QtWayland::zwp_input_panel_surface_v1 *createInputPanelSurfaceV1(KWayland::Client::Surface *surface,
KWayland::Client::Output *output); KWayland::Client::Output *output);
KWayland::Client::XdgShellSurface *createXdgShellSurface(XdgShellSurfaceType type,
KWayland::Client::Surface *surface,
QObject *parent = nullptr,
CreationSetup creationSetup = CreationSetup::CreateAndConfigure);
KWayland::Client::XdgShellSurface *createXdgShellStableSurface(KWayland::Client::Surface *surface, KWayland::Client::XdgShellSurface *createXdgShellStableSurface(KWayland::Client::Surface *surface,
QObject *parent = nullptr, QObject *parent = nullptr,
CreationSetup = CreationSetup::CreateAndConfigure); CreationSetup = CreationSetup::CreateAndConfigure);
@ -249,7 +240,6 @@ bool unlockScreen();
} }
Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::Test::AdditionalWaylandInterfaces) Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::Test::AdditionalWaylandInterfaces)
Q_DECLARE_METATYPE(KWin::Test::XdgShellSurfaceType)
#define WAYLANDTEST_MAIN_HELPER(TestObject, DPI, OperationMode) \ #define WAYLANDTEST_MAIN_HELPER(TestObject, DPI, OperationMode) \
int main(int argc, char *argv[]) \ int main(int argc, char *argv[]) \

View File

@ -55,7 +55,6 @@ private Q_SLOTS:
void testGrowShrink(); void testGrowShrink();
void testPointerMoveEnd_data(); void testPointerMoveEnd_data();
void testPointerMoveEnd(); void testPointerMoveEnd();
void testClientSideMove_data();
void testClientSideMove(); void testClientSideMove();
void testPlasmaShellSurfaceMovable_data(); void testPlasmaShellSurfaceMovable_data();
void testPlasmaShellSurfaceMovable(); void testPlasmaShellSurfaceMovable();
@ -534,13 +533,6 @@ void MoveResizeWindowTest::testPointerMoveEnd()
surface.reset(); surface.reset();
QVERIFY(Test::waitForWindowDestroyed(c)); QVERIFY(Test::waitForWindowDestroyed(c));
} }
void MoveResizeWindowTest::testClientSideMove_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void MoveResizeWindowTest::testClientSideMove() void MoveResizeWindowTest::testClientSideMove()
{ {
using namespace KWayland::Client; using namespace KWayland::Client;
@ -554,8 +546,7 @@ void MoveResizeWindowTest::testClientSideMove()
QVERIFY(buttonSpy.isValid()); QVERIFY(buttonSpy.isValid());
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(c); QVERIFY(c);

View File

@ -45,7 +45,6 @@ private Q_SLOTS:
void testPanelWindowsCanCover_data(); void testPanelWindowsCanCover_data();
void testPanelWindowsCanCover(); void testPanelWindowsCanCover();
void testOSDPlacement(); void testOSDPlacement();
void testOSDPlacementManualPosition_data();
void testOSDPlacementManualPosition(); void testOSDPlacementManualPosition();
void testPanelTypeHasStrut_data(); void testPanelTypeHasStrut_data();
void testPanelTypeHasStrut(); void testPanelTypeHasStrut();
@ -237,13 +236,6 @@ void PlasmaSurfaceTest::testOSDPlacement()
QCOMPARE(c->frameGeometry(), QRect(1280 / 2 - 200 / 2, 2 * 1024 / 3 - 100 / 2, 200, 100)); QCOMPARE(c->frameGeometry(), QRect(1280 / 2 - 200 / 2, 2 * 1024 / 3 - 100 / 2, 200, 100));
} }
void PlasmaSurfaceTest::testOSDPlacementManualPosition_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void PlasmaSurfaceTest::testOSDPlacementManualPosition() void PlasmaSurfaceTest::testOSDPlacementManualPosition()
{ {
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
@ -254,8 +246,7 @@ void PlasmaSurfaceTest::testOSDPlacementManualPosition()
plasmaSurface->setPosition(QPoint(50, 70)); plasmaSurface->setPosition(QPoint(50, 70));
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
QVERIFY(!shellSurface.isNull()); QVERIFY(!shellSurface.isNull());
// now render and map the window // now render and map the window
@ -271,24 +262,22 @@ void PlasmaSurfaceTest::testOSDPlacementManualPosition()
void PlasmaSurfaceTest::testPanelTypeHasStrut_data() void PlasmaSurfaceTest::testPanelTypeHasStrut_data()
{ {
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::addColumn<PlasmaShellSurface::PanelBehavior>("panelBehavior"); QTest::addColumn<PlasmaShellSurface::PanelBehavior>("panelBehavior");
QTest::addColumn<bool>("expectedStrut"); QTest::addColumn<bool>("expectedStrut");
QTest::addColumn<QRect>("expectedMaxArea"); QTest::addColumn<QRect>("expectedMaxArea");
QTest::addColumn<KWin::Layer>("expectedLayer"); QTest::addColumn<KWin::Layer>("expectedLayer");
QTest::newRow("always visible - xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; QTest::newRow("always visible - xdgWmBase") << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer;
QTest::newRow("autohide - xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; QTest::newRow("autohide - xdgWmBase") << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer;
QTest::newRow("windows can cover - xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; QTest::newRow("windows can cover - xdgWmBase") << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer;
QTest::newRow("windows go below - xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; QTest::newRow("windows go below - xdgWmBase") << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer;
} }
void PlasmaSurfaceTest::testPanelTypeHasStrut() void PlasmaSurfaceTest::testPanelTypeHasStrut()
{ {
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull()); QVERIFY(!surface.isNull());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<QObject> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<QObject> shellSurface(Test::createXdgShellSurface(type, surface.data()));
QVERIFY(!shellSurface.isNull()); QVERIFY(!shellSurface.isNull());
QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data()));
QVERIFY(!plasmaSurface.isNull()); QVERIFY(!plasmaSurface.isNull());

View File

@ -49,9 +49,7 @@ private Q_SLOTS:
void testConfinedPointer_data(); void testConfinedPointer_data();
void testConfinedPointer(); void testConfinedPointer();
void testLockedPointer_data();
void testLockedPointer(); void testLockedPointer();
void testCloseWindowWithLockedPointer_data();
void testCloseWindowWithLockedPointer(); void testCloseWindowWithLockedPointer();
}; };
@ -98,7 +96,6 @@ void TestPointerConstraints::cleanup()
void TestPointerConstraints::testConfinedPointer_data() void TestPointerConstraints::testConfinedPointer_data()
{ {
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::addColumn<PointerFunc>("positionFunction"); QTest::addColumn<PointerFunc>("positionFunction");
QTest::addColumn<int>("xOffset"); QTest::addColumn<int>("xOffset");
QTest::addColumn<int>("yOffset"); QTest::addColumn<int>("yOffset");
@ -107,10 +104,10 @@ void TestPointerConstraints::testConfinedPointer_data()
PointerFunc topRight = &QRect::topRight; PointerFunc topRight = &QRect::topRight;
PointerFunc topLeft = &QRect::topLeft; PointerFunc topLeft = &QRect::topLeft;
QTest::newRow("XdgWmBase - bottomLeft") << Test::XdgShellSurfaceType::XdgShellStable << bottomLeft << -1 << 1; QTest::newRow("XdgWmBase - bottomLeft") << bottomLeft << -1 << 1;
QTest::newRow("XdgWmBase - bottomRight") << Test::XdgShellSurfaceType::XdgShellStable << bottomRight << 1 << 1; QTest::newRow("XdgWmBase - bottomRight") << bottomRight << 1 << 1;
QTest::newRow("XdgWmBase - topLeft") << Test::XdgShellSurfaceType::XdgShellStable << topLeft << -1 << -1; QTest::newRow("XdgWmBase - topLeft") << topLeft << -1 << -1;
QTest::newRow("XdgWmBase - topRight") << Test::XdgShellSurfaceType::XdgShellStable << topRight << 1 << -1; QTest::newRow("XdgWmBase - topRight") << topRight << 1 << -1;
} }
void TestPointerConstraints::testConfinedPointer() void TestPointerConstraints::testConfinedPointer()
@ -118,8 +115,7 @@ void TestPointerConstraints::testConfinedPointer()
// this test sets up a Surface with a confined pointer // this test sets up a Surface with a confined pointer
// simple interaction test to verify that the pointer gets confined // simple interaction test to verify that the pointer gets confined
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
QScopedPointer<Pointer> pointer(Test::waylandSeat()->createPointer()); QScopedPointer<Pointer> pointer(Test::waylandSeat()->createPointer());
QScopedPointer<ConfinedPointer> confinedPointer(Test::waylandPointerConstraints()->confinePointer(surface.data(), pointer.data(), nullptr, PointerConstraints::LifeTime::OneShot)); QScopedPointer<ConfinedPointer> confinedPointer(Test::waylandPointerConstraints()->confinePointer(surface.data(), pointer.data(), nullptr, PointerConstraints::LifeTime::OneShot));
QSignalSpy confinedSpy(confinedPointer.data(), &ConfinedPointer::confined); QSignalSpy confinedSpy(confinedPointer.data(), &ConfinedPointer::confined);
@ -226,7 +222,7 @@ void TestPointerConstraints::testConfinedPointer()
// create a second window and move it above our constrained window // create a second window and move it above our constrained window
QScopedPointer<Surface> surface2(Test::createSurface()); QScopedPointer<Surface> surface2(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellSurface(type, surface2.data())); QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data()));
auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(1280, 1024), Qt::blue); auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(1280, 1024), Qt::blue);
QVERIFY(c2); QVERIFY(c2);
QVERIFY(unconfinedSpy2.wait()); QVERIFY(unconfinedSpy2.wait());
@ -272,21 +268,13 @@ void TestPointerConstraints::testConfinedPointer()
QCOMPARE(input()->pointer()->isConstrained(), false); QCOMPARE(input()->pointer()->isConstrained(), false);
} }
void TestPointerConstraints::testLockedPointer_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestPointerConstraints::testLockedPointer() void TestPointerConstraints::testLockedPointer()
{ {
// this test sets up a Surface with a locked pointer // this test sets up a Surface with a locked pointer
// simple interaction test to verify that the pointer gets locked // simple interaction test to verify that the pointer gets locked
// the various ways to unlock are not tested as that's already verified by testConfinedPointer // the various ways to unlock are not tested as that's already verified by testConfinedPointer
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
QScopedPointer<Pointer> pointer(Test::waylandSeat()->createPointer()); QScopedPointer<Pointer> pointer(Test::waylandSeat()->createPointer());
QScopedPointer<LockedPointer> lockedPointer(Test::waylandPointerConstraints()->lockPointer(surface.data(), pointer.data(), nullptr, PointerConstraints::LifeTime::OneShot)); QScopedPointer<LockedPointer> lockedPointer(Test::waylandPointerConstraints()->lockPointer(surface.data(), pointer.data(), nullptr, PointerConstraints::LifeTime::OneShot));
QSignalSpy lockedSpy(lockedPointer.data(), &LockedPointer::locked); QSignalSpy lockedSpy(lockedPointer.data(), &LockedPointer::locked);
@ -348,19 +336,11 @@ void TestPointerConstraints::testLockedPointer()
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), c->frameGeometry().center()); QCOMPARE(KWin::Cursors::self()->mouse()->pos(), c->frameGeometry().center());
} }
void TestPointerConstraints::testCloseWindowWithLockedPointer_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("XdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestPointerConstraints::testCloseWindowWithLockedPointer() void TestPointerConstraints::testCloseWindowWithLockedPointer()
{ {
// test case which verifies that the pointer gets unlocked when the window for it gets closed // test case which verifies that the pointer gets unlocked when the window for it gets closed
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
QScopedPointer<Pointer> pointer(Test::waylandSeat()->createPointer()); QScopedPointer<Pointer> pointer(Test::waylandSeat()->createPointer());
QScopedPointer<LockedPointer> lockedPointer(Test::waylandPointerConstraints()->lockPointer(surface.data(), pointer.data(), nullptr, PointerConstraints::LifeTime::OneShot)); QScopedPointer<LockedPointer> lockedPointer(Test::waylandPointerConstraints()->lockPointer(surface.data(), pointer.data(), nullptr, PointerConstraints::LifeTime::OneShot));
QSignalSpy lockedSpy(lockedPointer.data(), &LockedPointer::locked); QSignalSpy lockedSpy(lockedPointer.data(), &LockedPointer::locked);

View File

@ -41,10 +41,8 @@ private Q_SLOTS:
void cleanup(); void cleanup();
void testStartFrame(); void testStartFrame();
void testCursorMoving(); void testCursorMoving();
void testWindow_data();
void testWindow(); void testWindow();
void testWindowScaled(); void testWindowScaled();
void testCompositorRestart_data();
void testCompositorRestart(); void testCompositorRestart();
void testX11Window(); void testX11Window();
}; };
@ -141,13 +139,6 @@ void SceneQPainterTest::testCursorMoving()
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer()); QCOMPARE(referenceImage, *scene->qpainterRenderBuffer());
} }
void SceneQPainterTest::testWindow_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void SceneQPainterTest::testWindow() void SceneQPainterTest::testWindow()
{ {
KWin::Cursors::self()->mouse()->setPos(45, 45); KWin::Cursors::self()->mouse()->setPos(45, 45);
@ -156,8 +147,7 @@ void SceneQPainterTest::testWindow()
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat)); QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat));
QVERIFY(Test::waitForWaylandPointer()); QVERIFY(Test::waitForWaylandPointer());
QScopedPointer<Surface> s(Test::createSurface()); QScopedPointer<Surface> s(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> ss(Test::createXdgShellStableSurface(s.data()));
QScopedPointer<XdgShellSurface> ss(Test::createXdgShellSurface(type, s.data()));
QScopedPointer<Pointer> p(Test::waylandSeat()->createPointer()); QScopedPointer<Pointer> p(Test::waylandSeat()->createPointer());
auto scene = KWin::Compositor::self()->scene(); auto scene = KWin::Compositor::self()->scene();
@ -243,13 +233,6 @@ void SceneQPainterTest::testWindowScaled()
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer()); QCOMPARE(referenceImage, *scene->qpainterRenderBuffer());
} }
void SceneQPainterTest::testCompositorRestart_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void SceneQPainterTest::testCompositorRestart() void SceneQPainterTest::testCompositorRestart()
{ {
// this test verifies that the compositor/SceneQPainter survive a restart of the compositor and still render correctly // this test verifies that the compositor/SceneQPainter survive a restart of the compositor and still render correctly
@ -259,8 +242,7 @@ void SceneQPainterTest::testCompositorRestart()
using namespace KWayland::Client; using namespace KWayland::Client;
QVERIFY(Test::setupWaylandConnection()); QVERIFY(Test::setupWaylandConnection());
QScopedPointer<Surface> s(Test::createSurface()); QScopedPointer<Surface> s(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> ss(Test::createXdgShellStableSurface(s.data()));
QScopedPointer<XdgShellSurface> ss(Test::createXdgShellSurface(type, s.data()));
QVERIFY(Test::renderAndWaitForShown(s.data(), QSize(200, 300), Qt::blue)); QVERIFY(Test::renderAndWaitForShown(s.data(), QSize(200, 300), Qt::blue));
// now let's try to reinitialize the compositing scene // now let's try to reinitialize the compositing scene

View File

@ -653,16 +653,6 @@ void initXdgShellPopup(KWayland::Client::Surface *surface, KWayland::Client::Xdg
shellPopup->ackConfigure(configureRequestedSpy.last()[1].toInt()); shellPopup->ackConfigure(configureRequestedSpy.last()[1].toInt());
} }
KWayland::Client::XdgShellSurface *createXdgShellSurface(XdgShellSurfaceType type, KWayland::Client::Surface *surface, QObject *parent, CreationSetup creationSetup)
{
switch (type) {
case XdgShellSurfaceType::XdgShellStable:
return createXdgShellStableSurface(surface, parent, creationSetup);
default:
return nullptr;
}
}
bool waitForWindowDestroyed(AbstractClient *client) bool waitForWindowDestroyed(AbstractClient *client)
{ {
QSignalSpy destroyedSpy(client, &QObject::destroyed); QSignalSpy destroyedSpy(client, &QObject::destroyed);

View File

@ -30,11 +30,8 @@ private Q_SLOTS:
void cleanup(); void cleanup();
void testNetCurrentDesktop(); void testNetCurrentDesktop();
void testLastDesktopRemoved_data();
void testLastDesktopRemoved(); void testLastDesktopRemoved();
void testWindowOnMultipleDesktops_data();
void testWindowOnMultipleDesktops(); void testWindowOnMultipleDesktops();
void testRemoveDesktopWithWindow_data();
void testRemoveDesktopWithWindow(); void testRemoveDesktopWithWindow();
}; };
@ -118,13 +115,6 @@ void VirtualDesktopTest::testNetCurrentDesktop()
QVERIFY(ok); QVERIFY(ok);
} }
void VirtualDesktopTest::testLastDesktopRemoved_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void VirtualDesktopTest::testLastDesktopRemoved() void VirtualDesktopTest::testLastDesktopRemoved()
{ {
// first create a new desktop // first create a new desktop
@ -138,8 +128,7 @@ void VirtualDesktopTest::testLastDesktopRemoved()
// now create a window on this desktop // now create a window on this desktop
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(client); QVERIFY(client);
@ -161,13 +150,6 @@ void VirtualDesktopTest::testLastDesktopRemoved()
QCOMPARE(VirtualDesktopManager::self()->currentDesktop(), client->desktops().first()); QCOMPARE(VirtualDesktopManager::self()->currentDesktop(), client->desktops().first());
} }
void VirtualDesktopTest::testWindowOnMultipleDesktops_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void VirtualDesktopTest::testWindowOnMultipleDesktops() void VirtualDesktopTest::testWindowOnMultipleDesktops()
{ {
// first create two new desktops // first create two new desktops
@ -181,8 +163,7 @@ void VirtualDesktopTest::testWindowOnMultipleDesktops()
// now create a window on this desktop // now create a window on this desktop
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(client); QVERIFY(client);
@ -248,13 +229,6 @@ void VirtualDesktopTest::testWindowOnMultipleDesktops()
QCOMPARE(client->desktops().count(), 2u); QCOMPARE(client->desktops().count(), 2u);
} }
void VirtualDesktopTest::testRemoveDesktopWithWindow_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void VirtualDesktopTest::testRemoveDesktopWithWindow() void VirtualDesktopTest::testRemoveDesktopWithWindow()
{ {
// first create two new desktops // first create two new desktops
@ -268,8 +242,7 @@ void VirtualDesktopTest::testRemoveDesktopWithWindow()
// now create a window on this desktop // now create a window on this desktop
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(client); QVERIFY(client);

File diff suppressed because it is too large Load Diff

View File

@ -62,39 +62,28 @@ private Q_SLOTS:
void testMapUnmap(); void testMapUnmap();
void testDesktopPresenceChanged(); void testDesktopPresenceChanged();
void testWindowOutputs_data();
void testWindowOutputs(); void testWindowOutputs();
void testMinimizeActiveWindow_data();
void testMinimizeActiveWindow(); void testMinimizeActiveWindow();
void testFullscreen_data(); void testFullscreen_data();
void testFullscreen(); void testFullscreen();
void testFullscreenRestore_data();
void testFullscreenRestore(); void testFullscreenRestore();
void testUserCanSetFullscreen_data();
void testUserCanSetFullscreen(); void testUserCanSetFullscreen();
void testUserSetFullscreen_data();
void testUserSetFullscreen(); void testUserSetFullscreen();
void testMaximizedToFullscreen_data(); void testMaximizedToFullscreen_data();
void testMaximizedToFullscreen(); void testMaximizedToFullscreen();
void testWindowOpensLargerThanScreen_data();
void testWindowOpensLargerThanScreen(); void testWindowOpensLargerThanScreen();
void testHidden_data();
void testHidden(); void testHidden();
void testDesktopFileName(); void testDesktopFileName();
void testCaptionSimplified(); void testCaptionSimplified();
void testCaptionMultipleWindows(); void testCaptionMultipleWindows();
void testUnresponsiveWindow_data(); void testUnresponsiveWindow_data();
void testUnresponsiveWindow(); void testUnresponsiveWindow();
void testX11WindowId_data();
void testX11WindowId(); void testX11WindowId();
void testAppMenu(); void testAppMenu();
void testNoDecorationModeRequested_data();
void testNoDecorationModeRequested(); void testNoDecorationModeRequested();
void testSendClientWithTransientToDesktop_data();
void testSendClientWithTransientToDesktop(); void testSendClientWithTransientToDesktop();
void testMinimizeWindowWithTransients_data();
void testMinimizeWindowWithTransients(); void testMinimizeWindowWithTransients();
void testXdgDecoration_data(); void testXdgDecoration_data();
void testXdgDecoration(); void testXdgDecoration();
@ -247,18 +236,10 @@ void TestXdgShellClient::testDesktopPresenceChanged()
QCOMPARE(desktopPresenceChangedEffectsSpy.first().at(2).toInt(), 2); QCOMPARE(desktopPresenceChangedEffectsSpy.first().at(2).toInt(), 2);
} }
void TestXdgShellClient::testWindowOutputs_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestXdgShellClient::testWindowOutputs() void TestXdgShellClient::testWindowOutputs()
{ {
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
auto size = QSize(200,200); auto size = QSize(200,200);
QSignalSpy outputEnteredSpy(surface.data(), &Surface::outputEntered); QSignalSpy outputEnteredSpy(surface.data(), &Surface::outputEntered);
@ -292,19 +273,11 @@ void TestXdgShellClient::testWindowOutputs()
QCOMPARE(surface->outputs().first()->globalPosition(), QPoint(1280,0)); QCOMPARE(surface->outputs().first()->globalPosition(), QPoint(1280,0));
} }
void TestXdgShellClient::testMinimizeActiveWindow_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestXdgShellClient::testMinimizeActiveWindow() void TestXdgShellClient::testMinimizeActiveWindow()
{ {
// this test verifies that when minimizing the active window it gets deactivated // this test verifies that when minimizing the active window it gets deactivated
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<QObject> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<QObject> shellSurface(Test::createXdgShellSurface(type, surface.data()));
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->isActive()); QVERIFY(c->isActive());
@ -333,12 +306,10 @@ void TestXdgShellClient::testMinimizeActiveWindow()
void TestXdgShellClient::testFullscreen_data() void TestXdgShellClient::testFullscreen_data()
{ {
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::addColumn<ServerSideDecoration::Mode>("decoMode"); QTest::addColumn<ServerSideDecoration::Mode>("decoMode");
QTest::newRow("xdgShellWmBase") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Client; QTest::newRow("client-side deco") << ServerSideDecoration::Mode::Client;
QTest::newRow("server-side deco") << ServerSideDecoration::Mode::Server;
QTest::newRow("xdgShellWmBase - deco") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Server;
} }
void TestXdgShellClient::testFullscreen() void TestXdgShellClient::testFullscreen()
@ -348,8 +319,7 @@ void TestXdgShellClient::testFullscreen()
XdgShellSurface::States states; XdgShellSurface::States states;
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
QVERIFY(shellSurface); QVERIFY(shellSurface);
// create deco // create deco
@ -435,19 +405,11 @@ void TestXdgShellClient::testFullscreen()
QVERIFY(Test::waitForWindowDestroyed(client)); QVERIFY(Test::waitForWindowDestroyed(client));
} }
void TestXdgShellClient::testFullscreenRestore_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgShellWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestXdgShellClient::testFullscreenRestore() void TestXdgShellClient::testFullscreenRestore()
{ {
// this test verifies that windows created fullscreen can be later properly restored // this test verifies that windows created fullscreen can be later properly restored
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); XdgShellSurface *xdgShellSurface = Test::createXdgShellStableSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly);
XdgShellSurface *xdgShellSurface = Test::createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly);
QSignalSpy configureRequestedSpy(xdgShellSurface, &XdgShellSurface::configureRequested); QSignalSpy configureRequestedSpy(xdgShellSurface, &XdgShellSurface::configureRequested);
// fullscreen the window // fullscreen the window
@ -495,18 +457,10 @@ void TestXdgShellClient::testFullscreenRestore()
QCOMPARE(c->frameGeometry().size(), QSize(100, 50)); QCOMPARE(c->frameGeometry().size(), QSize(100, 50));
} }
void TestXdgShellClient::testUserCanSetFullscreen_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestXdgShellClient::testUserCanSetFullscreen() void TestXdgShellClient::testUserCanSetFullscreen()
{ {
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->isActive()); QVERIFY(c->isActive());
@ -514,19 +468,11 @@ void TestXdgShellClient::testUserCanSetFullscreen()
QVERIFY(c->userCanSetFullScreen()); QVERIFY(c->userCanSetFullScreen());
} }
void TestXdgShellClient::testUserSetFullscreen_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestXdgShellClient::testUserSetFullscreen() void TestXdgShellClient::testUserSetFullscreen()
{ {
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface( surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
QVERIFY(!shellSurface.isNull()); QVERIFY(!shellSurface.isNull());
// wait for the initial configure event // wait for the initial configure event
@ -577,12 +523,10 @@ void TestXdgShellClient::testUserSetFullscreen()
void TestXdgShellClient::testMaximizedToFullscreen_data() void TestXdgShellClient::testMaximizedToFullscreen_data()
{ {
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::addColumn<ServerSideDecoration::Mode>("decoMode"); QTest::addColumn<ServerSideDecoration::Mode>("decoMode");
QTest::newRow("xdgShellWmBase") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Client; QTest::newRow("client-side deco") << ServerSideDecoration::Mode::Client;
QTest::newRow("server-side deco") << ServerSideDecoration::Mode::Server;
QTest::newRow("xdgShellWmBase - deco") << Test::XdgShellSurfaceType::XdgShellStable << ServerSideDecoration::Mode::Server;
} }
void TestXdgShellClient::testMaximizedToFullscreen() void TestXdgShellClient::testMaximizedToFullscreen()
@ -592,8 +536,7 @@ void TestXdgShellClient::testMaximizedToFullscreen()
XdgShellSurface::States states; XdgShellSurface::States states;
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
QVERIFY(shellSurface); QVERIFY(shellSurface);
// create deco // create deco
@ -683,20 +626,12 @@ void TestXdgShellClient::testMaximizedToFullscreen()
QVERIFY(Test::waitForWindowDestroyed(client)); QVERIFY(Test::waitForWindowDestroyed(client));
} }
void TestXdgShellClient::testWindowOpensLargerThanScreen_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestXdgShellClient::testWindowOpensLargerThanScreen() void TestXdgShellClient::testWindowOpensLargerThanScreen()
{ {
// this test creates a window which is as large as the screen, but is decorated // this test creates a window which is as large as the screen, but is decorated
// the window should get resized to fit into the screen, BUG: 366632 // the window should get resized to fit into the screen, BUG: 366632
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), SIGNAL(sizeChanged(QSize))); QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), SIGNAL(sizeChanged(QSize)));
QVERIFY(sizeChangeRequestedSpy.isValid()); QVERIFY(sizeChangeRequestedSpy.isValid());
@ -717,19 +652,11 @@ void TestXdgShellClient::testWindowOpensLargerThanScreen()
QCOMPARE(c->frameGeometry(), QRect(QPoint(0, 0), screens()->size(0))); QCOMPARE(c->frameGeometry(), QRect(QPoint(0, 0), screens()->size(0)));
} }
void TestXdgShellClient::testHidden_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestXdgShellClient::testHidden() void TestXdgShellClient::testHidden()
{ {
// this test verifies that when hiding window it doesn't get shown // this test verifies that when hiding window it doesn't get shown
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<QObject> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<QObject> shellSurface(Test::createXdgShellSurface(type, surface.data()));
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->isActive()); QVERIFY(c->isActive());
@ -936,18 +863,10 @@ void TestXdgShellClient::testUnresponsiveWindow()
QVERIFY(elapsed2 > 1800); //second ping comes in a second later QVERIFY(elapsed2 > 1800); //second ping comes in a second later
} }
void TestXdgShellClient::testX11WindowId_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestXdgShellClient::testX11WindowId() void TestXdgShellClient::testX11WindowId()
{ {
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(c); QVERIFY(c);
QVERIFY(c->windowId() != 0); QVERIFY(c->windowId() != 0);
@ -974,19 +893,11 @@ void TestXdgShellClient::testAppMenu()
QVERIFY (QDBusConnection::sessionBus().unregisterService("org.kde.kappmenu")); QVERIFY (QDBusConnection::sessionBus().unregisterService("org.kde.kappmenu"));
} }
void TestXdgShellClient::testNoDecorationModeRequested_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestXdgShellClient::testNoDecorationModeRequested() void TestXdgShellClient::testNoDecorationModeRequested()
{ {
// this test verifies that the decoration follows the default mode if no mode is explicitly requested // this test verifies that the decoration follows the default mode if no mode is explicitly requested
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
QScopedPointer<ServerSideDecoration> deco(Test::waylandServerSideDecoration()->create(surface.data())); QScopedPointer<ServerSideDecoration> deco(Test::waylandServerSideDecoration()->create(surface.data()));
QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged); QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged);
QVERIFY(decoSpy.isValid()); QVERIFY(decoSpy.isValid());
@ -1001,28 +912,20 @@ void TestXdgShellClient::testNoDecorationModeRequested()
QCOMPARE(c->isDecorated(), true); QCOMPARE(c->isDecorated(), true);
} }
void TestXdgShellClient::testSendClientWithTransientToDesktop_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestXdgShellClient::testSendClientWithTransientToDesktop() void TestXdgShellClient::testSendClientWithTransientToDesktop()
{ {
// this test verifies that when sending a client to a desktop all transients are also send to that desktop // this test verifies that when sending a client to a desktop all transients are also send to that desktop
VirtualDesktopManager::self()->setCount(2); VirtualDesktopManager::self()->setCount(2);
QScopedPointer<Surface> surface{Test::createSurface()}; QScopedPointer<Surface> surface{Test::createSurface()};
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(c); QVERIFY(c);
// let's create a transient window // let's create a transient window
QScopedPointer<Surface> transientSurface{Test::createSurface()}; QScopedPointer<Surface> transientSurface{Test::createSurface()};
QScopedPointer<XdgShellSurface> transientShellSurface(Test::createXdgShellSurface(type, transientSurface.data())); QScopedPointer<XdgShellSurface> transientShellSurface(Test::createXdgShellStableSurface(transientSurface.data()));
transientShellSurface->setTransientFor(shellSurface.data()); transientShellSurface->setTransientFor(shellSurface.data());
auto transient = Test::renderAndWaitForShown(transientSurface.data(), QSize(100, 50), Qt::blue); auto transient = Test::renderAndWaitForShown(transientSurface.data(), QSize(100, 50), Qt::blue);
@ -1055,13 +958,6 @@ void TestXdgShellClient::testSendClientWithTransientToDesktop()
QCOMPARE(transient->desktop(), 1); QCOMPARE(transient->desktop(), 1);
} }
void TestXdgShellClient::testMinimizeWindowWithTransients_data()
{
QTest::addColumn<Test::XdgShellSurfaceType>("type");
QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable;
}
void TestXdgShellClient::testMinimizeWindowWithTransients() void TestXdgShellClient::testMinimizeWindowWithTransients()
{ {
// this test verifies that when minimizing/unminimizing a window all its // this test verifies that when minimizing/unminimizing a window all its
@ -1069,15 +965,14 @@ void TestXdgShellClient::testMinimizeWindowWithTransients()
// create the main window // create the main window
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::XdgShellSurfaceType, type); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data()));
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(c); QVERIFY(c);
QVERIFY(!c->isMinimized()); QVERIFY(!c->isMinimized());
// create a transient window // create a transient window
QScopedPointer<Surface> transientSurface(Test::createSurface()); QScopedPointer<Surface> transientSurface(Test::createSurface());
QScopedPointer<XdgShellSurface> transientShellSurface(Test::createXdgShellSurface(type, transientSurface.data())); QScopedPointer<XdgShellSurface> transientShellSurface(Test::createXdgShellStableSurface(transientSurface.data()));
transientShellSurface->setTransientFor(shellSurface.data()); transientShellSurface->setTransientFor(shellSurface.data());
auto transient = Test::renderAndWaitForShown(transientSurface.data(), QSize(100, 50), Qt::red); auto transient = Test::renderAndWaitForShown(transientSurface.data(), QSize(100, 50), Qt::red);
QVERIFY(transient); QVERIFY(transient);