@@ -27,10 +27,9 @@ import Powerd 0.1
28import "../../qml"
28import "../../qml"
32− width: shell.width + units.gu(20)
32+ spacing: 0
35 QtObject {
34 QtObject {
36 id: applicationArguments
35 id: applicationArguments
@@ -48,21 +47,55 @@ Item {
52− id: shell
51+ id: shellLoader
53− maxFailedLogins: maxRetriesTextField.text
52+
56− anchors { top: parent.top; right: parent.right; bottom: parent.bottom; margins:units.gu(1) }
57− width: units.gu(18)
53+ width: units.gu(40)
59− Label {
56+ property bool itemDestroyed: false
60− text: "Max retries:"
57+ sourceComponent: Component {
61− color: "black"
58+ Shell {
59+ Component.onDestruction: {
60+ shellLoader.itemDestroyed = true
62+ maxFailedLogins: maxRetriesTextField.text
70+ height: shellLoader.height
73+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
76+ anchors { left: parent.left; right: parent.right }
80+ if (shellLoader.status !== Loader.Ready)
83+ var greeter = testCase.findChild(shellLoader.item, "greeter")
84+ if (!greeter.shown) {
63− TextField {
95+ TextField {
64− id: maxRetriesTextField
96+ id: maxRetriesTextField
65− text: "-1"
97+ text: "-1"
@@ -81,13 +114,10 @@ Item {
81 name: "ShellWithPin"
114 name: "ShellWithPin"
82 when: windowShown
115 when: windowShown
84− function initTestCase() {
117+ property Item shell: shellLoader.status === Loader.Ready ? shellLoader.item : null
86− sessionSpy.target = findChild(shell, "greeter")
89 function init() {
119 function init() {
90− shell.tablet = false
120+ sessionSpy.target = findChild(shell, "greeter")
91 swipeAwayGreeter()
121 swipeAwayGreeter()
92 shell.failedLoginsDelayAttempts = -1
122 shell.failedLoginsDelayAttempts = -1
93 maxRetriesTextField.text = "-1"
123 maxRetriesTextField.text = "-1"
@@ -96,12 +126,28 @@ Item {
98 function cleanup() {
128 function cleanup() {
99− LightDM.Greeter.showGreeter()
129+ shellLoader.itemDestroyed = false
100− var greeter = findChild(shell, "greeter")
130+
101− tryCompare(greeter, "showProgress", 1)
131+ shellLoader.active = false
133+ tryCompare(shellLoader, "status", Loader.Null)
134+ tryCompare(shellLoader, "item", null)
135+ // Loader.status might be Loader.Null and Loader.item might be null but the Loader
136+ // item might still be alive. So if we set Loader.active back to true
137+ // again right now we will get the very same Shell instance back. So no reload
138+ // actually took place. Likely because Loader waits until the next event loop
139+ // iteration to do its work. So to ensure the reload, we will wait until the
140+ // Shell instance gets destroyed.
141+ tryCompare(shellLoader, "itemDestroyed", true)
103 // kill all (fake) running apps
143 // kill all (fake) running apps
104 killApps()
144 killApps()
146+ // reload our test subject to get it in a fresh state once again
147+ shellLoader.active = true
149+ tryCompare(shellLoader, "status", Loader.Ready)
150+ removeTimeConstraintsFromDirectionalDragAreas(shellLoader.item)
107 function killApps() {
153 function killApps() {