on xenial help sign in
disable swipeToClose while some snapping is happening Fixes: #1378938

Approved by: Albert Astals Cid

commit7c4a08b5a6531e5edba1963c7710d4abf66cde91 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 25 Nov 2014, 13:53 (12 years ago) parent03dce856a68e35
3 files changed+35−5
qml/Stages/PhoneStage.qml+1−1 qml/Stages/TabletStage.qml+1−1 tests/qmltests/Stages/tst_PhoneStage.qml+33−3
qml/Stages/PhoneStage.qml+1−1
@@ -286,7 +286,7 @@ Rectangle {
286286 otherSelected: spreadView.selectedIndex >= 0 && !selected
287287 interactive: !spreadView.interactive && spreadView.phase === 0
288288 && spreadView.shiftedContentX === 0 && root.interactive && index === 0
289− swipeToCloseEnabled: spreadView.interactive
289+ swipeToCloseEnabled: spreadView.interactive && !snapAnimation.running
290290 maximizedAppTopMargin: root.maximizedAppTopMargin
291291 dropShadow: spreadView.active ||
292292 (priv.focusedAppDelegate && priv.focusedAppDelegate.x !== 0)
qml/Stages/TabletStage.qml+1−1
@@ -490,7 +490,7 @@ Rectangle {
490490 otherSelected: spreadView.selectedIndex >= 0 && !selected
491491 isInSideStage: priv.sideStageAppId == model.appId
492492 interactive: !spreadView.interactive && spreadView.phase === 0 && root.interactive
493− swipeToCloseEnabled: spreadView.interactive
493+ swipeToCloseEnabled: spreadView.interactive && !snapAnimation.running
494494 maximizedAppTopMargin: root.maximizedAppTopMargin
495495 dragOffset: !isDash && model.appId == priv.mainStageAppId && root.inverseProgress > 0 ? root.inverseProgress : 0
496496 application: ApplicationManager.get(index)
tests/qmltests/Stages/tst_PhoneStage.qml+33−3
@@ -274,7 +274,7 @@ Item {
274274 compare(ApplicationManager.focusedApplicationId, selectedApp.appId);
275275 }
276276
277− function test_orientation_change_sent_to_focused_app() {
277+ function test_orientationChangeSentToFocusedApp() {
278278 phoneStage.orientation = Qt.PortraitOrientation;
279279 addApps(1);
280280
@@ -286,7 +286,7 @@ Item {
286286 tryCompare(app, "orientation", Qt.LandscapeOrientation);
287287 }
288288
289− function test_orientation_change_not_sent_to_apps_while_spread_open() {
289+ function test_orientationChangeNotSentToAppsWhileSpreadOpen() {
290290 phoneStage.orientation = Qt.PortraitOrientation;
291291 addApps(1);
292292
@@ -299,7 +299,7 @@ Item {
299299 tryCompare(app, "orientation", Qt.PortraitOrientation);
300300 }
301301
302− function test_orientation_change_not_sent_to_unfocused_app_until_it_focused() {
302+ function test_orientationChangeNotSentToUnfocusedAppUntilItFocused() {
303303 phoneStage.orientation = Qt.PortraitOrientation;
304304 addApps(1);
305305
@@ -357,5 +357,35 @@ Item {
357357 tryCompare(firstApp, "state", ApplicationInfoInterface.Running);
358358 tryCompare(firstApp, "focused", true);
359359 }
360+
361+ function test_cantCloseWhileSnapping() {
362+ addApps(2);
363+
364+ goToSpread();
365+
366+ var spreadView = findChild(phoneStage, "spreadView");
367+ var selectedApp = ApplicationManager.get(2);
368+
369+ goToSpread();
370+
371+ var app0 = findChild(spreadView, "appDelegate0");
372+ var app1 = findChild(spreadView, "appDelegate1");
373+ var app2 = findChild(spreadView, "appDelegate2");
374+
375+ var dragArea0 = findChild(app0, "dragArea");
376+ var dragArea1 = findChild(app1, "dragArea");
377+ var dragArea2 = findChild(app2, "dragArea");
378+
379+ compare(dragArea0.enabled, true);
380+ compare(dragArea1.enabled, true);
381+ compare(dragArea2.enabled, true);
382+
383+ phoneStage.select(selectedApp.appId);
384+
385+ // Make sure all drag areas are disabled instantly. Don't use tryCompare here!
386+ compare(dragArea0.enabled, false);
387+ compare(dragArea1.enabled, false);
388+ compare(dragArea2.enabled, false);
389+ }
360390 }
361391}