on xenial help sign in
Disable the tutorial when there's no touchscreen (LP: #1661557)

Approved by: Michał Sawicz, Unity8 CI Bot

commit73a64d580518be83ecff389ee6dc976cd8853989 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 8 Mar 2017, 09:50 (10 years ago) parentfd94369ecc2d91
6 files changed+19−3
qml/OrientedShell.qml+1−1 qml/Shell.qml+3−2 tests/qmltests/Tutorial/tst_Tutorial.qml+1 tests/qmltests/tst_OrientedShell.qml+12 tests/qmltests/tst_Shell.qml+1 tests/qmltests/tst_ShellWithPin.qml+1
qml/OrientedShell.qml+1−1
@@ -274,7 +274,7 @@ Item {
274274 mode: applicationArguments.mode
275275 hasMouse: pointerInputDevices > 0
276276 hasKeyboard: keyboardsModel.count > 0
277−
277+ hasTouchscreen: touchScreensModel.count > 0
278278 oskEnabled: unity8Settings.alwaysShowOsk || !hasKeyboard || forceOSKEnabled
279279
280280 usageScenario: {
qml/Shell.qml+3−2
@@ -69,6 +69,7 @@ StyledItem {
6969 }
7070 property bool hasMouse: false
7171 property bool hasKeyboard: false
72+ property bool hasTouchscreen: false
7273
7374 // to be read from outside
7475 readonly property int mainAppWindowOrientationAngle: stage.mainAppWindowOrientationAngle
@@ -628,8 +629,8 @@ StyledItem {
628629 objectName: "tutorial"
629630 anchors.fill: parent
630631
631− paused: callManager.hasCalls || !greeter || greeter.active ||
632− wizard.active
632+ paused: callManager.hasCalls || !greeter || greeter.active || wizard.active
633+ || !hasTouchscreen // TODO #1661557 something better for no touchscreen
633634 delayed: dialogs.hasActiveDialog || notifications.hasNotification ||
634635 inputMethod.visible ||
635636 (launcher.shown && !launcher.lockedVisible) ||
tests/qmltests/Tutorial/tst_Tutorial.qml+1
@@ -149,6 +149,7 @@ Rectangle {
149149 native_: shellLoader.nativeOrientation
150150 primary: shellLoader.primaryOrientation
151151 }
152+ hasTouchscreen: true
152153
153154 Component.onDestruction: {
154155 shellLoader.itemDestroyed = true;
tests/qmltests/tst_OrientedShell.qml+12
@@ -1641,5 +1641,17 @@ Rectangle {
16411641 tryCompare(dialogLoader, "item", null);
16421642 compare(window.activeFocusItem, surfaceItem);
16431643 }
1644+
1645+ function test_tutorialDisabledWithNoTouchscreen() {
1646+ loadShell("desktop");
1647+ usageModeSelector.selectWindowed();
1648+
1649+ MockInputDeviceBackend.addMockDevice("/touchscreen", InputInfo.TouchScreen);
1650+ var tutorial = findChild(shell, "tutorial");
1651+ tryCompare(tutorial, "paused", false);
1652+
1653+ MockInputDeviceBackend.removeDevice("/touchscreen");
1654+ tryCompare(tutorial, "paused", true);
1655+ }
16441656 }
16451657}
tests/qmltests/tst_Shell.qml+1
@@ -137,6 +137,7 @@ Rectangle {
137137 primary: shellLoader.primaryOrientation
138138 }
139139 mode: shellLoader.mode
140+ hasTouchscreen: true
140141 Component.onCompleted: {
141142 ApplicationManager.startApplication("unity8-dash");
142143 }
tests/qmltests/tst_ShellWithPin.qml+1
@@ -69,6 +69,7 @@ Item {
6969 property bool itemDestroyed: false
7070 sourceComponent: Component {
7171 Shell {
72+ hasTouchscreen: true
7273 Component.onDestruction: {
7374 shellLoader.itemDestroyed = true
7475 }