[autotests/integration] Add ScreenLockerWatcher to the Test::lockScreen and ::unlockScreen
This extends the test helper for locking the screen and unlocking the screen to also wait for the ScreenLockerWatcher to have that state. This is going to fail on build.kde.org as we don't have EGL there and the greeter crashes. This needs an extension to fake that we have a screen lock window.
This commit is contained in:
parent
697ea3ae00
commit
ca50a24728
2 changed files with 34 additions and 3 deletions
|
@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
#include "shell_client.h"
|
||||
#include "screenlockerwatcher.h"
|
||||
#include "wayland_server.h"
|
||||
|
||||
#include <KWayland/Client/compositor.h>
|
||||
|
@ -378,7 +379,22 @@ bool lockScreen()
|
|||
if (lockStateChangedSpy.count() != 1) {
|
||||
return false;
|
||||
}
|
||||
return waylandServer()->isScreenLocked();
|
||||
if (!waylandServer()->isScreenLocked()) {
|
||||
return false;
|
||||
}
|
||||
if (!ScreenLockerWatcher::self()->isLocked()) {
|
||||
QSignalSpy lockedSpy(ScreenLockerWatcher::self(), &ScreenLockerWatcher::locked);
|
||||
if (!lockedSpy.isValid()) {
|
||||
return false;
|
||||
}
|
||||
if (!lockedSpy.wait()) {
|
||||
return false;
|
||||
}
|
||||
if (!ScreenLockerWatcher::self()->isLocked()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool unlockScreen()
|
||||
|
@ -399,7 +415,22 @@ bool unlockScreen()
|
|||
if (waylandServer()->isScreenLocked()) {
|
||||
lockStateChangedSpy.wait();
|
||||
}
|
||||
return !waylandServer()->isScreenLocked();
|
||||
if (waylandServer()->isScreenLocked()) {
|
||||
return true;
|
||||
}
|
||||
if (ScreenLockerWatcher::self()->isLocked()) {
|
||||
QSignalSpy lockedSpy(ScreenLockerWatcher::self(), &ScreenLockerWatcher::locked);
|
||||
if (!lockedSpy.isValid()) {
|
||||
return false;
|
||||
}
|
||||
if (!lockedSpy.wait()) {
|
||||
return false;
|
||||
}
|
||||
if (ScreenLockerWatcher::self()->isLocked()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class QDBusPendingCallWatcher;
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
class ScreenLockerWatcher : public QObject
|
||||
class KWIN_EXPORT ScreenLockerWatcher : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue