@@ -504,6 +504,33 @@ Item {
504504 tryCompare(MirFocusController, "focusedSurface", null); // verify still no surface is focused
505505 }
506506
507+ function test_oskDisplacesWindow_data() {
508+ return [
509+ {tag: "no need to displace", windowHeight: units.gu(10), windowY: units.gu(5), targetDisplacement: units.gu(5)},
510+ {tag: "displace to top", windowHeight: units.gu(50), windowY: units.gu(10), targetDisplacement: PanelState.panelHeight},
511+ {tag: "displace a bit", windowHeight: units.gu(40), windowY: units.gu(10), targetDisplacement: (root.height / 2) - units.gu(40)},
512+ ]
513+ }
514+
515+ function test_oskDisplacesWindow(data) {
516+ var dashAppDelegate = startApplication("unity8-dash");
517+ var oldOSKState = SurfaceManager.inputMethodSurface.state;
518+ SurfaceManager.inputMethodSurface.state = Mir.RestoredState;
519+ verify(dashAppDelegate);
520+ dashAppDelegate.requestedHeight = data.windowHeight;
521+ dashAppDelegate.requestedY = data.windowY;
522+ UbuntuKeyboardInfo.height = 0;
523+ var initialY = dashAppDelegate.y;
524+ verify(initialY > PanelState.panelHeight);
525+
526+ UbuntuKeyboardInfo.height = root.height / 2;
527+ tryCompare(dashAppDelegate, "y", data.targetDisplacement);
528+
529+ UbuntuKeyboardInfo.height = 0;
530+ tryCompare(dashAppDelegate, "y", initialY);
531+ SurfaceManager.inputMethodSurface.state = oldOSKState;
532+ }
533+
507534 function test_minimizeApplicationHidesSurface() {
508535 compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
509536 var dashSurface = topSurfaceList.surfaceAt(0);
@@ -677,32 +704,5 @@ Item {
677704 var closeButton = findChild(dashAppDelegate, "closeWindowButton");
678705 tryCompare(closeButton, "visible", false);
679706 }
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−
689− function test_oskDisplacesWindow(data) {
690− var dashAppDelegate = startApplication("unity8-dash");
691− var oldOSKState = SurfaceManager.inputMethodSurface.state;
692− SurfaceManager.inputMethodSurface.state = Mir.RestoredState;
693− verify(dashAppDelegate);
694− dashAppDelegate.requestedHeight = data.windowHeight;
695− dashAppDelegate.requestedY = data.windowY;
696− UbuntuKeyboardInfo.height = 0;
697− var initialY = dashAppDelegate.y;
698− verify(initialY > PanelState.panelHeight);
699−
700− UbuntuKeyboardInfo.height = root.height / 2;
701− tryCompare(dashAppDelegate, "y", data.targetDisplacement);
702−
703− UbuntuKeyboardInfo.height = 0;
704− tryCompare(dashAppDelegate, "y", initialY);
705− SurfaceManager.inputMethodSurface.state = oldOSKState;
706− }
707707 }
708708}