From 5200a484ce7e0baf72d7cc8c1eef5911e7935ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 17 Feb 2016 09:41:17 +0100 Subject: [PATCH] [autotest] Adjust LockScreenTest to fix that KSldApp goes to Locked state So far KSldApp was always either in state AcquiringLock or Unlocked during the tests. Due to a fix in WaylandServer it now can also enter the Locked state. But this is timing related and also depends on whether the greeter works at all. E.g. on build.kde.org the greeter fails to start, so it never enters the Locked state. The adjusted test now considers that the state might have changed to Locked and expects one additional signal to be emitted. --- autotests/wayland/lockscreen.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/autotests/wayland/lockscreen.cpp b/autotests/wayland/lockscreen.cpp index b8e6aa1451..b5548e1c05 100644 --- a/autotests/wayland/lockscreen.cpp +++ b/autotests/wayland/lockscreen.cpp @@ -111,12 +111,16 @@ Q_SIGNALS: QVERIFY(waylandServer()->isScreenLocked()); #define UNLOCK \ - QCOMPARE(lockStateChangedSpy.count(), 1); \ + int expectedLockCount = 1; \ + if (ScreenLocker::KSldApp::self()->lockState() == ScreenLocker::KSldApp::Locked) { \ + expectedLockCount = 2; \ + } \ + QCOMPARE(lockStateChangedSpy.count(), expectedLockCount); \ unlock(); \ - if (lockStateChangedSpy.count() < 2) { \ + if (lockStateChangedSpy.count() < expectedLockCount + 1) { \ QVERIFY(lockStateChangedSpy.wait()); \ } \ - QCOMPARE(lockStateChangedSpy.count(), 2); \ + QCOMPARE(lockStateChangedSpy.count(), expectedLockCount + 1); \ QVERIFY(!waylandServer()->isScreenLocked()); #define MOTION(target) \