on xenial help sign in
mock the virtual touchpad settings so tests run more predictable
cca04a3Michael Zanetti
qml/Components/VirtualTouchPad.qml+6−7
@@ -30,7 +30,7 @@ Item {
30 }
30 }
31
31
32 Component.onCompleted: {
32 Component.onCompleted: {
33− if (!inputMethodState.touchpadTutorialHasRun) {
33+ if (!settings.touchpadTutorialHasRun) {
34 root.runTutorial()
34 root.runTutorial()
35 }
35 }
36 }
36 }
@@ -57,9 +57,8 @@ Item {
57
57
58 readonly property bool pressed: point1.pressed || point2.pressed || leftButton.pressed || rightButton.pressed
58 readonly property bool pressed: point1.pressed || point2.pressed || leftButton.pressed || rightButton.pressed
59
59
60− Settings {
60+ property var settings: Settings {
61− id: inputMethodState
61+ objectName: "virtualTouchPadSettings"
62− objectName: "inputMethodState"
63 property bool touchpadTutorialHasRun: false
62 property bool touchpadTutorialHasRun: false
64 property bool oskEnabled: true
63 property bool oskEnabled: true
65 }
64 }
@@ -224,7 +223,7 @@ Item {
224 width: height
223 width: height
225
224
226 onClicked: {
225 onClicked: {
227− inputMethodState.oskEnabled = !inputMethodState.oskEnabled
226+ settings.oskEnabled = !settings.oskEnabled
228 }
227 }
229
228
230 Rectangle {
229 Rectangle {
@@ -247,7 +246,7 @@ Item {
247 InputMethod {
246 InputMethod {
248 id: inputMethod
247 id: inputMethod
249 // Don't resize when there is only one screen to avoid resize clashing with the InputMethod in the Shell.
248 // Don't resize when there is only one screen to avoid resize clashing with the InputMethod in the Shell.
250− enabled: screens.count > 1 && inputMethodState.oskEnabled && !tutorial.running
249+ enabled: screens.count > 1 && settings.oskEnabled && !tutorial.running
251 objectName: "inputMethod"
250 objectName: "inputMethod"
252 anchors.fill: parent
251 anchors.fill: parent
253 }
252 }
@@ -402,6 +401,6 @@ Item {
402 UbuntuNumberAnimation { target: oskButton; property: "opacity"; to: 1 }
401 UbuntuNumberAnimation { target: oskButton; property: "opacity"; to: 1 }
403 PropertyAction { targets: [leftButton, rightButton, oskButton]; property: "enabled"; value: true }
402 PropertyAction { targets: [leftButton, rightButton, oskButton]; property: "enabled"; value: true }
404
403
405− PropertyAction { target: inputMethodState; property: "touchpadTutorialHasRun"; value: true }
404+ PropertyAction { target: settings; property: "touchpadTutorialHasRun"; value: true }
406 }
405 }
407}
406}
tests/qmltests/Components/tst_VirtualTouchPad.qml+4
@@ -31,6 +31,10 @@ Rectangle {
31 id: touchScreenPad
31 id: touchScreenPad
32 anchors.fill: parent
32 anchors.fill: parent
33 property int internalGu: units.gu(1)
33 property int internalGu: units.gu(1)
34+ settings: QtObject {
35+ property bool touchpadTutorialHasRun: true
36+ property bool oskEnabled: true
37+ }
34 }
38 }
35
39
36 SignalSpy {
40 SignalSpy {
tests/qmltests/tst_DisabledScreenNotice.qml+1−1
@@ -81,7 +81,7 @@ Item {
81 Button {
81 Button {
82 text: "Reset first run settings"
82 text: "Reset first run settings"
83 onClicked: {
83 onClicked: {
84− var settings = testCase.findInvisibleChild(touchScreenPad, "inputMethodState");
84+ var settings = testCase.findInvisibleChild(touchScreenPad, "virtualTouchPadSettings");
85 settings.touchpadTutorialHasRun = false;
85 settings.touchpadTutorialHasRun = false;
86 }
86 }
87 }
87 }