From e3bc9e8ac61ad8fcd7e58cc400eb73cb95fefe5a Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 22 Apr 2023 18:10:24 +0300 Subject: [PATCH] autotests: Allow running lockscreen test with software rendering The test needs OpenGL in order to ensure that the window view effect is loaded and it registers a screen edge. On the other hand, we could register a screen edge ourselves and thus allow running the test on freebsd. --- autotests/integration/lockscreen.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/autotests/integration/lockscreen.cpp b/autotests/integration/lockscreen.cpp index f2f18d556f..4471e3bd1a 100644 --- a/autotests/integration/lockscreen.cpp +++ b/autotests/integration/lockscreen.cpp @@ -174,10 +174,6 @@ std::pair> LockScreenTest:: void LockScreenTest::initTestCase() { - if (!Test::renderNodeAvailable()) { - QSKIP("no render node available"); - return; - } qRegisterMetaType(); qRegisterMetaType("ElectricBorder"); @@ -185,7 +181,6 @@ void LockScreenTest::initTestCase() QVERIFY(waylandServer()->init(s_socketName)); QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); - qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2")); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); const auto outputs = workspace()->outputs(); @@ -193,8 +188,6 @@ void LockScreenTest::initTestCase() QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024)); QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024)); setenv("QT_QPA_PLATFORM", "wayland", true); - - QCOMPARE(Compositor::self()->backend()->compositingType(), KWin::OpenGLCompositing); } void LockScreenTest::init() @@ -404,11 +397,25 @@ void LockScreenTest::testKeyboard() QCOMPARE(keyChangedSpy.at(3).at(1).value(), KWayland::Client::Keyboard::KeyState::Released); } +class TestObject : public QObject +{ + Q_OBJECT + +public Q_SLOTS: + bool callback(ElectricBorder border) + { + return true; + } +}; + void LockScreenTest::testScreenEdge() { QSignalSpy screenEdgeSpy(workspace()->screenEdges(), &ScreenEdges::approaching); QCOMPARE(screenEdgeSpy.count(), 0); + TestObject callback; + workspace()->screenEdges()->reserve(ElectricTopLeft, &callback, "callback"); + quint32 timestamp = 1; MOTION(QPoint(5, 5)); QCOMPARE(screenEdgeSpy.count(), 1);