@@ -42,6 +42,7 @@ Rectangle {
42 anchors.fill: parent
42 anchors.fill: parent
43 focus: true
43 focus: true
44 interactive: interactiveCheckbox.checked
44 interactive: interactiveCheckbox.checked
45+ isPromptSurface: promptCheckbox.checked
45 Component.onDestruction: {
46 Component.onDestruction: {
46 surfaceContainerLoader.itemDestroyed = true;
47 surfaceContainerLoader.itemDestroyed = true;
@@ -75,17 +76,19 @@ Rectangle {
75 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
76 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
76 spacing: units.gu(1)
77 spacing: units.gu(1)
79− Layout.fillWidth: true
82− CheckBox {id: fullscreenCheckbox; checked: true; activeFocusOnPress: false }
81+ CheckBox {id: fullscreenCheckbox; checked: true; activeFocusOnPress: false }
83− Label { text: "fullscreen" }
82+ Label { text: "fullscreen" }
86− CheckBox {id: interactiveCheckbox; checked: true; activeFocusOnPress: false }
85+ CheckBox {id: interactiveCheckbox; checked: true; activeFocusOnPress: false }
87− Label { text: "interactive" }
86+ Label { text: "interactive" }
89+ CheckBox {id: promptCheckbox; checked: false; activeFocusOnPress: false
90+ enabled: surfaceContainerLoader.item.surface === null }
91+ Label { text: "isPromptSurface" }
91 RowLayout {
94 RowLayout {
@@ -102,10 +105,9 @@ Rectangle {
102 if (checked) {
105 if (checked) {
103 var application = ApplicationManager.add("music-app");
106 var application = ApplicationManager.add("music-app");
104 application.manualSurfaceCreation = true;
107 application.manualSurfaceCreation = true;
105− application.setState(ApplicationInfoInterface.Starting);
109+ application.createSurface();
107− surfaceContainerLoader.item.surface = SurfaceManager.createSurface("foo",
110+ surfaceContainerLoader.item.surface = application.surfaceList.get(0);
108− Mir.NormalType, Mir.MaximizedState, application.screenshot);
110 application.setState(ApplicationInfoInterface.Running);
112 application.setState(ApplicationInfoInterface.Running);
@@ -123,22 +125,11 @@ Rectangle {
126− Rectangle {
128+ Button {
127− border {
129+ text: "Reload"
128− color: "black"
130+ enabled: !surfaceCheckbox.checked
129− width: 1
131+ onClicked: {
130− }
132+ testCase.cleanup();
135− Layout.preferredHeight: surfaceChildrenControl.height
137− RecursingChildSessionControl {
138− id: surfaceChildrenControl
139− anchors { left: parent.left; right: parent.right; }
141− surface: surfaceContainerLoader.item ? surfaceContainerLoader.item.surface : null
@@ -164,6 +155,7 @@ Rectangle {
165 surfaceCheckbox.checked = false;
156 surfaceCheckbox.checked = false;
166 interactiveCheckbox.checked = true;
157 interactiveCheckbox.checked = true;
158+ promptCheckbox.checked = false;
168 surfaceContainerLoader.active = true;
160 surfaceContainerLoader.active = true;
169 tryCompare(surfaceContainerLoader, "status", Loader.Ready);
161 tryCompare(surfaceContainerLoader, "status", Loader.Ready);
@@ -171,121 +163,6 @@ Rectangle {
172 when: windowShown
164 when: windowShown
174− function test_addChildSession_data() {
175− return [ { tag: "count=1", count: 1 },
176− { tag: "count=4", count: 4 } ];
179− function test_addChildSession(data) {
180− surfaceCheckbox.checked = true;
181− var childSurfaces = testCase.findChild(surfaceContainer, "childSurfacesRepeater");
182− compare(childSurfaces.count, 0);
185− for (i = 0; i < data.count; i++) {
186− surfaceContainer.surface.createPromptSurface();
187− compare(childSurfaces.count, i+1);
190− for (i = data.count-1; i >= 0; i--) {
192− var childPromptSurface = surfaceContainer.surface.promptSurfaceList.get(i);
193− childPromptSurface.close();
195− tryCompareFunction(function() { return childSurfaces.count; }, i);
199− function test_childSessionDestructionReturnsFocusToSiblingOrParent() {
200− surfaceCheckbox.checked = true;
201− var childSurfaces = testCase.findChild(surfaceContainer, "childSurfacesRepeater");
202− compare(childSurfaces.count, 0);
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);
211− for (i = 2; i >= 0; --i) {
212− var childPromptSurface = surfaceContainer.surface.promptSurfaceList.get(i);
213− compare(childPromptSurface.activeFocus, true);
215− childPromptSurface.close();
216− tryCompareFunction(function() { return childSurfaces.count; }, i);
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);
223− // active focus should have gone to the parent surface
224− tryCompare(surfaceContainer.surface, "activeFocus", true);
229− function test_nestedChildSessions_data() {
230− return [ { tag: "depth=2", depth: 2 },
231− { tag: "depth=8", depth: 8 }
234− function test_nestedChildSessions(data) {
235− surfaceCheckbox.checked = true;
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);
247− var childDelegate = childSurfaces.itemAt(0);
248− container = findChild(childDelegate, "surfaceContainer");
250− var animationsLoader = findChild(container, "animationsLoader");
251− tryCompare(animationsLoader, "status", Loader.Ready);
252− waitUntilTransitionsEnd(animationsLoader.item);
254− surface = container.surface;
256− surfaces.push(surface);
257− parent_childSurfaces.push(childSurfaces);
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);
268− function test_childrenAdjustForParentSize() {
269− surfaceCheckbox.checked = true;
271− surfaceContainer.surface.createPromptSurface();
273− var delegate = findChild(surfaceContainer, "childDelegate0");
274− var childContainer = findChild(delegate, "surfaceContainer");
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);
281− surfaceContainer.anchors.margins = units.gu(2);
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);
289 function isContainerAnimating(container) {
166 function isContainerAnimating(container) {
290 var animationsLoader = findChild(container, "animationsLoader");
167 var animationsLoader = findChild(container, "animationsLoader");
291 if (!animationsLoader || animationsLoader.status != Loader.Ready) {
168 if (!animationsLoader || animationsLoader.status != Loader.Ready) {
@@ -303,25 +180,21 @@ Rectangle {
303 return false;
180 return false;
306− function test_childrenAnimate() {
183+ function test_promptSurfaceAnimates() {
184+ promptCheckbox.checked = true;
307 surfaceCheckbox.checked = true;
185 surfaceCheckbox.checked = true;
309− surfaceContainer.surface.createPromptSurface();
311− var delegate = findChild(surfaceContainer, "childDelegate0");
312− var childContainer = findChild(delegate, "surfaceContainer");
314 // wait for animation to begin
187 // wait for animation to begin
315− tryCompareFunction(function() { return isContainerAnimating(childContainer); }, true);
188+ tryCompareFunction(function() { return isContainerAnimating(surfaceContainer); }, true);
316 // wait for animation to end
189 // wait for animation to end
317− tryCompareFunction(function() { return isContainerAnimating(childContainer); }, false);
190+ tryCompareFunction(function() { return isContainerAnimating(surfaceContainer); }, false);
319− surfaceContainer.surface.promptSurfaceList.get(0).close();
192+ surfaceContainer.surface.close();
321 // wait for animation to begin
194 // wait for animation to begin
322− tryCompareFunction(function() { return isContainerAnimating(childContainer); }, true);
195+ tryCompareFunction(function() { return isContainerAnimating(surfaceContainer); }, true);
323 // wait for animation to end
196 // wait for animation to end
324− tryCompareFunction(function() { return isContainerAnimating(childContainer); }, false);
197+ tryCompareFunction(function() { return isContainerAnimating(surfaceContainer); }, false);
327 function test_surfaceItemGetsNoTouchesWhenContainerNotInteractive() {
200 function test_surfaceItemGetsNoTouchesWhenContainerNotInteractive() {