on xenial help sign in
Add test
c7293afDaniel d'Andrada
tests/qmltests/tst_OrientedShell.qml+51−1
@@ -110,6 +110,22 @@ Rectangle {
110 physicalOrientation180: Qt.LandscapeOrientation
110 physicalOrientation180: Qt.LandscapeOrientation
111 primaryOrientationAngle: 90
111 primaryOrientationAngle: 90
112 }
112 }
113+ },
114+ State {
115+ name: "desktop"
116+ PropertyChanges {
117+ target: orientedShellLoader
118+ width: units.gu(100)
119+ height: units.gu(56)
120+ }
121+ PropertyChanges {
122+ target: root
123+ physicalOrientation270: Qt.InvertedPortraitOrientation
124+ physicalOrientation0: Qt.LandscapeOrientation
125+ physicalOrientation90: Qt.PortraitOrientation
126+ physicalOrientation180: Qt.InvertedLandscapeOrientation
127+ primaryOrientationAngle: 0
128+ }
113 }
129 }
114 ]
130 ]
115
131
@@ -250,7 +266,7 @@ Rectangle {
250 anchors { left: parent.left; right: parent.right }
266 anchors { left: parent.left; right: parent.right }
251 activeFocusOnPress: false
267 activeFocusOnPress: false
252 text: "Device Name"
268 text: "Device Name"
253− model: ["mako", "manta", "flo"]
269+ model: ["mako", "manta", "flo", "desktop"]
254 onSelectedIndexChanged: {
270 onSelectedIndexChanged: {
255 testCase.tearDown();
271 testCase.tearDown();
256 applicationArguments.deviceName = model[selectedIndex];
272 applicationArguments.deviceName = model[selectedIndex];
@@ -310,12 +326,14 @@ Rectangle {
310 Row {
326 Row {
311 Button {
327 Button {
312 text: "Add mouse"
328 text: "Add mouse"
329+ activeFocusOnPress: false
313 onClicked: {
330 onClicked: {
314 UnityInputInfo.inputInfo.addMockMouse()
331 UnityInputInfo.inputInfo.addMockMouse()
315 }
332 }
316 }
333 }
317 Button {
334 Button {
318 text: "Remove mouse"
335 text: "Remove mouse"
336+ activeFocusOnPress: false
319 onClicked: {
337 onClicked: {
320 UnityInputInfo.inputInfo.removeMockMouse()
338 UnityInputInfo.inputInfo.removeMockMouse()
321 }
339 }
@@ -324,17 +342,37 @@ Rectangle {
324 Row {
342 Row {
325 Button {
343 Button {
326 text: "Add kbd"
344 text: "Add kbd"
345+ activeFocusOnPress: false
327 onClicked: {
346 onClicked: {
328 UnityInputInfo.inputInfo.addMockKeyboard()
347 UnityInputInfo.inputInfo.addMockKeyboard()
329 }
348 }
330 }
349 }
331 Button {
350 Button {
351+ activeFocusOnPress: false
332 text: "Remove kbd"
352 text: "Remove kbd"
333 onClicked: {
353 onClicked: {
334 UnityInputInfo.inputInfo.removeMockKeyboard()
354 UnityInputInfo.inputInfo.removeMockKeyboard()
335 }
355 }
336 }
356 }
337 }
357 }
358+
359+ // Simulates what happens when the shell is moved to an external monitor and back
360+ Button {
361+ id: moveToFromMonitorButton
362+ text: applicationArguments.deviceName === "desktop" ? "Move to " + prevDevName + " screen" : "Move to desktop screen"
363+ activeFocusOnPress: false
364+ property string prevDevName: "mako"
365+ onClicked: {
366+ usageModeSelector.selectedIndex = 2; // "Automatic"
367+
368+ if (applicationArguments.deviceName === "desktop") {
369+ applicationArguments.deviceName = prevDevName;
370+ } else {
371+ prevDevName = applicationArguments.deviceName;
372+ applicationArguments.deviceName = "desktop"
373+ }
374+ }
375+ }
338 }
376 }
339 }
377 }
340
378
@@ -1054,6 +1092,18 @@ Rectangle {
1054 compare(signalSpy.count, 0);
1092 compare(signalSpy.count, 0);
1055 }
1093 }
1056
1094
1095+ function test_moveToExternalMonitor() {
1096+ loadShell("flo");
1097+
1098+ compare(orientedShell.orientation, Qt.InvertedLandscapeOrientation);
1099+ compare(shell.transformRotationAngle, 90);
1100+
1101+ moveToFromMonitorButton.clicked();
1102+
1103+ tryCompare(orientedShell, "orientation", Qt.LandscapeOrientation);
1104+ tryCompare(shell, "transformRotationAngle" , 0);
1105+ }
1106+
1057 // angle - rotation angle in degrees clockwise, relative to the primary orientation.
1107 // angle - rotation angle in degrees clockwise, relative to the primary orientation.
1058 function rotateTo(angle) {
1108 function rotateTo(angle) {
1059 switch (angle) {
1109 switch (angle) {