on xenial help sign in
add a testcase
91c47f5Lukáš Tinkl
qml/Stages/DesktopStage.qml−6
@@ -630,12 +630,6 @@ AbstractStage {
630 onMaximizeVerticallyClicked: appDelegate.maximizedVertically ? appDelegate.restoreFromMaximized() : appDelegate.maximizeVertically()
630 onMaximizeVerticallyClicked: appDelegate.maximizedVertically ? appDelegate.restoreFromMaximized() : appDelegate.maximizeVertically()
631 onMinimizeClicked: appDelegate.minimize()
631 onMinimizeClicked: appDelegate.minimize()
632 onDecorationPressed: { appDelegate.focus = true; }
632 onDecorationPressed: { appDelegate.focus = true; }
633−
634− Component.onCompleted: {
635− print("Window:", objectName);
636− print("Width:", width, ", maximum width:", maximumWidth, ", desktop width:", appContainer.width);
637− print("Height:", height, ", maximum height:", maximumHeight, ", desktop height:", appContainer.height);
638− }
639 }
633 }
640
634
641 WindowedFullscreenPolicy {
635 WindowedFullscreenPolicy {
tests/qmltests/Stages/tst_DesktopStage.qml+26
@@ -654,5 +654,31 @@ Item {
654 var closeButton = findChild(dashAppDelegate, "closeWindowButton");
654 var closeButton = findChild(dashAppDelegate, "closeWindowButton");
655 tryCompare(closeButton, "visible", false);
655 tryCompare(closeButton, "visible", false);
656 }
656 }
657+
658+ function test_hideMaximizeButtonWhenSizeConstrained() {
659+ var dialerDelegate = startApplication("dialer-app");
660+
661+ var dialerMaximizeButton = findChild(dialerDelegate, "maximizeWindowButton");
662+ tryCompare(dialerMaximizeButton, "visible", true);
663+
664+ // add size restrictions, smaller than our stage
665+ dialerDelegate.surface.setMaximumWidth(40);
666+ dialerDelegate.surface.setMaximumHeight(30);
667+ tryCompare(dialerMaximizeButton, "visible", false);
668+
669+ // try double clicking the decoration, shouldn't maximize it
670+ var sizeBefore = Qt.size(dialerDelegate.width, dialerDelegate.height);
671+ var deco = findChild(dialerDelegate, "appWindowDecoration");
672+ verify(deco);
673+ tryCompare(deco, "maximizeButtonShown", false);
674+ mouseDoubleClick(deco);
675+ var sizeAfter = Qt.size(dialerDelegate.width, dialerDelegate.height);
676+ tryCompareFunction(function(){ return sizeBefore; }, sizeAfter);
677+
678+ // remove restrictions, the maximize button should again be visible
679+ dialerDelegate.surface.setMaximumWidth(0);
680+ dialerDelegate.surface.setMaximumHeight(0);
681+ tryCompare(dialerMaximizeButton, "visible", true);
682+ }
657 }
683 }
658}
684}