@@ -15,6 +15,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18+import QtQuick.Layouts 1.1
18import QtTest 1.0
19import QtTest 1.0
19import ".."
20import ".."
20import "../../../qml/Greeter"
21import "../../../qml/Greeter"
@@ -23,9 +24,21 @@ import LightDM 0.1 as LightDM
23import Unity.Test 0.1 as UT
24import Unity.Test 0.1 as UT
26− width: units.gu(120)
28+ width: units.gu(140)
27 height: units.gu(80)
29 height: units.gu(80)
33+ property bool visible: fakeKeyboard.visible
34+ property var keyboardRectangle: QtObject {
35+ property real x: fakeKeyboard.x
36+ property real y: fakeKeyboard.y
37+ property real width: fakeKeyboard.width
38+ property real height: fakeKeyboard.height
30 target: LightDM.Greeter
43 target: LightDM.Greeter
31 property: "mockMode"
44 property: "mockMode"
@@ -39,7 +52,9 @@ Item {
41 id: greeter
54 id: greeter
42− anchors.fill: parent
55+ width: units.gu(120)
57+ inputMethod: fakeInputMethod
43 locked: !LightDM.Greeter.authenticated
58 locked: !LightDM.Greeter.authenticated
@@ -54,6 +69,44 @@ Item {
76+ anchors.bottom: root.bottom
78+ height: greeter.height * 0.6
79+ visible: keyboardVisibleCheckbox.checked
81+ text: "Keyboard Rectangle"
84+ fontSizeMode: Text.Fit
85+ minimumPixelSize: 10; font.pixelSize: 200
86+ verticalAlignment: Text.AlignVCenter
87+ x: (parent.width - width) / 2
88+ y: (parent.height - height) / 2
90+ height: parent.height
102+ Layout.fillWidth: true
104+ id: keyboardVisibleCheckbox
106+ Label { text: "Keyboard Visible"; anchors.verticalCenter: parent.verticalCenter }
57 SignalSpy {
110 SignalSpy {
58 id: unlockSpy
111 id: unlockSpy
59 target: greeter
112 target: greeter
@@ -76,6 +129,10 @@ Item {
76 name: "MultiGreeter"
129 name: "MultiGreeter"
77 when: windowShown
130 when: windowShown
132+ function cleanup() {
133+ keyboardVisibleCheckbox.checked = false;
79 function select_index(i) {
136 function select_index(i) {
80 // We could be anywhere in list; find target index to know which direction
137 // We could be anywhere in list; find target index to know which direction
81 var userlist = findChild(greeter, "userList")
138 var userlist = findChild(greeter, "userList")
@@ -393,5 +450,26 @@ Item {
393 tryCompare(spy, "count", 1)
450 tryCompare(spy, "count", 1)
394 greeterObj.destroy()
451 greeterObj.destroy()
454+ function test_login_list_not_covered_by_keyboard() {
455+ var loginList = findChild(greeter, "loginLoader").item;
456+ compare(loginList.height, greeter.height);
458+ // when the vkb shows up, loginList is moved up to remain fully uncovered
460+ keyboardVisibleCheckbox.checked = true;
462+ tryCompare(loginList, "height", greeter.height - fakeInputMethod.keyboardRectangle.height);
463+ tryCompareFunction( function() {
464+ var loginListRect = loginList.mapToItem(greeter, 0, 0, loginList.width, loginList.height);
465+ return loginListRect.y + loginListRect.height <= fakeInputMethod.keyboardRectangle.y;
468+ // once the vkb goes away, loginList goes back to its full height
470+ keyboardVisibleCheckbox.checked = false;
472+ tryCompare(loginList, "height", greeter.height);