@@ -42,6 +42,7 @@ Rectangle {
4242 anchors.fill: parent
4343 focus: true
4444 interactive: interactiveCheckbox.checked
45+ isPromptSurface: promptCheckbox.checked
4546 Component.onDestruction: {
4647 surfaceContainerLoader.itemDestroyed = true;
4748 }
@@ -75,17 +76,19 @@ Rectangle {
7576 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
7677 spacing: units.gu(1)
7778
78− RowLayout {
79− Layout.fillWidth: true
8079
81− Row {
82− CheckBox {id: fullscreenCheckbox; checked: true; activeFocusOnPress: false }
83− Label { text: "fullscreen" }
84− }
85− Row {
86− CheckBox {id: interactiveCheckbox; checked: true; activeFocusOnPress: false }
87− Label { text: "interactive" }
88− }
80+ Row {
81+ CheckBox {id: fullscreenCheckbox; checked: true; activeFocusOnPress: false }
82+ Label { text: "fullscreen" }
83+ }
84+ Row {
85+ CheckBox {id: interactiveCheckbox; checked: true; activeFocusOnPress: false }
86+ Label { text: "interactive" }
87+ }
88+ Row {
89+ CheckBox {id: promptCheckbox; checked: false; activeFocusOnPress: false
90+ enabled: surfaceContainerLoader.item.surface === null }
91+ Label { text: "isPromptSurface" }
8992 }
9093
9194 RowLayout {
@@ -102,10 +105,9 @@ Rectangle {
102105 if (checked) {
103106 var application = ApplicationManager.add("music-app");
104107 application.manualSurfaceCreation = true;
105− application.setState(ApplicationInfoInterface.Starting);
106108
107− surfaceContainerLoader.item.surface = SurfaceManager.createSurface("foo",
108− Mir.NormalType, Mir.MaximizedState, application.screenshot);
109+ application.createSurface();
110+ surfaceContainerLoader.item.surface = application.surfaceList.get(0);
109111
110112 application.setState(ApplicationInfoInterface.Running);
111113 } else {
@@ -123,22 +125,11 @@ Rectangle {
123125 }
124126 }
125127
126− Rectangle {
127− border {
128− color: "black"
129− width: 1
130− }
131− anchors {
132− left: parent.left
133− right: parent.right
134− }
135− Layout.preferredHeight: surfaceChildrenControl.height
136−
137− RecursingChildSessionControl {
138− id: surfaceChildrenControl
139− anchors { left: parent.left; right: parent.right; }
140−
141− surface: surfaceContainerLoader.item ? surfaceContainerLoader.item.surface : null
128+ Button {
129+ text: "Reload"
130+ enabled: !surfaceCheckbox.checked
131+ onClicked: {
132+ testCase.cleanup();
142133 }
143134 }
144135 }
@@ -164,6 +155,7 @@ Rectangle {
164155
165156 surfaceCheckbox.checked = false;
166157 interactiveCheckbox.checked = true;
158+ promptCheckbox.checked = false;
167159
168160 surfaceContainerLoader.active = true;
169161 tryCompare(surfaceContainerLoader, "status", Loader.Ready);
@@ -171,121 +163,6 @@ Rectangle {
171163
172164 when: windowShown
173165
174− function test_addChildSession_data() {
175− return [ { tag: "count=1", count: 1 },
176− { tag: "count=4", count: 4 } ];
177− }
178−
179− function test_addChildSession(data) {
180− surfaceCheckbox.checked = true;
181− var childSurfaces = testCase.findChild(surfaceContainer, "childSurfacesRepeater");
182− compare(childSurfaces.count, 0);
183−
184− var i;
185− for (i = 0; i < data.count; i++) {
186− surfaceContainer.surface.createPromptSurface();
187− compare(childSurfaces.count, i+1);
188− }
189−
190− for (i = data.count-1; i >= 0; i--) {
191− {
192− var childPromptSurface = surfaceContainer.surface.promptSurfaceList.get(i);
193− childPromptSurface.close();
194− }
195− tryCompareFunction(function() { return childSurfaces.count; }, i);
196− }
197− }
198−
199− function test_childSessionDestructionReturnsFocusToSiblingOrParent() {
200− surfaceCheckbox.checked = true;
201− var childSurfaces = testCase.findChild(surfaceContainer, "childSurfacesRepeater");
202− compare(childSurfaces.count, 0);
203−
204− var i;
205− // 3 surfaces should cover all edge cases
206− for (i = 0; i < 3; i++) {
207− surfaceContainer.surface.createPromptSurface();
208− compare(childSurfaces.count, i+1);
209− }
210−
211− for (i = 2; i >= 0; --i) {
212− var childPromptSurface = surfaceContainer.surface.promptSurfaceList.get(i);
213− compare(childPromptSurface.activeFocus, true);
214−
215− childPromptSurface.close();
216− tryCompareFunction(function() { return childSurfaces.count; }, i);
217−
218− if (i > 0) {
219− // active focus should have gone to the yongest remaining sibling
220− var previousSiblingSurface = surfaceContainer.surface.promptSurfaceList.get(i-1);
221− tryCompare(previousSiblingSurface, "activeFocus", true);
222− } else {
223− // active focus should have gone to the parent surface
224− tryCompare(surfaceContainer.surface, "activeFocus", true);
225− }
226− }
227− }
228−
229− function test_nestedChildSessions_data() {
230− return [ { tag: "depth=2", depth: 2 },
231− { tag: "depth=8", depth: 8 }
232− ];
233− }
234− function test_nestedChildSessions(data) {
235− surfaceCheckbox.checked = true;
236−
237− var i;
238− var container = surfaceContainer;
239− var surface = container.surface;
240− var surfaces = [surface];
241− var parent_childSurfaces = [null];
242− for (i = 0; i < data.depth; i++) {
243− surface.createPromptSurface();
244− var childSurfaces = testCase.findChild(container, "childSurfacesRepeater");
245− compare(childSurfaces.count, 1);
246−
247− var childDelegate = childSurfaces.itemAt(0);
248− container = findChild(childDelegate, "surfaceContainer");
249− {
250− var animationsLoader = findChild(container, "animationsLoader");
251− tryCompare(animationsLoader, "status", Loader.Ready);
252− waitUntilTransitionsEnd(animationsLoader.item);
253− }
254− surface = container.surface;
255−
256− surfaces.push(surface);
257− parent_childSurfaces.push(childSurfaces);
258− }
259−
260− for (i = surfaces.length-1; i >= 0; i--) {
261− surfaces[i].close();
262− if (parent_childSurfaces[i]) {
263− tryCompareFunction(function() { return parent_childSurfaces[i].count; }, 0);
264− }
265− }
266− }
267−
268− function test_childrenAdjustForParentSize() {
269− surfaceCheckbox.checked = true;
270−
271− surfaceContainer.surface.createPromptSurface();
272−
273− var delegate = findChild(surfaceContainer, "childDelegate0");
274− var childContainer = findChild(delegate, "surfaceContainer");
275−
276− tryCompareFunction(function() { return childContainer.height === surfaceContainer.height; }, true);
277− tryCompareFunction(function() { return childContainer.width === surfaceContainer.width; }, true);
278− tryCompareFunction(function() { return childContainer.x === 0; }, true);
279− tryCompareFunction(function() { return childContainer.y === 0; }, true);
280−
281− surfaceContainer.anchors.margins = units.gu(2);
282−
283− tryCompareFunction(function() { return childContainer.height === surfaceContainer.height; }, true);
284− tryCompareFunction(function() { return childContainer.width === surfaceContainer.width; }, true);
285− tryCompareFunction(function() { return childContainer.x === 0; }, true);
286− tryCompareFunction(function() { return childContainer.y === 0; }, true);
287− }
288−
289166 function isContainerAnimating(container) {
290167 var animationsLoader = findChild(container, "animationsLoader");
291168 if (!animationsLoader || animationsLoader.status != Loader.Ready) {
@@ -303,25 +180,21 @@ Rectangle {
303180 return false;
304181 }
305182
306− function test_childrenAnimate() {
183+ function test_promptSurfaceAnimates() {
184+ promptCheckbox.checked = true;
307185 surfaceCheckbox.checked = true;
308186
309− surfaceContainer.surface.createPromptSurface();
310−
311− var delegate = findChild(surfaceContainer, "childDelegate0");
312− var childContainer = findChild(delegate, "surfaceContainer");
313−
314187 // wait for animation to begin
315− tryCompareFunction(function() { return isContainerAnimating(childContainer); }, true);
188+ tryCompareFunction(function() { return isContainerAnimating(surfaceContainer); }, true);
316189 // wait for animation to end
317− tryCompareFunction(function() { return isContainerAnimating(childContainer); }, false);
190+ tryCompareFunction(function() { return isContainerAnimating(surfaceContainer); }, false);
318191
319− surfaceContainer.surface.promptSurfaceList.get(0).close();
192+ surfaceContainer.surface.close();
320193
321194 // wait for animation to begin
322− tryCompareFunction(function() { return isContainerAnimating(childContainer); }, true);
195+ tryCompareFunction(function() { return isContainerAnimating(surfaceContainer); }, true);
323196 // wait for animation to end
324− tryCompareFunction(function() { return isContainerAnimating(childContainer); }, false);
197+ tryCompareFunction(function() { return isContainerAnimating(surfaceContainer); }, false);
325198 }
326199
327200 function test_surfaceItemGetsNoTouchesWhenContainerNotInteractive() {