on xenial help sign in
Added Mouse and KB controls
2fc9b0aNick Dedekind
tests/qmltests/tst_ShellApplication.qml+50
@@ -20,6 +20,7 @@ import LightDM.FullLightDM 0.1 as LightDM
20import LightDMController 0.1
20import LightDMController 0.1
21import Unity.Application 0.1
21import Unity.Application 0.1
22import Unity.Test 0.1
22import Unity.Test 0.1
23+import Unity.InputInfo 0.1
23
24
24import "../../qml"
25import "../../qml"
25import "../../qml/Components"
26import "../../qml/Components"
@@ -85,6 +86,23 @@ Rectangle {
85 }
86 }
86 }
87 }
87 }
88 }
89+ Button {
90+ anchors {
91+ left: parent.left
92+ right: parent.right
93+ }
94+ action: addMouseAction
95+ color: addMouseAction.checked ? UbuntuColors.red : UbuntuColors.green
96+ }
97+
98+ Button {
99+ anchors {
100+ left: parent.left
101+ right: parent.right
102+ }
103+ action: addKBAction
104+ color: addKBAction.checked ? UbuntuColors.red : UbuntuColors.green
105+ }
88
106
89 MouseTouchEmulationCheckbox {
107 MouseTouchEmulationCheckbox {
90 id: mouseEmulation
108 id: mouseEmulation
@@ -157,6 +175,38 @@ Rectangle {
157 }
175 }
158 }
176 }
159
177
178+ Action {
179+ id: addMouseAction
180+ text: checked ? "Remove Mouse" : "Add Mouse"
181+ onTriggered: {
182+ if (checked) {
183+ console.log("ADD")
184+ MockInputDeviceBackend.addMockDevice("/mouse0", InputInfo.Mouse);
185+ } else {
186+ console.log("REMOVE")
187+ MockInputDeviceBackend.removeDevice("/mouse0");
188+ }
189+ }
190+ iconName: "input-mouse-symbolic"
191+ checkable: true
192+ checked: false
193+ }
194+
195+ Action {
196+ id: addKBAction
197+ text: checked ? "Remove Keyboard" : "Add Keyboard"
198+ onTriggered: {
199+ if (checked) {
200+ MockInputDeviceBackend.addMockDevice("/kbd0", InputInfo.Keyboard);
201+ } else {
202+ MockInputDeviceBackend.removeDevice("/kbd0");
203+ }
204+ }
205+ iconName: "input-keyboard-symbolic"
206+ checkable: true
207+ checked: false
208+ }
209+
160 ShellApplication {
210 ShellApplication {
161 }
211 }
162
212