@@ -15,6 +15,7 @@
1515 */
1616
1717import QtQuick 2.0
18+import QtQuick.Layouts 1.1
1819import QtTest 1.0
1920import ".."
2021import "../../../qml/Greeter"
@@ -23,12 +24,26 @@ import LightDM 0.1 as LightDM
2324import Unity.Test 0.1 as UT
2425
2526Item {
26− width: units.gu(120)
27+ id: root
28+ width: units.gu(140)
2729 height: units.gu(80)
2830
31+ QtObject {
32+ id: fakeInputMethod
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
39+ }
40+ }
41+
2942 Greeter {
3043 id: greeter
31− anchors.fill: parent
44+ width: units.gu(120)
45+ height: root.height
46+ inputMethod: fakeInputMethod
3247 locked: !LightDM.Greeter.authenticated
3348 }
3449
@@ -43,6 +58,44 @@ Item {
4358 }
4459 }
4560
61+ Rectangle {
62+ id: fakeKeyboard
63+ color: "green"
64+ opacity: 0.7
65+ anchors.bottom: root.bottom
66+ width: greeter.width
67+ height: greeter.height * 0.6
68+ visible: keyboardVisibleCheckbox.checked
69+ Text {
70+ text: "Keyboard Rectangle"
71+ color: "yellow"
72+ font.bold: true
73+ fontSizeMode: Text.Fit
74+ minimumPixelSize: 10; font.pixelSize: 200
75+ verticalAlignment: Text.AlignVCenter
76+ x: (parent.width - width) / 2
77+ y: (parent.height - height) / 2
78+ width: parent.width
79+ height: parent.height
80+ }
81+ }
82+
83+ Item {
84+ anchors {
85+ top: root.top
86+ bottom: root.bottom
87+ left: greeter.right
88+ right: root.right
89+ }
90+ RowLayout {
91+ Layout.fillWidth: true
92+ CheckBox {
93+ id: keyboardVisibleCheckbox
94+ }
95+ Label { text: "Keyboard Visible"; anchors.verticalCenter: parent.verticalCenter }
96+ }
97+ }
98+
4699 SignalSpy {
47100 id: unlockSpy
48101 target: greeter
@@ -65,6 +118,10 @@ Item {
65118 name: "MultiGreeter"
66119 when: windowShown
67120
121+ function cleanup() {
122+ keyboardVisibleCheckbox.checked = false;
123+ }
124+
68125 function select_index(i) {
69126 // We could be anywhere in list; find target index to know which direction
70127 var userlist = findChild(greeter, "userList")
@@ -382,5 +439,28 @@ Item {
382439 tryCompare(spy, "count", 1)
383440 greeterObj.destroy()
384441 }
442+
443+ function test_login_list_not_covered_by_keyboard() {
444+ var loginList = findChild(greeter, "loginLoader").item;
445+ compare(loginList.height, greeter.height);
446+
447+ // when the vkb shows up, loginList is moved up to remain fully uncovered
448+
449+ keyboardVisibleCheckbox.checked = true;
450+
451+ tryCompare(loginList, "height", greeter.height - fakeInputMethod.keyboardRectangle.height);
452+ tryCompareFunction( function() {
453+ var loginListRect = loginList.mapToItem(greeter, 0, 0, loginList.width, loginList.height);
454+ console.log("loginListRect.y " + loginListRect.y);
455+ console.log("loginListRect.height " + loginListRect.height);
456+ return loginListRect.y + loginListRect.height <= fakeInputMethod.keyboardRectangle.y;
457+ }, true);
458+
459+ // once the vkb goes away, loginList goes back to its full height
460+
461+ keyboardVisibleCheckbox.checked = false;
462+
463+ tryCompare(loginList, "height", greeter.height);
464+ }
385465 }
386466}