on xenial help sign in
disable tutorial when there's no touch screen
commitbb7455336a41ee36f823af8a8d34aa501a86eb1f authorLukáš Tinkl <lukas.tinkl@canonical.com> dateFri 3 Feb 2017, 12:39 (10 years ago) parent0fb8d86
3 files changed+16
qml/OrientedShell.qml+1 qml/Shell.qml+3 tests/qmltests/tst_OrientedShell.qml+12
qml/OrientedShell.qml+1
@@ -268,6 +268,7 @@ Item {
268268 mode: applicationArguments.mode
269269 hasMouse: pointerInputDevices > 0
270270 hasKeyboard: keyboardsModel.count > 0
271+ hasTouchscreen: touchScreensModel.count > 0
271272 // TODO: Factor in if the current screen is a touch screen and if the user wants to
272273 // have multiple keyboards around. For now we only enable one keyboard at a time
273274 // thus hiding it here if there is a physical one around or if we have a second
qml/Shell.qml+3
@@ -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
@@ -625,6 +626,8 @@ StyledItem {
625626 objectName: "tutorial"
626627 anchors.fill: parent
627628
629+ enabled: shell.hasTouchscreen
630+ visible: enabled
628631 paused: callManager.hasCalls || !greeter || greeter.active ||
629632 wizard.active
630633 delayed: dialogs.hasActiveDialog || notifications.hasNotification ||
tests/qmltests/tst_OrientedShell.qml+12
@@ -1640,5 +1640,17 @@ Rectangle {
16401640 tryCompare(dialogLoader, "item", null);
16411641 compare(window.activeFocusItem, surfaceItem);
16421642 }
1643+
1644+ function test_tutorialDisabledWithNoTouchscreen() {
1645+ loadShell("desktop");
1646+ usageModeSelector.selectWindowed();
1647+
1648+ MockInputDeviceBackend.addMockDevice("/touchscreen", InputInfo.TouchScreen);
1649+ var tutorial = findChild(shell, "tutorial");
1650+ tryCompare(tutorial, "enabled", true);
1651+
1652+ MockInputDeviceBackend.removeDevice("/touchscreen");
1653+ tryCompare(tutorial, "enabled", false);
1654+ }
16431655 }
16441656}