on xenial help sign in
improve it actual logic and the tests for it
commit2fa34a60474188f31a61a17defeb0a284f2b6bd5 authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 23 Jun 2016, 13:23 (10 years ago) parent866d754
2 files changed+15−4
qml/Stages/DesktopStage.qml+1−1 tests/qmltests/Stages/tst_DesktopStage.qml+14−3
qml/Stages/DesktopStage.qml+1−1
@@ -273,7 +273,7 @@ AbstractStage {
273273 property: "y"
274274 value: appDelegate.requestedY -
275275 Math.min(appDelegate.requestedY - PanelState.panelHeight,
276− UbuntuKeyboardInfo.height)
276+ Math.max(0, UbuntuKeyboardInfo.height - (appContainer.height - (appDelegate.requestedY + appDelegate.height))))
277277 when: appDelegate.focus
278278 }
279279
tests/qmltests/Stages/tst_DesktopStage.qml+14−3
@@ -678,14 +678,25 @@ Item {
678678 tryCompare(closeButton, "visible", false);
679679 }
680680
681− function test_oskDisplacesWindow() {
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+
689+ function test_oskDisplacesWindow(data) {
682690 var dashAppDelegate = startApplication("unity8-dash");
683691 verify(dashAppDelegate);
692+ dashAppDelegate.requestedHeight = data.windowHeight;
693+ dashAppDelegate.requestedY = data.windowY;
694+ UbuntuKeyboardInfo.height = 0;
684695 var initialY = dashAppDelegate.y;
685696 verify(initialY > PanelState.panelHeight);
686697
687− UbuntuKeyboardInfo.height = units.gu(10);
688− tryCompare(dashAppDelegate, "y", PanelState.panelHeight);
698+ UbuntuKeyboardInfo.height = root.height / 2;
699+ tryCompare(dashAppDelegate, "y", data.targetDisplacement);
689700
690701 UbuntuKeyboardInfo.height = 0;
691702 tryCompare(dashAppDelegate, "y", initialY);