on xenial help sign in
fix visual glitch when hiding the drawer with launcher locked visible, add a test
commit19bfe133ff40221844ba2f301b722f7c6e3c8913 authorMichael Zanetti <michael.zanetti@canonical.com> dateMon 6 Mar 2017, 12:10 (10 years ago) parenta842e89
2 files changed+27−10
qml/Launcher/Launcher.qml+9−10 tests/qmltests/Launcher/tst_Drawer.qml+18
qml/Launcher/Launcher.qml+9−10
@@ -116,7 +116,14 @@ FocusScope {
116116 if ((flags & ignoreHideIfMouseOverLauncher) && Utils.Functions.itemUnderMouse(panel)) {
117117 return;
118118 }
119− switchToNextState("")
119+ if (root.lockedVisible) {
120+ // Due to binding updates when switching between modes
121+ // it could happen that our request to show will be overwritten
122+ // with a hide request. Rewrite it when we know hiding is not allowed.
123+ switchToNextState("visible")
124+ } else {
125+ switchToNextState("")
126+ }
120127 }
121128
122129 function fadeOut() {
@@ -254,13 +261,6 @@ FocusScope {
254261 interval: 1
255262 property string nextState: ""
256263 onTriggered: {
257− if (root.lockedVisible && nextState == "") {
258− // Due to binding updates when switching between modes
259− // it could happen that our request to show will be overwritten
260− // with a hide request. Rewrite it when we know hiding is not allowed.
261− nextState = "visible"
262− }
263−
264264 // switching to an intermediate state here to make sure all the
265265 // values are restored, even if we were already in the target state
266266 root.state = "tmp"
@@ -379,8 +379,7 @@ FocusScope {
379379 }
380380
381381 Keys.onEscapePressed: {
382− switchToNextState("");
383− root.focus = false;
382+ root.hide()
384383 }
385384
386385 onDragDistanceChanged: {
tests/qmltests/Launcher/tst_Drawer.qml+18
@@ -311,5 +311,23 @@ StyledItem {
311311
312312 compare(launcher.lastSelectedApplication, "calendar-app");
313313 }
314+
315+ function test_closeWhileDragging() {
316+ launcher.openDrawer(true);
317+ waitForRendering(launcher);
318+ waitUntilTransitionsEnd(launcher);
319+
320+ var drawer = findChild(launcher, "drawer");
321+ tryCompare(drawer.anchors, "rightMargin", -drawer.width);
322+
323+ mousePress(drawer, drawer.width / 2, drawer.height / 2);
324+ mouseMove(drawer, drawer.width / 4, drawer.height / 2);
325+ tryCompare(drawer, "draggingHorizontally", true);
326+
327+ keyPress(Qt.Key_Escape);
328+
329+ tryCompare(launcher, "state", "");
330+ tryCompare(drawer, "draggingHorizontally", false);
331+ }
314332 }
315333}