@@ -28,7 +28,12 @@ ColumnLayout {
2828
2929 property var screenshotIds: [ "gallery", "map", "facebook", "camera", "browser", "music", "twitter"]
3030
31+ onSessionChanged: {
32+ if (!session) surfaceCheckbox.checked = false;
33+ }
34+
3135 Column {
36+ id: column
3237 Layout.fillWidth: true
3338 visible: repeater.count
3439 spacing: units.gu(1)
@@ -42,8 +47,8 @@ ColumnLayout {
4247 width: 1
4348 }
4449 anchors {
45− left: parent.left
46− right: parent.right
50+ left: column.left
51+ right: column.right
4752 leftMargin: units.gu(1)
4853 rightMargin: units.gu(1)
4954 }
@@ -73,23 +78,53 @@ ColumnLayout {
7378 }
7479 }
7580
76− Item {
81+ ColumnLayout {
7782 Layout.fillWidth: true
78− Layout.preferredHeight: buttonLayout.height + units.gu(1)
83+ spacing: units.gu(1)
7984
8085 RowLayout {
81− id: buttonLayout
82− anchors {
83− top: parent.top; topMargin: units.gu(0.5)
84− left: parent.left; leftMargin: units.gu(1)
86+ Layout.fillWidth: true
87+
88+ CheckBox {
89+ id: surfaceCheckbox;
90+ checked: false;
91+ enabled: root.session
92+ onClicked: {
93+ if (checked) {
94+ root.session.createSurface();
95+ } else if (root.session.surface) {
96+ root.session.surface.removed();
97+ }
98+ }
99+
100+ Connections {
101+ target: root.session ? root.session : null
102+ onSurfaceChanged: {
103+ surfaceCheckbox.checked = root.session.surface !== null
104+ }
105+ }
85106 }
86107
108+ Label {
109+ text: "surface"
110+ anchors.verticalCenter: parent.verticalCenter
111+ }
112+ }
113+
114+ RowLayout {
115+ id: buttonLayout
116+
87117 Button {
88118 enabled: root.session
89119 text: removable ? "Remove" : "Release"
90120 onClicked: {
91− if (removable) root.session.removed();
92− else root.session.release();
121+ if (removable) {
122+ // release the surface first. simulates mir app closing
123+ if (root.session.surface) root.session.surface.removed();
124+ root.session.removed();
125+ } else {
126+ root.session.release();
127+ }
93128 }
94129 }
95130
@@ -97,8 +132,7 @@ ColumnLayout {
97132 enabled: root.session !== null
98133 text: "Add Child"
99134 onClicked: {
100− var screenshot = Math.round(Math.random() * screenshotIds.length);
101− console.log(screenshot)
135+ var screenshot = Math.round(Math.random()*100 % (screenshotIds.length-1));
102136 var session = ApplicationTest.addChildSession(root.session, root.screenshotIds[screenshot]);
103137 }
104138 }