on xenial help sign in
more tests + fixes
commit26a30774b61d07e110823bbe05b49f7acce3778d authorNick Dedekind <nick.dedekind@canonical.com> dateMon 13 Apr 2015, 14:12 (12 years ago) parentcc5cf35
6 files changed+85−74
qml/Stages/DesktopStage.qml−1 qml/Stages/PhoneStage.qml−1 qml/Stages/TabletStage.qml+1−1 tests/qmltests/Stages/tst_DesktopStage.qml+36−41 tests/qmltests/tst_Shell.qml+47−30 tests/utils/modules/Unity/Test/MouseTouchEmulationCheckbox.qml+1
qml/Stages/DesktopStage.qml−1
@@ -23,7 +23,6 @@ import "../Components/PanelState"
2323
2424FocusScope {
2525 id: root
26− objectName: "desktopShell"
2726
2827 anchors.fill: parent
2928
qml/Stages/PhoneStage.qml−1
@@ -24,7 +24,6 @@ import "../Components"
2424
2525Rectangle {
2626 id: root
27− objectName: "phoneShell"
2827
2928 // Controls to be set from outside
3029 property int dragAreaWidth
qml/Stages/TabletStage.qml+1−1
@@ -23,7 +23,7 @@ import "../Components"
2323
2424Rectangle {
2525 id: root
26− objectName: "tabletStage"
26+ objectName: "stages"
2727 anchors.fill: parent
2828 color: "#111111"
2929
tests/qmltests/Stages/tst_DesktopStage.qml+36−41
@@ -26,9 +26,9 @@ import "../../../qml/Stages"
2626
2727Rectangle {
2828 id: root
29− color: "grey"
30− width: units.gu(160)
31− height: units.gu(80)
29+ color: "darkblue"
30+ width: desktopStageLoader.width + controls.width
31+ height: desktopStageLoader.height
3232
3333 Binding {
3434 target: MouseTouchAdaptor
@@ -45,47 +45,44 @@ Rectangle {
4545 }
4646 }
4747
48− Row {
49− anchors.fill: parent
50−
51− Loader {
52− id: desktopStageLoader
53− focus: true
54−
55− width: parent.width - controls.width
56− height: parent.height
57−
58− property bool itemDestroyed: false
59− sourceComponent: Component {
60− DesktopStage {
61− anchors.fill: parent
62− Component.onDestruction: {
63− desktopStageLoader.itemDestroyed = true;
64− }
65− focus: true
48+ Loader {
49+ id: desktopStageLoader
50+ x: ((root.width - controls.width) - width) / 2
51+ y: (root.height - height) / 2
52+ width: units.gu(160*0.9)
53+ height: units.gu(100*0.9)
54+
55+ focus: true
56+
57+ property bool itemDestroyed: false
58+ sourceComponent: Component {
59+ DesktopStage {
60+ anchors.fill: parent
61+ Component.onDestruction: {
62+ desktopStageLoader.itemDestroyed = true;
6663 }
64+ focus: true
6765 }
6866 }
67+ }
6968
70− Rectangle {
71− id: controls
72− color: "darkgrey"
73− width: units.gu(30)
74− anchors {
75− top: parent.top
76− bottom: parent.bottom
77− }
78−
79− Column {
80− anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
81− spacing: units.gu(1)
69+ Rectangle {
70+ id: controls
71+ color: "darkgrey"
72+ width: units.gu(30)
73+ anchors {
74+ top: parent.top
75+ bottom: parent.bottom
76+ right: parent.right
77+ }
8278
83− Repeater {
84− id: appRepeater
85− model: ApplicationManager.availableApplications
86− ApplicationCheckBox {
87− appId: modelData
88− }
79+ Column {
80+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
81+ spacing: units.gu(1)
82+ Repeater {
83+ model: ApplicationManager.availableApplications
84+ ApplicationCheckBox {
85+ appId: modelData
8986 }
9087 }
9188 }
@@ -99,8 +96,6 @@ Rectangle {
9996 property Item desktopStage: desktopStageLoader.status === Loader.Ready ? desktopStageLoader.item : null
10097
10198 function init() {
102− desktopStageLoader.active = true;
103− tryCompare(desktopStageLoader, "status", Loader.Ready);
10499 }
105100
106101 function cleanup() {
tests/qmltests/tst_Shell.qml+47−30
@@ -34,6 +34,7 @@ import Powerd 0.1
3434import Wizard 0.1 as Wizard
3535
3636import "../../qml"
37+import "Stages"
3738
3839Rectangle {
3940 id: root
@@ -102,19 +103,6 @@ Rectangle {
102103 GSettingsController.setUsageMode("com.canonical.Unity8", "Staged")
103104 }
104105 }
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− }
118106 }
119107 ]
120108
@@ -143,19 +131,16 @@ Rectangle {
143131 Column {
144132 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
145133 spacing: units.gu(1)
146− Row {
147− anchors { left: parent.left; right: parent.right }
148− Button {
149− text: "Show Greeter"
150− activeFocusOnPress: false
151− onClicked: {
152− if (shellLoader.status !== Loader.Ready)
153− return;
154−
155− var greeter = testCase.findChild(shellLoader.item, "greeter");
156− if (!greeter.shown) {
157− LightDM.Greeter.showGreeter();
158− }
134+ Button {
135+ text: "Show Greeter"
136+ activeFocusOnPress: false
137+ onClicked: {
138+ if (shellLoader.status !== Loader.Ready)
139+ return;
140+
141+ var greeter = testCase.findChild(shellLoader.item, "greeter");
142+ if (!greeter.shown) {
143+ LightDM.Greeter.showGreeter();
159144 }
160145 }
161146 }
@@ -175,13 +160,32 @@ Rectangle {
175160 anchors { left: parent.left; right: parent.right }
176161 activeFocusOnPress: false
177162 text: "Size"
178− model: ["phone", "tablet", "desktop"]
163+ model: ["phone", "tablet"]
179164 onSelectedIndexChanged: {
180165 shellLoader.active = false;
181166 shellLoader.state = model[selectedIndex];
182167 shellLoader.active = true;
183168 }
184− MouseTouchEmulationCheckbox { color: "white" }
169+ }
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+ }
185189 }
186190 }
187191 }
@@ -260,6 +264,7 @@ Rectangle {
260264 }
261265
262266 function cleanup() {
267+ mouseEmulation.checked = true;
263268 tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
264269 tearDown();
265270 }
@@ -1144,8 +1149,7 @@ Rectangle {
11441149 loadShell("phone");
11451150 swipeAwayGreeter();
11461151 AccountsService.backgroundFile = data.accounts;
1147− var backgroundSettings = findInvisibleChild(shell, "backgroundSettings");
1148− backgroundSettings.pictureUri = data.gsettings;
1152+ GSettingsController.setPictureUri("org.gnome.desktop.background", data.gsettings);
11491153
11501154 if (data.output === "defaultBackground") {
11511155 tryCompare(shell, "background", shell.defaultBackground);
@@ -1202,5 +1206,18 @@ Rectangle {
12021206 tryCompare(passwordInput, "focus", true)
12031207 }
12041208 }
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+ }
12051222 }
12061223}
tests/utils/modules/Unity/Test/MouseTouchEmulationCheckbox.qml+1
@@ -22,6 +22,7 @@ import Unity.Test 0.1
2222RowLayout {
2323 id: root
2424 property alias color: label.color
25+ property alias checked: checkbox.checked
2526
2627 Binding {
2728 target: MouseTouchAdaptor