on xenial help sign in
Added Mouse and KB controls
commit2fc9b0aa270bf43d3237b019d4c9dce50f5b3eef authorNick Dedekind <nick.dedekind@canonical.com> dateFri 31 Mar 2017, 16:55 (10 years ago) parentae24227
1 file changed+50
tests/qmltests/tst_ShellApplication.qml+50
tests/qmltests/tst_ShellApplication.qml+50
@@ -20,6 +20,7 @@ import LightDM.FullLightDM 0.1 as LightDM
2020import LightDMController 0.1
2121import Unity.Application 0.1
2222import Unity.Test 0.1
23+import Unity.InputInfo 0.1
2324
2425import "../../qml"
2526import "../../qml/Components"
@@ -85,6 +86,23 @@ Rectangle {
8586 }
8687 }
8788 }
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+ }
88106
89107 MouseTouchEmulationCheckbox {
90108 id: mouseEmulation
@@ -157,6 +175,38 @@ Rectangle {
157175 }
158176 }
159177
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+
160210 ShellApplication {
161211 }
162212