[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.
This commit is contained in:
Martin Gräßlin 2016-02-17 09:41:17 +01:00
parent 9e54cb5a1f
commit 5200a484ce

View file

@ -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) \