@@ -274,6 +274,22 @@ Item {
274274 removeTimeConstraintsFromDirectionalDragAreas(loader.item);
275275 }
276276
277+ function getIndexOf(name) {
278+ for (var i = 0; i < LightDM.Users.count; i++) {
279+ if (name === LightDM.Users.data(i, LightDM.UserRoles.NameRole)) {
280+ return i;
281+ }
282+ }
283+ fail("Didn't find name")
284+ return -1;
285+ }
286+
287+ function selectUser(name) {
288+ var i = getIndexOf(name);
289+ view.currentIndex = i;
290+ return i;
291+ }
292+
277293 function swipeAwayCover() {
278294 tryCompare(view, "fullyShown", true);
279295 var touchY = view.height / 2;
@@ -283,9 +299,20 @@ Item {
283299 waitForRendering(view);
284300 }
285301
286− function test_tease() {
287− tap(view, 1, 1);
288− compare(teaseSpy.count, 1);
302+ function test_tease_data() {
303+ return [
304+ {tag: "locked", x: 0, offset: 0, count: 0, locked: true},
305+ {tag: "left", x: 0, offset: 0, count: 1, locked: false},
306+ {tag: "leftWithOffsetPass", x: 10, offset: 10, count: 1, locked: false},
307+ {tag: "leftWithOffsetFail", x: 9, offset: 10, count: 0, locked: false},
308+ {tag: "right", x: view.width, offset: 0, count: 1, locked: false},
309+ ]
310+ }
311+ function test_tease(data) {
312+ view.locked = data.locked;
313+ view.dragHandleLeftMargin = data.offset;
314+ tap(view, data.x, 0);
315+ compare(teaseSpy.count, data.count);
289316 }
290317
291318 function test_selected() {
@@ -300,6 +327,8 @@ Item {
300327 view.locked = true;
301328 view.showPrompt("Prompt", true, true);
302329 var passwordInput = findChild(view, "passwordInput");
330+ compare(passwordInput.placeholderText, "Prompt");
331+ compare(passwordInput.echoMode, TextInput.Password);
303332 tap(passwordInput);
304333 typeString("password");
305334 keyClick(Qt.Key_Enter);
@@ -307,6 +336,19 @@ Item {
307336 compare(respondedSpy.signalArguments[0][0], "password");
308337 }
309338
339+ function test_respondedWithNonSecret() {
340+ view.locked = true;
341+ view.showPrompt("otp", false, false);
342+ var passwordInput = findChild(view, "passwordInput");
343+ compare(passwordInput.placeholderText, "otp");
344+ compare(passwordInput.echoMode, TextInput.Normal);
345+ tap(passwordInput);
346+ typeString("foo");
347+ keyClick(Qt.Key_Enter);
348+ compare(respondedSpy.count, 1);
349+ compare(respondedSpy.signalArguments[0][0], "foo");
350+ }
351+
310352 function test_respondedWithSwipe() {
311353 swipeAwayCover();
312354 compare(respondedSpy.count, 1);
@@ -324,5 +366,72 @@ Item {
324366 swipeAwayCover();
325367 tryCompare(view, "required", false);
326368 }
369+
370+ function test_showMessage() {
371+ view.showMessage("Welcome to Unity Greeter");
372+ view.showMessage("<font color=\"#df382c\">This is an error</font>");
373+ view.showMessage("You should have seen three messages and this is a really long message too. wow so long much length");
374+ var infoLabel = findChild(view, "infoLabel");
375+ compare(infoLabel.text, "Welcome to Unity Greeter<br><font color=\"#df382c\">This is an error</font><br>You should have seen three messages and this is a really long message too. wow so long much length");
376+ compare(infoLabel.textFormat, Text.StyledText);
377+ compare(infoLabel.clip, true);
378+ verify(infoLabel.contentWidth > infoLabel.width);
379+ verify(infoLabel.opacity < 1);
380+ tryCompare(infoLabel, "opacity", 1);
381+ }
382+
383+ // Escape is used to reset the authentication, especially if PAM is unresponsive
384+ function test_escape() {
385+ view.currentIndex = 1;
386+ view.locked = true;
387+ view.showPrompt("Prompt", true, true);
388+ var passwordInput = findChild(view, "passwordInput");
389+ tap(passwordInput);
390+ compare(passwordInput.focus, true);
391+ compare(passwordInput.enabled, true);
392+
393+ typeString("password");
394+ keyClick(Qt.Key_Enter);
395+ compare(passwordInput.focus, false);
396+ compare(passwordInput.enabled, false);
397+
398+ compare(selectedSpy.count, 0);
399+ keyClick(Qt.Key_Escape);
400+ compare(passwordInput.focus, false);
401+ compare(passwordInput.enabled, true);
402+ compare(selectedSpy.count, 1);
403+ compare(selectedSpy.signalArguments[0][0], 1);
404+ }
405+
406+ function test_unicode() {
407+ var index = selectUser("unicode");
408+ var label = findChild(view, "username" + index);
409+ tryCompare(label, "text", "가나다라마");
410+ }
411+
412+ function test_longName() {
413+ var index = selectUser("long-name");
414+ var label = findChild(view, "username" + index);
415+ tryCompare(label, "truncated", true);
416+ }
417+
418+ function test_promptless() {
419+ var passwordInput = findChild(view, "passwordInput");
420+
421+ view.locked = true;
422+ compare(passwordInput, "placeholderText", "Retry");
423+ tap(passwordInput);
424+ compare(respondedSpy.count, 0);
425+ compare(selectedSpy.count, 1);
426+ compare(selectedSpy.signalArguments[0][0], 0);
427+ selectedSpy.clear();
428+
429+ view.locked = false;
430+ compare(passwordInput, "placeholderText", "Tap to unlock");
431+ tap(passwordInput);
432+ compare(selectedSpy.count, 0);
433+ compare(respondedSpy.count, 1);
434+ compare(respondedSpy.signalArguments[0][0], "");
435+ }
327436 }
328437}