on xenial help sign in
added tests
commit0c54fe78dddef401fb231527e2a6c51e86127f27 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 14 Jul 2015, 19:06 (11 years ago) parent69d50d2
2 files changed+49−1
qml/Stages/DesktopStage.qml+2−1 tests/qmltests/tst_Shell.qml+47
qml/Stages/DesktopStage.qml+2−1
@@ -26,7 +26,6 @@ import Ubuntu.Gestures 0.1
2626
2727Rectangle {
2828 id: root
29−
3029 anchors.fill: parent
3130
3231 // Controls to be set from outside
@@ -313,6 +312,7 @@ Rectangle {
313312
314313 DecoratedWindow {
315314 id: decoratedWindow
315+ objectName: "decoratedWindow"
316316 anchors.left: appDelegate.left
317317 anchors.top: appDelegate.top
318318 windowWidth: appDelegate.width
@@ -402,6 +402,7 @@ Rectangle {
402402
403403 MouseArea {
404404 id: tileInfo
405+ objectName: "tileInfo"
405406 anchors { left: parent.left; top: decoratedWindow.bottom; topMargin: units.gu(5) }
406407 width: units.gu(30)
407408 height: titleInfoColumn.height
tests/qmltests/tst_Shell.qml+47
@@ -1485,5 +1485,52 @@ Rectangle {
14851485
14861486 keyRelease(Qt.Key_Control);
14871487 }
1488+
1489+ function test_selectFromSpreadWithMouse_data() {
1490+ return [
1491+ {tag: "click on tileInfo", tileInfo: true },
1492+ {tag: "click on surface", tileInfo: false },
1493+ ]
1494+ }
1495+
1496+ function test_selectFromSpreadWithMouse(data) {
1497+ loadDesktopShellWithApps()
1498+
1499+ var appRepeater = findInvisibleChild(shell, "appRepeater");
1500+ verify(appRepeater !== null);
1501+
1502+ keyPress(Qt.Key_Control)
1503+ keyClick(Qt.Key_Tab);
1504+
1505+ appRemovedSpy.clear();
1506+
1507+ var focusAppId = ApplicationManager.get(2).appId;
1508+ var appDelegate2 = appRepeater.itemAt(2);
1509+ var decoratedWindow = findChild(appDelegate2, "decoratedWindow");
1510+ var stage = findChild(shell, "stage");
1511+
1512+ tryCompare(stage, "state", "altTab");
1513+
1514+ // Move the mouse over tile 2 and verify the highlight becomes visible
1515+ var x = 0;
1516+ var y = shell.height * (data.tileInfo ? .5 : 0.95)
1517+ mouseMove(shell, x, y)
1518+ while (appRepeater.highlightedIndex !== 2 && x <= 4000) {
1519+ print("y is", y)
1520+ x+=10;
1521+ mouseMove(shell, x, y)
1522+ waitForRendering(shell)
1523+ }
1524+ tryCompare(decoratedWindow, "highlightShown", true);
1525+
1526+ // Click the tile
1527+ mouseClick(decoratedWindow, decoratedWindow.width / 2, decoratedWindow.height / 2)
1528+
1529+ // Verify that we left the spread and app2 is the focused one now
1530+ tryCompare(stage, "state", "");
1531+ tryCompare(ApplicationManager, "focusedApplicationId", focusAppId);
1532+
1533+ keyRelease(Qt.Key_Control);
1534+ }
14881535 }
14891536}