on xenial help sign in
Resync with lp:~mzanetti/unity8/unified-stages
commit81711e479677ced5bc5c6f9d0f3e296f8469247f authorAndrea Azzarone <azzaronea@gmail.com> dateThu 20 Oct 2016, 16:39 (10 years ago) parentde6c9a4438d306
4 files changed+19−5
qml/Stage/Spread/SpreadDelegateInputArea.qml+2−2 qml/Stage/Stage.qml+6 tests/qmltests/Stage/tst_PhoneStage.qml+5 tests/qmltests/Stage/tst_TabletStage.qml+6−3
qml/Stage/Spread/SpreadDelegateInputArea.qml+2−2
@@ -47,7 +47,7 @@ Item {
4747
4848 function pushDragEvent(event) {
4949 var currentTime = __dateTime.getCurrentTimeMs()
50− dragEvents.push([currentTime, event.x, event.y, getEventSpeed(currentTime, event)])
50+ dragEvents.push([currentTime, event.x - event.startX, event.y - event.startY, getEventSpeed(currentTime, event)])
5151 cullOldDragEvents(currentTime)
5252 updateSpeed()
5353 }
@@ -77,7 +77,7 @@ Item {
7777 if (dragEvents.length != 0) {
7878 var lastDrag = dragEvents[dragEvents.length-1]
7979 var duration = Math.max(1, currentTime - lastDrag[0])
80− return (event.y - lastDrag[2]) / duration
80+ return (event.y - event.startY - lastDrag[2]) / duration
8181 } else {
8282 return 0
8383 }
qml/Stage/Stage.qml+6
@@ -264,6 +264,12 @@ FocusScope {
264264
265265 for (var i = 0; i < appRepeater.count && (!choseMainStage || !choseSideStage); ++i) {
266266 var appDelegate = appRepeater.itemAt(i);
267+ if (!appDelegate) {
268+ // This might happen during startup phase... If the delegate appears and claims focus
269+ // things are updated and appRepeater.itemAt(x) still returns null while appRepeater.count >= x
270+ // Lets just skip it, on startup it will be generated at a later point too...
271+ continue;
272+ }
267273 if (sideStage.shown && appDelegate.stage == ApplicationInfoInterface.SideStage
268274 && !choseSideStage) {
269275 priv.sideStageDelegate = appDelegate
tests/qmltests/Stage/tst_PhoneStage.qml+5
@@ -156,6 +156,11 @@ Item {
156156 true /* beginTouch */, true /* endTouch */, units.gu(10), 50);
157157
158158 tryCompare(stage, "state", "spread");
159+ // Make sure all the transitions have finished
160+ var appRepeater = findChild(stage, "appRepeater");
161+ for (var i = 0; i < appRepeater.count; i++) {
162+ waitUntilTransitionsEnd(appRepeater.itemAt(i));
163+ }
159164 waitForRendering(stage);
160165 }
161166
tests/qmltests/Stage/tst_TabletStage.qml+6−3
@@ -581,7 +581,6 @@ Rectangle {
581581
582582 function test_loadSideStageByDraggingFromMainStage() {
583583 sideStage.showNow();
584− print("sidestage now shown. launching browser")
585584 var webbrowserSurfaceId = topSurfaceList.nextId;
586585 webbrowserCheckBox.checked = true;
587586 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -589,7 +588,7 @@ Rectangle {
589588 var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
590589 verify(appDelegate);
591590 waitForRendering(stage);
592− compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
591+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
593592
594593 dragToSideStage(webbrowserSurfaceId);
595594
@@ -599,6 +598,10 @@ Rectangle {
599598 function test_unloadSideStageByDraggingFromSideStage() {
600599 sideStage.showNow();
601600 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
601+ // WindowStateStorage is async... Lets wait for it to be fully processed...
602+ tryCompareFunction(function() {
603+ return WindowStateStorage.getStage(webbrowserCheckBox.appId, ApplicationInfoInterface.MainStage) === ApplicationInfoInterface.SideStage
604+ }, true);
602605 var webbrowserSurfaceId = topSurfaceList.nextId;
603606 webbrowserCheckBox.checked = true;
604607 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -606,7 +609,7 @@ Rectangle {
606609 var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
607610 verify(appDelegate);
608611 waitForRendering(stage);
609− compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
612+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
610613
611614 dragToMainStage(webbrowserSurfaceId);
612615