on xenial help sign in
Fix tst_OrientedShell
bc93086Daniel d'Andrada
qml/OrientedShell.qml+1
@@ -135,6 +135,7 @@ Rectangle {
135 nativeOrientation: root.nativeOrientation
135 nativeOrientation: root.nativeOrientation
136 nativeWidth: root.width
136 nativeWidth: root.width
137 nativeHeight: root.height
137 nativeHeight: root.height
138+ mode: applicationArguments.mode
138
139
139 // TODO: Factor in the connected input devices (eg: physical keyboard, mouse, touchscreen),
140 // TODO: Factor in the connected input devices (eg: physical keyboard, mouse, touchscreen),
140 // what's the output device (eg: big TV, desktop monitor, phone display), etc.
141 // what's the output device (eg: big TV, desktop monitor, phone display), etc.
qml/Shell.qml+13−15
@@ -55,6 +55,7 @@ Item {
55 property alias indicatorAreaShowProgress: panel.indicatorAreaShowProgress
55 property alias indicatorAreaShowProgress: panel.indicatorAreaShowProgress
56 property bool beingResized
56 property bool beingResized
57 property string usageScenario: "phone" // supported values: "phone", "tablet" or "desktop"
57 property string usageScenario: "phone" // supported values: "phone", "tablet" or "desktop"
58+ property string mode: "full-greeter"
58 function updateFocusedAppOrientation() {
59 function updateFocusedAppOrientation() {
59 applicationsDisplayLoader.item.updateFocusedAppOrientation();
60 applicationsDisplayLoader.item.updateFocusedAppOrientation();
60 }
61 }
@@ -68,9 +69,9 @@ Item {
68
69
69 readonly property bool orientationChangesEnabled: panel.indicators.fullyClosed
70 readonly property bool orientationChangesEnabled: panel.indicators.fullyClosed
70 && (applicationsDisplayLoader.item && applicationsDisplayLoader.item.orientationChangesEnabled)
71 && (applicationsDisplayLoader.item && applicationsDisplayLoader.item.orientationChangesEnabled)
71− && !greeter.animating
72+ && (!greeter || !greeter.animating)
72
73
73− readonly property bool showingGreeter: greeter.shown
74+ readonly property bool showingGreeter: greeter && greeter.shown
74
75
75 property bool startingUp: true
76 property bool startingUp: true
76 Timer { id: finishStartUpTimer; interval: 500; onTriggered: startingUp = false }
77 Timer { id: finishStartUpTimer; interval: 500; onTriggered: startingUp = false }
@@ -79,7 +80,7 @@ Item {
79 if (startingUp) {
80 if (startingUp) {
80 // Ensure we don't rotate during start up
81 // Ensure we don't rotate during start up
81 return Qt.PrimaryOrientation;
82 return Qt.PrimaryOrientation;
82− } else if (greeter.shown) {
83+ } else if (greeter && greeter.shown) {
83 return Qt.PrimaryOrientation;
84 return Qt.PrimaryOrientation;
84 } else if (mainApp) {
85 } else if (mainApp) {
85 return mainApp.supportedOrientations;
86 return mainApp.supportedOrientations;
@@ -101,16 +102,13 @@ Item {
101
102
102 // Disable everything while greeter is waiting, so that the user can't swipe
103 // Disable everything while greeter is waiting, so that the user can't swipe
103 // the greeter or launcher until we know whether the session is locked.
104 // the greeter or launcher until we know whether the session is locked.
104− enabled: !greeter.waiting
105+ enabled: greeter && !greeter.waiting
105
106
106 property real edgeSize: units.gu(2)
107 property real edgeSize: units.gu(2)
107 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg")
108 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg")
108 property url background: asImageTester.status == Image.Ready ? asImageTester.source
109 property url background: asImageTester.status == Image.Ready ? asImageTester.source
109 : gsImageTester.status == Image.Ready ? gsImageTester.source : defaultBackground
110 : gsImageTester.status == Image.Ready ? gsImageTester.source : defaultBackground
110
111
111− // This is _only_ used to expose the property to autopilot tests
112− readonly property string testShellMode: shellMode
113−
114 readonly property alias greeter: greeterLoader.item
112 readonly property alias greeter: greeterLoader.item
115
113
116 function activateApplication(appId) {
114 function activateApplication(appId) {
@@ -264,7 +262,7 @@ Item {
264 ? "phone"
262 ? "phone"
265 : shell.usageScenario
263 : shell.usageScenario
266 source: {
264 source: {
267− if(shellMode === "greeter") {
265+ if(shell.mode === "greeter") {
268 return "Stages/ShimStage.qml"
266 return "Stages/ShimStage.qml"
269 } else if (applicationsDisplayLoader.usageScenario === "phone") {
267 } else if (applicationsDisplayLoader.usageScenario === "phone") {
270 return "Stages/PhoneStage.qml";
268 return "Stages/PhoneStage.qml";
@@ -276,7 +274,7 @@ Item {
276 }
274 }
277
275
278 property bool interactive: tutorial.spreadEnabled
276 property bool interactive: tutorial.spreadEnabled
279− && !greeter.shown
277+ && (!greeter || !greeter.shown)
280 && panel.indicators.fullyClosed
278 && panel.indicators.fullyClosed
281 && launcher.progress == 0
279 && launcher.progress == 0
282 && !notifications.useModal
280 && !notifications.useModal
@@ -307,12 +305,12 @@ Item {
307 Binding {
305 Binding {
308 target: applicationsDisplayLoader.item
306 target: applicationsDisplayLoader.item
309 property: "spreadEnabled"
307 property: "spreadEnabled"
310− value: tutorial.spreadEnabled && !greeter.hasLockedApp
308+ value: tutorial.spreadEnabled && (!greeter || !greeter.hasLockedApp)
311 }
309 }
312 Binding {
310 Binding {
313 target: applicationsDisplayLoader.item
311 target: applicationsDisplayLoader.item
314 property: "inverseProgress"
312 property: "inverseProgress"
315− value: greeter.locked ? 0 : launcher.progress
313+ value: greeter && greeter.locked ? 0 : launcher.progress
316 }
314 }
317 Binding {
315 Binding {
318 target: applicationsDisplayLoader.item
316 target: applicationsDisplayLoader.item
@@ -422,7 +420,7 @@ Item {
422 id: greeterLoader
420 id: greeterLoader
423 anchors.fill: parent
421 anchors.fill: parent
424 anchors.topMargin: panel.panelHeight
422 anchors.topMargin: panel.panelHeight
425− sourceComponent: shellMode != "shell" ? integratedGreeter :
423+ sourceComponent: shell.mode != "shell" ? integratedGreeter :
426 Qt.createComponent(Qt.resolvedUrl("Greeter/ShimGreeter.qml"));
424 Qt.createComponent(Qt.resolvedUrl("Greeter/ShimGreeter.qml"));
427 onLoaded: {
425 onLoaded: {
428 item.objectName = "greeter"
426 item.objectName = "greeter"
@@ -434,7 +432,7 @@ Item {
434 Greeter {
432 Greeter {
435
433
436 hides: [launcher, panel.indicators]
434 hides: [launcher, panel.indicators]
437− tabletMode: shell.sideStageEnabled
435+ tabletMode: shell.usageScenario != "phone"
438 launcherOffset: launcher.progress
436 launcherOffset: launcher.progress
439 forcedUnlock: tutorial.running
437 forcedUnlock: tutorial.running
440 background: shell.background
438 background: shell.background
@@ -550,8 +548,8 @@ Item {
550 indicators {
548 indicators {
551 hides: [launcher]
549 hides: [launcher]
552 available: tutorial.panelEnabled
550 available: tutorial.panelEnabled
553− && (!greeter.locked || AccountsService.enableIndicatorsWhileLocked)
551+ && ((!greeter || !greeter.locked) || AccountsService.enableIndicatorsWhileLocked)
554− && !greeter.hasLockedApp
552+ && (!greeter || !greeter.hasLockedApp)
555 contentEnabled: tutorial.panelContentEnabled
553 contentEnabled: tutorial.panelContentEnabled
556 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
554 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
557
555
src/ApplicationArguments.h+5
@@ -27,14 +27,19 @@ class ApplicationArguments : public QObject
27{
27{
28 Q_OBJECT
28 Q_OBJECT
29 Q_PROPERTY(QString deviceName READ deviceName CONSTANT)
29 Q_PROPERTY(QString deviceName READ deviceName CONSTANT)
30+ Q_PROPERTY(QString mode READ mode CONSTANT)
30public:
31public:
31 ApplicationArguments(QObject *parent = nullptr);
32 ApplicationArguments(QObject *parent = nullptr);
32
33
33 void setDeviceName(QString deviceName) { m_deviceName = deviceName; }
34 void setDeviceName(QString deviceName) { m_deviceName = deviceName; }
34 QString deviceName() const { return m_deviceName; }
35 QString deviceName() const { return m_deviceName; }
35
36
37+ void setMode(QString mode) { m_mode = mode; }
38+ QString mode() const { return m_mode; }
39+
36private:
40private:
37 QString m_deviceName;
41 QString m_deviceName;
42+ QString m_mode;
38};
43};
39
44
40#endif // APPLICATION_ARGUMENTS_H
45#endif // APPLICATION_ARGUMENTS_H
src/main.cpp+2−1
@@ -60,6 +60,8 @@ int main(int argc, const char *argv[])
60 qmlArgs.setDeviceName(QString(buffer));
60 qmlArgs.setDeviceName(QString(buffer));
61 }
61 }
62
62
63+ qmlArgs.setMode(parser.mode());
64+
63 // The testability driver is only loaded by QApplication but not by QGuiApplication.
65 // The testability driver is only loaded by QApplication but not by QGuiApplication.
64 // However, QApplication depends on QWidget which would add some unneeded overhead => Let's load the testability driver on our own.
66 // However, QApplication depends on QWidget which would add some unneeded overhead => Let's load the testability driver on our own.
65 if (parser.hasTestability() || getenv("QT_LOAD_TESTABILITY")) {
67 if (parser.hasTestability() || getenv("QT_LOAD_TESTABILITY")) {
@@ -92,7 +94,6 @@ int main(int argc, const char *argv[])
92
94
93 view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()));
95 view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()));
94 view->rootContext()->setContextProperty("applicationArguments", &qmlArgs);
96 view->rootContext()->setContextProperty("applicationArguments", &qmlArgs);
95− view->rootContext()->setContextProperty("shellMode", parser.mode());
96 if (parser.hasFrameless()) {
97 if (parser.hasFrameless()) {
97 view->setFlags(Qt::FramelessWindowHint);
98 view->setFlags(Qt::FramelessWindowHint);
98 }
99 }
tests/autopilot/unity8/greeter/tests/test_args.py+6−6
@@ -28,27 +28,27 @@ class GreeterArgsTest(GreeterTestCase):
28 def test_full_greeter_mode(self):
28 def test_full_greeter_mode(self):
29 unity_proxy = self.launch_unity(mode='full-greeter')
29 unity_proxy = self.launch_unity(mode='full-greeter')
30 shell = self.get_shell(unity_proxy)
30 shell = self.get_shell(unity_proxy)
31− self.assertTrue(shell.testShellMode == 'full-greeter')
31+ self.assertTrue(shell.mode == 'full-greeter')
32
32
33 def test_full_shell_mode(self):
33 def test_full_shell_mode(self):
34 unity_proxy = self.launch_unity(mode='full-shell')
34 unity_proxy = self.launch_unity(mode='full-shell')
35 shell = self.get_shell(unity_proxy)
35 shell = self.get_shell(unity_proxy)
36− self.assertTrue(shell.testShellMode == 'full-shell')
36+ self.assertTrue(shell.mode == 'full-shell')
37
37
38 def test_greeter_mode(self):
38 def test_greeter_mode(self):
39 unity_proxy = self.launch_unity(mode='greeter')
39 unity_proxy = self.launch_unity(mode='greeter')
40 shell = self.get_shell(unity_proxy)
40 shell = self.get_shell(unity_proxy)
41− self.assertTrue(shell.testShellMode == 'greeter')
41+ self.assertTrue(shell.mode == 'greeter')
42
42
43 def test_nonexistent_mode(self):
43 def test_nonexistent_mode(self):
44 unity_proxy = self.launch_unity(mode=self.NONEXISTENT_MODE)
44 unity_proxy = self.launch_unity(mode=self.NONEXISTENT_MODE)
45 shell = self.get_shell(unity_proxy)
45 shell = self.get_shell(unity_proxy)
46− self.assertTrue(shell.testShellMode == self.DEFAULT_SHELL_MODE,
46+ self.assertTrue(shell.mode == self.DEFAULT_SHELL_MODE,
47 "Shell mode was {} but should have been {}"
47 "Shell mode was {} but should have been {}"
48− .format(shell.testShellMode,
48+ .format(shell.mode,
49 self.DEFAULT_SHELL_MODE))
49 self.DEFAULT_SHELL_MODE))
50
50
51 def test_shell_mode(self):
51 def test_shell_mode(self):
52 unity_proxy = self.launch_unity(mode='shell')
52 unity_proxy = self.launch_unity(mode='shell')
53 shell = self.get_shell(unity_proxy)
53 shell = self.get_shell(unity_proxy)
54− self.assertTrue(shell.testShellMode == 'shell')
54+ self.assertTrue(shell.mode == 'shell')
tests/qmltests/Tutorial/tst_Tutorial.qml−1
@@ -73,7 +73,6 @@ Item {
73 sourceComponent: Component {
73 sourceComponent: Component {
74 Shell {
74 Shell {
75 property string indicatorProfile: "phone"
75 property string indicatorProfile: "phone"
76− property string shellMode: "full-greeter" /* default */
77
76
78 Component.onDestruction: {
77 Component.onDestruction: {
79 shellLoader.itemDestroyed = true;
78 shellLoader.itemDestroyed = true;
tests/qmltests/tst_OrientedShell.qml+1−12
@@ -34,19 +34,8 @@ Rectangle {
34
34
35 QtObject {
35 QtObject {
36 id: applicationArguments
36 id: applicationArguments
37−
38− function hasGeometry() {
39− return false;
40− }
41−
42− function width() {
43− return 0;
44− }
45−
46− function height() {
47− return 0;
48− }
49 property string deviceName: "mako"
37 property string deviceName: "mako"
38+ property string mode: "full-greeter"
50 }
39 }
51
40
52 QtObject {
41 QtObject {
tests/qmltests/tst_Shell.qml−2
@@ -81,8 +81,6 @@ Rectangle {
81 property bool itemDestroyed: false
81 property bool itemDestroyed: false
82 sourceComponent: Component {
82 sourceComponent: Component {
83 Shell {
83 Shell {
84− property string shellMode: "full-greeter" /* default */
85−
86 usageScenario: usageScenarioSelector.model[usageScenarioSelector.selectedIndex]
84 usageScenario: usageScenarioSelector.model[usageScenarioSelector.selectedIndex]
87 orientation: Qt.PortraitOrientation
85 orientation: Qt.PortraitOrientation
88 primaryOrientation: Qt.PortraitOrientation
86 primaryOrientation: Qt.PortraitOrientation
tests/qmltests/tst_ShellWithPin.qml−2
@@ -69,8 +69,6 @@ Item {
69 property bool itemDestroyed: false
69 property bool itemDestroyed: false
70 sourceComponent: Component {
70 sourceComponent: Component {
71 Shell {
71 Shell {
72− property string shellMode: "full-greeter" /* default */
73−
74 Component.onDestruction: {
72 Component.onDestruction: {
75 shellLoader.itemDestroyed = true
73 shellLoader.itemDestroyed = true
76 }
74 }