on xenial help sign in
all tst_Shell tests passing again except 2 where the according features are not

implemented fully yet. Need some last design calls on those

commitb1aeb8e071b363336fd89155717a969b7a854004 authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 31 Aug 2016, 19:09 (10 years ago) parent9633901
6 files changed+71−109
qml/Launcher/Launcher.qml+1 qml/Notifications/NotificationMenuItemFactory.qml+1 qml/Shell.qml+1−1 qml/Stage/DecoratedWindow.qml+1−1 qml/Stage/Stage.qml+6−2 tests/qmltests/tst_Shell.qml+61−105
qml/Launcher/Launcher.qml+1
@@ -93,6 +93,7 @@ FocusScope {
9393 }
9494
9595 onLockedVisibleChanged: {
96+ print("lockedVisible changed:", lockedVisible, "state:", state)
9697 if (lockedVisible && state == "") {
9798 panel.dismissTimer.stop();
9899 fadeOutAnimation.stop();
qml/Notifications/NotificationMenuItemFactory.qml+1
@@ -97,6 +97,7 @@ Loader {
9797 echoMode: checkBox.checked ? TextInput.Normal : TextInput.Password
9898 height: units.gu(5)
9999 Component.onCompleted: {
100+ print("forcing active focus on notification!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11111")
100101 forceActiveFocus();
101102 }
102103 onTextChanged: {
qml/Shell.qml+1−1
@@ -502,7 +502,7 @@ StyledItem {
502502 }
503503 onFocusChanged: {
504504 if (!focus) {
505− stages.focus = true;
505+ stage.focus = true;
506506 }
507507 }
508508
qml/Stage/DecoratedWindow.qml+1−1
@@ -33,6 +33,7 @@ FocusScope {
3333 property alias active: decoration.active
3434 readonly property alias title: applicationWindow.title
3535 property alias maximizeButtonShown: decoration.maximizeButtonShown
36+ property alias interactive: applicationWindow.interactive
3637
3738 // Changing this will actually add/remove a decoration, meaning, requestedHeight will take the decoration into account.
3839 property bool hasDecoration: true
@@ -160,7 +161,6 @@ FocusScope {
160161 property int oldRequestedHeight: requestedHeight
161162 onRequestedWidthChanged: oldRequestedWidth = requestedWidth
162163 onRequestedHeightChanged: oldRequestedHeight = requestedHeight
163− interactive: true
164164 focus: true
165165
166166 property real itemScale: 1
qml/Stage/Stage.qml+6−2
@@ -374,6 +374,7 @@ AbstractStage {
374374 SequentialAnimation {
375375 ScriptAction {
376376 script: {
377+ print("hightedIndex is:", spreadItem.highlightedIndex)
377378 var item = appRepeater.itemAt(Math.max(0, spreadItem.highlightedIndex));
378379 item.playFocusAnimation();
379380 }
@@ -1272,6 +1273,7 @@ AbstractStage {
12721273 surface: model.surface
12731274 active: appDelegate.focus
12741275 focus: true
1276+ interactive: root.interactive
12751277 showDecoration: 1
12761278 maximizeButtonShown: (maximumWidth == 0 || maximumWidth >= appContainer.width) &&
12771279 (maximumHeight == 0 || maximumHeight >= appContainer.height)
@@ -1348,12 +1350,13 @@ AbstractStage {
13481350 onClicked: {
13491351 spreadItem.highlightedIndex = index;
13501352 if (distance == 0) {
1351− print("focusing because of inputBlocker click")
13521353 priv.goneToSpread = false;
13531354 }
13541355 }
13551356 onContainsMouseChanged: {
1356− if (containsMouse) spreadItem.highlightedIndex = index
1357+ // It could happen that this triggers during the transition from spread to windowed, only actually do something
1358+ // if goneToSpread is still true...
1359+ if (priv.goneToSpread && containsMouse) spreadItem.highlightedIndex = index
13571360 }
13581361 onClose: {
13591362 priv.closingIndex = index
@@ -1415,6 +1418,7 @@ AbstractStage {
14151418
14161419 SwipeArea {
14171420 id: rightEdgeDragArea
1421+ objectName: "rightEdgeDragArea"
14181422 direction: Direction.Leftwards
14191423 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
14201424 width: root.dragAreaWidth
tests/qmltests/tst_Shell.qml+61−105
@@ -589,6 +589,38 @@ Rectangle {
589589 compare(ApplicationManager.get(0).appId, "unity8-dash");
590590 }
591591
592+ function test_phoneLeftEdgeDrag_data() {
593+ return [
594+ {tag: "without launcher",
595+ revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
596+ launcherHides: true, greeterShown: false},
597+
598+ {tag: "with launcher",
599+ revealLauncher: true, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
600+ launcherHides: true, greeterShown: false},
601+
602+ {tag: "small swipe",
603+ revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app",
604+ launcherHides: false, greeterShown: false},
605+
606+ {tag: "long swipe",
607+ revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
608+ launcherHides: true, greeterShown: false},
609+
610+ {tag: "small swipe with greeter",
611+ revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app",
612+ launcherHides: false, greeterShown: true},
613+
614+ {tag: "long swipe with greeter",
615+ revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
616+ launcherHides: true, greeterShown: true},
617+
618+ {tag: "swipe over dash",
619+ revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "unity8-dash",
620+ launcherHides: false, greeterShown: false},
621+ ];
622+ }
623+
592624 function test_snapDecisionDismissalReturnsFocus() {
593625 loadShell("phone");
594626 swipeAwayGreeter();
@@ -653,38 +685,6 @@ Rectangle {
653685 mockNotificationsModel.append(n)
654686 }
655687
656− function test_phoneLeftEdgeDrag_data() {
657− return [
658− {tag: "without launcher",
659− revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
660− launcherHides: true, greeterShown: false},
661−
662− {tag: "with launcher",
663− revealLauncher: true, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
664− launcherHides: true, greeterShown: false},
665−
666− {tag: "small swipe",
667− revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app",
668− launcherHides: false, greeterShown: false},
669−
670− {tag: "long swipe",
671− revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
672− launcherHides: true, greeterShown: false},
673−
674− {tag: "small swipe with greeter",
675− revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app",
676− launcherHides: false, greeterShown: true},
677−
678− {tag: "long swipe with greeter",
679− revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
680− launcherHides: true, greeterShown: true},
681−
682− {tag: "swipe over dash",
683− revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "unity8-dash",
684− launcherHides: false, greeterShown: false},
685− ];
686− }
687−
688688 function test_phoneLeftEdgeDrag(data) {
689689 loadShell("phone");
690690 swipeAwayGreeter();
@@ -1357,7 +1357,7 @@ Rectangle {
13571357 function test_tapOnRightEdgeReachesApplicationSurface() {
13581358 loadShell("phone");
13591359 swipeAwayGreeter();
1360− var topmostSpreadDelegate = findChild(shell, "spreadDelegate_" + topLevelSurfaceList.idAt(0));
1360+ var topmostSpreadDelegate = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(0));
13611361 verify(topmostSpreadDelegate);
13621362
13631363 waitUntilFocusedApplicationIsShowingItsSurface();
@@ -1365,7 +1365,7 @@ Rectangle {
13651365 var topmostSurfaceItem = findChild(topmostSpreadDelegate, "surfaceItem");
13661366 verify(topmostSurfaceItem);
13671367
1368− var rightEdgeDragArea = findChild(shell, "spreadDragArea");
1368+ var rightEdgeDragArea = findChild(shell, "rightEdgeDragArea");
13691369 topmostSurfaceItem.touchPressCount = 0;
13701370 topmostSurfaceItem.touchReleaseCount = 0;
13711371
@@ -1386,9 +1386,9 @@ Rectangle {
13861386 function test_rightEdgeDragDoesNotReachApplicationSurface() {
13871387 loadShell("phone");
13881388 swipeAwayGreeter();
1389− var topmostSpreadDelegate = findChild(shell, "spreadDelegate_" + topLevelSurfaceList.idAt(0));
1389+ var topmostSpreadDelegate = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(0));
13901390 var topmostSurfaceItem = findChild(topmostSpreadDelegate, "surfaceItem");
1391− var rightEdgeDragArea = findChild(shell, "spreadDragArea");
1391+ var rightEdgeDragArea = findChild(shell, "rightEdgeDragArea");
13921392
13931393 topmostSurfaceItem.touchPressCount = 0;
13941394 topmostSurfaceItem.touchReleaseCount = 0;
@@ -1406,7 +1406,7 @@ Rectangle {
14061406
14071407 function waitUntilFocusedApplicationIsShowingItsSurface()
14081408 {
1409− var spreadDelegate = findChild(shell, "spreadDelegate_" + topLevelSurfaceList.idAt(0));
1409+ var spreadDelegate = findChild(shell, "appDelegate_" + topLevelSurfaceList.idAt(0));
14101410 var appState = findInvisibleChild(spreadDelegate, "applicationWindowStateGroup");
14111411 tryCompare(appState, "state", "surface");
14121412 var transitions = appState.transitions;
@@ -1425,8 +1425,7 @@ Rectangle {
14251425
14261426 // check if it's indeed showing the spread
14271427 var stage = findChild(shell, "stage");
1428− var spreadView = findChild(stage, "spreadView");
1429− tryCompare(spreadView, "phase", 2);
1428+ tryCompare(stage, "state", "spread");
14301429 }
14311430
14321431 function test_tapUbuntuIconInLauncherOverAppSpread() {
@@ -1462,8 +1461,7 @@ Rectangle {
14621461 // check that the stage has left spread mode.
14631462 {
14641463 var stage = findChild(shell, "stage");
1465− var spreadView = findChild(stage, "spreadView");
1466− tryCompare(spreadView, "phase", 0);
1464+ tryCompare(stage, "state", "staged");
14671465 }
14681466
14691467 // check that the launcher got dismissed
@@ -1530,21 +1528,6 @@ Rectangle {
15301528 }
15311529 }
15321530
1533− function test_stageLoader_data() {
1534− return [
1535− {tag: "phone", source: "Stages/PhoneStage.qml", formFactor: "phone", usageScenario: "phone"},
1536− {tag: "tablet", source: "Stages/TabletStage.qml", formFactor: "tablet", usageScenario: "tablet"},
1537− {tag: "desktop", source: "Stages/DesktopStage.qml", formFactor: "tablet", usageScenario: "desktop"}
1538− ]
1539− }
1540−
1541− function test_stageLoader(data) {
1542− loadShell(data.formFactor);
1543− shell.usageScenario = data.usageScenario;
1544− var stageLoader = findChild(shell, "applicationsDisplayLoader");
1545− verify(String(stageLoader.source).indexOf(data.source) >= 0);
1546− }
1547−
15481531 function test_launcherInverted_data() {
15491532 return [
15501533 {tag: "phone", formFactor: "phone", usageScenario: "phone", launcherInverted: true},
@@ -1809,37 +1792,40 @@ Rectangle {
18091792 loadDesktopShellWithApps()
18101793
18111794 var stage = findChild(shell, "stage");
1812− var spread = findChild(stage, "spread");
1813− waitForRendering(spread)
1795+ var spreadItem = findChild(stage, "spreadItem");
1796+// waitForRendering(spread)
18141797
1815− var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1816− verify(spreadRepeater !== null);
1798+ var appRepeater = findInvisibleChild(shell, "appRepeater");
1799+ verify(appRepeater !== null);
18171800
18181801 keyPress(Qt.Key_Alt)
18191802 keyClick(Qt.Key_Tab);
18201803
18211804 var surface = topLevelSurfaceList.surfaceAt(2);
1822− var spreadDelegate2 = spreadRepeater.itemAt(2);
1823− var clippedSpreadDelegate = findChild(spreadDelegate2, "clippedSpreadDelegate");
1805+ var spreadDelegate2 = appRepeater.itemAt(2);
1806+ var decoratedWindow = findChild(spreadDelegate2, "decoratedWindow");
18241807
1825− tryCompare(spread, "state", "altTab");
1808+ tryCompare(stage, "state", "spread");
18261809
18271810 // Move the mouse over tile 2 and verify the highlight becomes visible
18281811 var x = 0;
1829− var y = shell.height * (data.tileInfo ? .95 : 0.5)
1812+ var y = shell.height * (data.tileInfo ? .9 : 0.5)
18301813 mouseMove(shell, x, y)
1831− while (spreadRepeater.highlightedIndex !== 2 && x <= 4000) {
1814+ while (spreadItem.highlightedIndex !== 2 && x <= 4000) {
1815+ print("hightlight", spreadItem.highlightedIndex, x, y)
18321816 x+=10;
18331817 mouseMove(shell, x, y)
18341818 wait(0); // spin the loop so bindings get evaluated
18351819 }
1836− tryCompare(clippedSpreadDelegate, "highlightShown", true);
1820+ print("hightlight", spreadItem.highlightedIndex)
1821+ tryCompare(decoratedWindow, "showHighlight", true);
18371822
18381823 // Click the tile
1839− mouseClick(clippedSpreadDelegate, clippedSpreadDelegate.width / 2, clippedSpreadDelegate.height / 2)
1824+ mouseClick(decoratedWindow, units.gu(2), decoratedWindow.height / 2)
18401825
18411826 // Verify that we left the spread and app2 is the focused one now
1842− tryCompare(stage, "state", "");
1827+ tryCompare(stage, "state", "windowed");
1828+ print("selected:", surface.name)
18431829 tryCompare(surface, "focused", true);
18441830
18451831 keyRelease(Qt.Key_Alt);
@@ -1901,41 +1887,6 @@ Rectangle {
19011887 tryCompare(hoverMouseArea, "visible", false)
19021888 }
19031889
1904− function test_workspacePreviewsHighlightedApp() {
1905− loadDesktopShellWithApps()
1906−
1907− var targetZ = topLevelSurfaceList.count + 1;
1908−
1909− var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1910− verify(spreadRepeater !== null);
1911−
1912− var appRepeater = findInvisibleChild(shell, "appRepeater");
1913− verify(appRepeater !== null);
1914−
1915− keyPress(Qt.Key_Alt)
1916− keyClick(Qt.Key_Tab);
1917−
1918− tryCompare(spreadRepeater, "highlightedIndex", 1);
1919− tryCompare(appRepeater.itemAt(1), "z", targetZ)
1920−
1921− var x = 0;
1922− var y = shell.height * .75;
1923− mouseMove(shell, x, y)
1924−
1925− for (var i = 0; i < 7; i++) {
1926− while (spreadRepeater.highlightedIndex != i && x <= 4000) {
1927− tryCompare(appRepeater.itemAt(spreadRepeater.highlightedIndex), "z", targetZ)
1928− x+=10;
1929− mouseMove(shell, x, y)
1930− wait(0); // spin the loop so bindings get evaluated
1931− }
1932− }
1933−
1934− verify(y < 4000);
1935−
1936− keyRelease(Qt.Key_Alt);
1937− }
1938−
19391890 function test_focusAppFromLauncherExitsSpread_data() {
19401891 return [
19411892 {tag: "autohide launcher", launcherLocked: false },
@@ -2267,19 +2218,19 @@ Rectangle {
22672218 function test_superTabToCycleLauncher(data) {
22682219 loadShell("desktop");
22692220 shell.usageScenario = "desktop";
2221+ waitForRendering(shell);
22702222 GSettingsController.setAutohideLauncher(!data.launcherLocked);
22712223 waitForRendering(shell);
22722224
2225+ var stage = findChild(shell, "stage");
22732226 var launcher = findChild(shell, "launcher");
22742227 var launcherPanel = findChild(launcher, "launcherPanel");
22752228 var firstAppInLauncher = LauncherModel.get(0).appId;
2276−
22772229 compare(launcher.state, data.launcherLocked ? "visible": "");
22782230 compare(launcherPanel.highlightIndex, -2);
22792231 compare(ApplicationManager.focusedApplicationId, "unity8-dash");
22802232
22812233 // Use Super + Tab Tab to cycle to the first entry in the launcher
2282− wait(1000);
22832234 keyPress(Qt.Key_Super_L, Qt.MetaModifier);
22842235 keyClick(Qt.Key_Tab);
22852236 tryCompare(launcher, "state", "visible");
@@ -2300,6 +2251,7 @@ Rectangle {
23002251 tryCompare(launcher, "state", data.launcherLocked ? "visible" : "");
23012252 tryCompare(launcherPanel, "highlightIndex", -2);
23022253 tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
2254+ tryCompare(stage, "focus", true)
23032255 }
23042256
23052257 function test_longpressSuperOpensLauncherAndShortcutsOverlay() {
@@ -2360,6 +2312,7 @@ Rectangle {
23602312 waitForRendering(shell);
23612313 var appContainer = findChild(shell, "appContainer");
23622314 var launcher = findChild(shell, "launcher");
2315+ var launcherPanel = findChild(launcher, "launcherPanel");
23632316
23642317 var appSurfaceId = topLevelSurfaceList.nextId;
23652318 var app = ApplicationManager.startApplication("music-app");
@@ -2370,12 +2323,15 @@ Rectangle {
23702323 waitForRendering(shell);
23712324
23722325 GSettingsController.setAutohideLauncher(true);
2326+ tryCompare(launcherPanel, "x", -launcher.panelWidth)
23732327 waitForRendering(shell)
23742328 var hiddenSize = appDelegate.width;
23752329
23762330 GSettingsController.setAutohideLauncher(false);
2331+ tryCompare(launcherPanel, "x", 0)
23772332 waitForRendering(shell)
23782333 var shownSize = appDelegate.width;
2334+ print("launcher size:", launcher.panelWidth, "hidden:", hiddenSize, "shown:", shownSize)
23792335
23802336 compare(shownSize + launcher.panelWidth, hiddenSize);
23812337 }