on xenial help sign in
Make double click on the window decoration maximize
76d1e68Albert Astals Cid
qml/ApplicationMenus/MenuBar.qml+1−1
@@ -217,7 +217,7 @@ Item {
217 } // Row
217 } // Row
218
218
219 MouseArea {
219 MouseArea {
220− anchors.fill: parent
220+ anchors.fill: row
221 hoverEnabled: d.currentItem
221 hoverEnabled: d.currentItem
222
222
223 onEntered: {
223 onEntered: {
tests/qmltests/Stage/tst_DesktopStage.qml+35−4
@@ -698,10 +698,18 @@ Item {
698 var sizeBefore = Qt.size(dialerDelegate.width, dialerDelegate.height);
698 var sizeBefore = Qt.size(dialerDelegate.width, dialerDelegate.height);
699 var deco = findChild(dialerDelegate, "appWindowDecoration");
699 var deco = findChild(dialerDelegate, "appWindowDecoration");
700 verify(deco);
700 verify(deco);
701− tryCompare(deco, "maximizeButtonShown", false);
701+ // deco.width - units.gu(1) to make sure we're outside the "menu" area of the decoration
702+ mouseMove(deco, deco.width - units.gu(1), deco.height/2);
703+ var menuBarLoader = findChild(deco, "menuBarLoader");
704+ tryCompare(menuBarLoader.item, "visible", true);
702− mouseDoubleClick(deco);
705+ mouseDoubleClick(deco, deco.width - units.gu(1), deco.height/2)
703− var sizeAfter = Qt.size(dialerDelegate.width, dialerDelegate.height);
706+ expectFail("", "Double click should not maximize in a size restricted window");
704− tryCompareFunction(function(){ return sizeBefore; }, sizeAfter);
707+ tryCompareFunction(function() {
708+ var sizeAfter = Qt.size(dialerDelegate.width, dialerDelegate.height);
709+ return sizeAfter.width > sizeBefore.width && sizeAfter.height > sizeBefore.height;
710+ },
711+ true
712+ );
705
713
706 // remove restrictions, the maximize button should again be visible
714 // remove restrictions, the maximize button should again be visible
707 dialerDelegate.surface.setMaximumWidth(0);
715 dialerDelegate.surface.setMaximumWidth(0);
@@ -709,6 +717,29 @@ Item {
709 tryCompare(dialerMaximizeButton, "visible", true);
717 tryCompare(dialerMaximizeButton, "visible", true);
710 }
718 }
711
719
720+ function test_doubleClickMaximizes() {
721+ var dialerDelegate = startApplication("dialer-app");
722+
723+ var dialerMaximizeButton = findChild(dialerDelegate, "maximizeWindowButton");
724+ tryCompare(dialerMaximizeButton, "visible", true);
725+
726+ // try double clicking the decoration, should maximize it
727+ var sizeBefore = Qt.size(dialerDelegate.width, dialerDelegate.height);
728+ var deco = findChild(dialerDelegate, "appWindowDecoration");
729+ verify(deco);
730+ // deco.width - units.gu(1) to make sure we're outside the "menu" area of the decoration
731+ mouseMove(deco, deco.width - units.gu(1), deco.height/2);
732+ var menuBarLoader = findChild(deco, "menuBarLoader");
733+ tryCompare(menuBarLoader.item, "visible", true);
734+ mouseDoubleClick(deco, deco.width - units.gu(1), deco.height/2);
735+ tryCompareFunction(function() {
736+ var sizeAfter = Qt.size(dialerDelegate.width, dialerDelegate.height);
737+ return sizeAfter.width > sizeBefore.width && sizeAfter.height > sizeBefore.height;
738+ },
739+ true
740+ );
741+ }
742+
712 function test_canMoveWindowWithLeftMouseButtonOnly_data() {
743 function test_canMoveWindowWithLeftMouseButtonOnly_data() {
713 return [
744 return [
714 {tag: "left mouse button", button: Qt.LeftButton },
745 {tag: "left mouse button", button: Qt.LeftButton },