on xenial help sign in
Add test
commitc7293af007a07b5f70ebef955de8638ad9377548 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateMon 5 Oct 2015, 19:04 (11 years ago) parent16c546c
1 file changed+51−1
tests/qmltests/tst_OrientedShell.qml+51−1
tests/qmltests/tst_OrientedShell.qml+51−1
@@ -110,6 +110,22 @@ Rectangle {
110110 physicalOrientation180: Qt.LandscapeOrientation
111111 primaryOrientationAngle: 90
112112 }
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+ }
113129 }
114130 ]
115131
@@ -250,7 +266,7 @@ Rectangle {
250266 anchors { left: parent.left; right: parent.right }
251267 activeFocusOnPress: false
252268 text: "Device Name"
253− model: ["mako", "manta", "flo"]
269+ model: ["mako", "manta", "flo", "desktop"]
254270 onSelectedIndexChanged: {
255271 testCase.tearDown();
256272 applicationArguments.deviceName = model[selectedIndex];
@@ -310,12 +326,14 @@ Rectangle {
310326 Row {
311327 Button {
312328 text: "Add mouse"
329+ activeFocusOnPress: false
313330 onClicked: {
314331 UnityInputInfo.inputInfo.addMockMouse()
315332 }
316333 }
317334 Button {
318335 text: "Remove mouse"
336+ activeFocusOnPress: false
319337 onClicked: {
320338 UnityInputInfo.inputInfo.removeMockMouse()
321339 }
@@ -324,17 +342,37 @@ Rectangle {
324342 Row {
325343 Button {
326344 text: "Add kbd"
345+ activeFocusOnPress: false
327346 onClicked: {
328347 UnityInputInfo.inputInfo.addMockKeyboard()
329348 }
330349 }
331350 Button {
351+ activeFocusOnPress: false
332352 text: "Remove kbd"
333353 onClicked: {
334354 UnityInputInfo.inputInfo.removeMockKeyboard()
335355 }
336356 }
337357 }
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+ }
338376 }
339377 }
340378
@@ -1054,6 +1092,18 @@ Rectangle {
10541092 compare(signalSpy.count, 0);
10551093 }
10561094
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+
10571107 // angle - rotation angle in degrees clockwise, relative to the primary orientation.
10581108 function rotateTo(angle) {
10591109 switch (angle) {