on xenial help sign in
improve it actual logic and the tests for it
2fa34a6Michael Zanetti
qml/Stages/DesktopStage.qml+1−1
@@ -273,7 +273,7 @@ AbstractStage {
273 property: "y"
273 property: "y"
274 value: appDelegate.requestedY -
274 value: appDelegate.requestedY -
275 Math.min(appDelegate.requestedY - PanelState.panelHeight,
275 Math.min(appDelegate.requestedY - PanelState.panelHeight,
276− UbuntuKeyboardInfo.height)
276+ Math.max(0, UbuntuKeyboardInfo.height - (appContainer.height - (appDelegate.requestedY + appDelegate.height))))
277 when: appDelegate.focus
277 when: appDelegate.focus
278 }
278 }
279
279
tests/qmltests/Stages/tst_DesktopStage.qml+14−3
@@ -678,14 +678,25 @@ Item {
678 tryCompare(closeButton, "visible", false);
678 tryCompare(closeButton, "visible", false);
679 }
679 }
680
680
681+ function test_oskDisplacesWindow_data() {
682+ return [
683+ {tag: "no need to displace", windowHeight: units.gu(10), windowY: units.gu(5), targetDisplacement: units.gu(5)},
684+ {tag: "displace to top", windowHeight: units.gu(50), windowY: units.gu(10), targetDisplacement: PanelState.panelHeight},
685+ {tag: "displace a bit", windowHeight: units.gu(40), windowY: units.gu(10), targetDisplacement: (root.height / 2) - units.gu(40)},
686+ ]
687+ }
688+
681− function test_oskDisplacesWindow() {
689+ function test_oskDisplacesWindow(data) {
682 var dashAppDelegate = startApplication("unity8-dash");
690 var dashAppDelegate = startApplication("unity8-dash");
683 verify(dashAppDelegate);
691 verify(dashAppDelegate);
692+ dashAppDelegate.requestedHeight = data.windowHeight;
693+ dashAppDelegate.requestedY = data.windowY;
694+ UbuntuKeyboardInfo.height = 0;
684 var initialY = dashAppDelegate.y;
695 var initialY = dashAppDelegate.y;
685 verify(initialY > PanelState.panelHeight);
696 verify(initialY > PanelState.panelHeight);
686
697
687− UbuntuKeyboardInfo.height = units.gu(10);
698+ UbuntuKeyboardInfo.height = root.height / 2;
688− tryCompare(dashAppDelegate, "y", PanelState.panelHeight);
699+ tryCompare(dashAppDelegate, "y", data.targetDisplacement);
689
700
690 UbuntuKeyboardInfo.height = 0;
701 UbuntuKeyboardInfo.height = 0;
691 tryCompare(dashAppDelegate, "y", initialY);
702 tryCompare(dashAppDelegate, "y", initialY);