on xenial help sign in
suspend+reboot also gives you the screenshot
6f9be79Albert Astals Cid
plugins/SessionScreenshoter/sessionscreenshoter.cpp−1
@@ -31,7 +31,6 @@ SessionScreenshoter::SessionScreenshoter(QObject *parent)
31 : QObject(parent),
31 : QObject(parent),
32 m_target(nullptr)
32 m_target(nullptr)
33{
33{
34− // TODO tests
35}
34}
36
35
37QString SessionScreenshoter::appId() const
36QString SessionScreenshoter::appId() const
tests/qmltests/Stages/tst_ApplicationWindow.qml+34
@@ -343,6 +343,40 @@ Rectangle {
343 tryCompare(screenshotImage, "status", Image.Null);
343 tryCompare(screenshotImage, "status", Image.Null);
344 }
344 }
345
345
346+ function test_suspendrestartApp() {
347+ var screenshotImage = findChild(applicationWindowLoader.item, "screenshotImage");
348+
349+ initSession();
350+ setApplicationState(appRunning);
351+ tryCompare(stateGroup, "state", "surface");
352+ waitUntilTransitionsEnd();
353+
354+ setApplicationState(appSuspended);
355+
356+ cleanupSession();
357+
358+ tryCompare(stateGroup, "state", "screenshot");
359+ waitUntilTransitionsEnd();
360+ tryCompare(fakeApplication, "session", null);
361+
362+ // and restart it
363+ setApplicationState(appStarting);
364+
365+ waitUntilTransitionsEnd();
366+ verify(stateGroup.state === "screenshot");
367+ verify(fakeSession === null);
368+
369+ setApplicationState(appRunning);
370+
371+ waitUntilTransitionsEnd();
372+ verify(stateGroup.state === "screenshot");
373+
374+ initSession();
375+
376+ tryCompare(stateGroup, "state", "surface");
377+ tryCompare(screenshotImage, "status", Image.Null);
378+ }
379+
346 function test_appCrashed() {
380 function test_appCrashed() {
347 initSession();
381 initSession();
348 setApplicationState(appRunning);
382 setApplicationState(appRunning);