on xenial help sign in
more tests + fixes
26a3077Nick Dedekind
qml/Stages/DesktopStage.qml−1
@@ -23,7 +23,6 @@ import "../Components/PanelState"
23
23
24FocusScope {
24FocusScope {
25 id: root
25 id: root
26− objectName: "desktopShell"
27
26
28 anchors.fill: parent
27 anchors.fill: parent
29
28
qml/Stages/PhoneStage.qml−1
@@ -24,7 +24,6 @@ import "../Components"
24
24
25Rectangle {
25Rectangle {
26 id: root
26 id: root
27− objectName: "phoneShell"
28
27
29 // Controls to be set from outside
28 // Controls to be set from outside
30 property int dragAreaWidth
29 property int dragAreaWidth
qml/Stages/TabletStage.qml+1−1
@@ -23,7 +23,7 @@ import "../Components"
23
23
24Rectangle {
24Rectangle {
25 id: root
25 id: root
26− objectName: "tabletStage"
26+ objectName: "stages"
27 anchors.fill: parent
27 anchors.fill: parent
28 color: "#111111"
28 color: "#111111"
29
29
tests/qmltests/Stages/tst_DesktopStage.qml+36−41
@@ -26,9 +26,9 @@ import "../../../qml/Stages"
26
26
27Rectangle {
27Rectangle {
28 id: root
28 id: root
29− color: "grey"
29+ color: "darkblue"
30− width: units.gu(160)
30+ width: desktopStageLoader.width + controls.width
31− height: units.gu(80)
31+ height: desktopStageLoader.height
32
32
33 Binding {
33 Binding {
34 target: MouseTouchAdaptor
34 target: MouseTouchAdaptor
@@ -45,47 +45,44 @@ Rectangle {
45 }
45 }
46 }
46 }
47
47
48− Row {
49− anchors.fill: parent
50−
51− Loader {
48+ Loader {
52− id: desktopStageLoader
49+ id: desktopStageLoader
53− focus: true
54−
55− width: parent.width - controls.width
50+ x: ((root.width - controls.width) - width) / 2
56− height: parent.height
51+ y: (root.height - height) / 2
57−
52+ width: units.gu(160*0.9)
53+ height: units.gu(100*0.9)
54+
55+ focus: true
56+
58− property bool itemDestroyed: false
57+ property bool itemDestroyed: false
59− sourceComponent: Component {
58+ sourceComponent: Component {
60− DesktopStage {
59+ DesktopStage {
61− anchors.fill: parent
60+ anchors.fill: parent
62− Component.onDestruction: {
61+ Component.onDestruction: {
63− desktopStageLoader.itemDestroyed = true;
62+ desktopStageLoader.itemDestroyed = true;
64− }
65− focus: true
66 }
63 }
64+ focus: true
67 }
65 }
68 }
66 }
67+ }
69
68
70− Rectangle {
69+ Rectangle {
71− id: controls
70+ id: controls
72− color: "darkgrey"
71+ color: "darkgrey"
73− width: units.gu(30)
72+ width: units.gu(30)
74− anchors {
73+ anchors {
75− top: parent.top
74+ top: parent.top
76− bottom: parent.bottom
75+ bottom: parent.bottom
77− }
78−
79− Column {
80− anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
76+ right: parent.right
81− spacing: units.gu(1)
77+ }
82
78
79+ Column {
80+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
81+ spacing: units.gu(1)
83− Repeater {
82+ Repeater {
84− id: appRepeater
85− model: ApplicationManager.availableApplications
83+ model: ApplicationManager.availableApplications
86− ApplicationCheckBox {
84+ ApplicationCheckBox {
87− appId: modelData
85+ appId: modelData
88− }
89 }
86 }
90 }
87 }
91 }
88 }
@@ -99,8 +96,6 @@ Rectangle {
99 property Item desktopStage: desktopStageLoader.status === Loader.Ready ? desktopStageLoader.item : null
96 property Item desktopStage: desktopStageLoader.status === Loader.Ready ? desktopStageLoader.item : null
100
97
101 function init() {
98 function init() {
102− desktopStageLoader.active = true;
103− tryCompare(desktopStageLoader, "status", Loader.Ready);
104 }
99 }
105
100
106 function cleanup() {
101 function cleanup() {
tests/qmltests/tst_Shell.qml+47−30
@@ -34,6 +34,7 @@ import Powerd 0.1
34import Wizard 0.1 as Wizard
34import Wizard 0.1 as Wizard
35
35
36import "../../qml"
36import "../../qml"
37+import "Stages"
37
38
38Rectangle {
39Rectangle {
39 id: root
40 id: root
@@ -102,19 +103,6 @@ Rectangle {
102 GSettingsController.setUsageMode("com.canonical.Unity8", "Staged")
103 GSettingsController.setUsageMode("com.canonical.Unity8", "Staged")
103 }
104 }
104 }
105 }
105− },
106− State {
107− name: "desktop"
108− PropertyChanges {
109− target: shellLoader
110− width: units.gu(100)
111− height: units.gu(71)
112− }
113− StateChangeScript {
114− script: {
115− GSettingsController.setUsageMode("com.canonical.Unity8", "Windowed")
116− }
117− }
118 }
106 }
119 ]
107 ]
120
108
@@ -143,19 +131,16 @@ Rectangle {
143 Column {
131 Column {
144 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
132 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
145 spacing: units.gu(1)
133 spacing: units.gu(1)
146− Row {
147− anchors { left: parent.left; right: parent.right }
148− Button {
134+ Button {
149− text: "Show Greeter"
135+ text: "Show Greeter"
150− activeFocusOnPress: false
136+ activeFocusOnPress: false
151− onClicked: {
137+ onClicked: {
152− if (shellLoader.status !== Loader.Ready)
138+ if (shellLoader.status !== Loader.Ready)
153− return;
139+ return;
154−
140+
155− var greeter = testCase.findChild(shellLoader.item, "greeter");
141+ var greeter = testCase.findChild(shellLoader.item, "greeter");
156− if (!greeter.shown) {
142+ if (!greeter.shown) {
157− LightDM.Greeter.showGreeter();
143+ LightDM.Greeter.showGreeter();
158− }
159 }
144 }
160 }
145 }
161 }
146 }
@@ -175,13 +160,32 @@ Rectangle {
175 anchors { left: parent.left; right: parent.right }
160 anchors { left: parent.left; right: parent.right }
176 activeFocusOnPress: false
161 activeFocusOnPress: false
177 text: "Size"
162 text: "Size"
178− model: ["phone", "tablet", "desktop"]
163+ model: ["phone", "tablet"]
179 onSelectedIndexChanged: {
164 onSelectedIndexChanged: {
180 shellLoader.active = false;
165 shellLoader.active = false;
181 shellLoader.state = model[selectedIndex];
166 shellLoader.state = model[selectedIndex];
182 shellLoader.active = true;
167 shellLoader.active = true;
183 }
168 }
169+ }
184− MouseTouchEmulationCheckbox { color: "white" }
170+ MouseTouchEmulationCheckbox {
171+ id: mouseEmulation
172+ checked: true
173+ color: "white"
174+ }
175+
176+ Column {
177+ anchors { left: parent.left; right: parent.right }
178+ spacing: units.gu(1)
179+
180+ Label { text: "Applications"; font.bold: true }
181+
182+ Repeater {
183+ id: appRepeater
184+ model: ApplicationManager.availableApplications
185+ ApplicationCheckBox {
186+ appId: modelData
187+ }
188+ }
185 }
189 }
186 }
190 }
187 }
191 }
@@ -260,6 +264,7 @@ Rectangle {
260 }
264 }
261
265
262 function cleanup() {
266 function cleanup() {
267+ mouseEmulation.checked = true;
263 tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
268 tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
264 tearDown();
269 tearDown();
265 }
270 }
@@ -1144,8 +1149,7 @@ Rectangle {
1144 loadShell("phone");
1149 loadShell("phone");
1145 swipeAwayGreeter();
1150 swipeAwayGreeter();
1146 AccountsService.backgroundFile = data.accounts;
1151 AccountsService.backgroundFile = data.accounts;
1147− var backgroundSettings = findInvisibleChild(shell, "backgroundSettings");
1152+ GSettingsController.setPictureUri("org.gnome.desktop.background", data.gsettings);
1148− backgroundSettings.pictureUri = data.gsettings;
1149
1153
1150 if (data.output === "defaultBackground") {
1154 if (data.output === "defaultBackground") {
1151 tryCompare(shell, "background", shell.defaultBackground);
1155 tryCompare(shell, "background", shell.defaultBackground);
@@ -1202,5 +1206,18 @@ Rectangle {
1202 tryCompare(passwordInput, "focus", true)
1206 tryCompare(passwordInput, "focus", true)
1203 }
1207 }
1204 }
1208 }
1209+
1210+ function test_stageLoader_data() {
1211+ return [
1212+ {tag: "phone", source: "Stages/PhoneStage.qml"},
1213+ {tag: "tablet", source: "Stages/TabletStage.qml"}
1214+ ]
1215+ }
1216+
1217+ function test_stageLoader(data) {
1218+ loadShell(data.tag);
1219+ var stageLoader = findChild(shell, "applicationsDisplayLoader");
1220+ verify(String(stageLoader.source).indexOf(data.source) >= 0);
1221+ }
1205 }
1222 }
1206}
1223}
tests/utils/modules/Unity/Test/MouseTouchEmulationCheckbox.qml+1
@@ -22,6 +22,7 @@ import Unity.Test 0.1
22RowLayout {
22RowLayout {
23 id: root
23 id: root
24 property alias color: label.color
24 property alias color: label.color
25+ property alias checked: checkbox.checked
25
26
26 Binding {
27 Binding {
27 target: MouseTouchAdaptor
28 target: MouseTouchAdaptor