@@ -354,6 +354,58 @@ Item {
354354 verify(itemIsOnScreen(dashApps));
355355 }
356356
357+ function test_showInputMethod() {
358+ var item = findChild(shell, "inputMethod");
359+ var surface = SurfaceManager.inputMethodSurface();
360+
361+ surface.setState(MirSurfaceItem.Minimized);
362+ tryCompare(item, "visible", false);
363+
364+ surface.setState(MirSurfaceItem.Restored);
365+ tryCompare(item, "visible", true);
366+
367+ surface.setState(MirSurfaceItem.Minimized);
368+ tryCompare(item, "visible", false);
369+
370+ surface.setState(MirSurfaceItem.Maximized);
371+ tryCompare(item, "visible", true);
372+
373+ surface.setState(MirSurfaceItem.Minimized);
374+ tryCompare(item, "visible", false);
375+ }
376+
377+ function test_surfaceLosesFocusWhilePanelIsOpen() {
378+ var app = ApplicationManager.startApplication("dialer-app");
379+ // wait until the app is fully loaded (ie, real surface replaces splash screen)
380+ tryCompareFunction(function() { return app.surface != null }, true);
381+
382+ tryCompare(app.surface, "focus", true);
383+
384+ // Drag the indicators panel half-open
385+ var touchX = shell.width / 2;
386+ var indicators = findChild(shell, "indicators");
387+ touchFlick(indicators,
388+ touchX /* fromX */, indicators.panelHeight * 0.5 /* fromY */,
389+ touchX /* toX */, shell.height * 0.5 /* toY */,
390+ true /* beginTouch */, false /* endTouch */);
391+ verify(indicators.partiallyOpened);
392+
393+ tryCompare(app.surface, "focus", false);
394+
395+ // And finish getting it open
396+ touchFlick(indicators,
397+ touchX /* fromX */, shell.height * 0.5 /* fromY */,
398+ touchX /* toX */, shell.height * 0.9 /* toY */,
399+ false /* beginTouch */, true /* endTouch */);
400+ tryCompare(indicators, "fullyOpened", true);
401+
402+ tryCompare(app.surface, "focus", false);
403+
404+ dragToCloseIndicatorsPanel();
405+
406+ tryCompare(app.surface, "focus", true);
407+ }
408+
357409 // Wait for the whole UI to settle down
358410 function waitForUIToSettle() {
359411 waitUntilApplicationWindowIsFullyHidden();
@@ -361,6 +413,18 @@ Item {
361413 tryCompare(dashContentList, "moving", false);
362414 }
363415
416+ function dragToCloseIndicatorsPanel() {
417+ var indicators = findChild(shell, "indicators");
418+
419+ var touchStartX = shell.width / 2;
420+ var touchStartY = shell.height - (indicators.panelHeight * 0.5);
421+ touchFlick(shell,
422+ touchStartX, touchStartY,
423+ touchStartX, shell.height * 0.1);
424+
425+ tryCompare(indicators, "fullyClosed", true);
426+ }
427+
364428 function dragLauncherIntoView() {
365429 var launcherPanel = findChild(shell, "launcherPanel");
366430 verify(launcherPanel.x = - launcherPanel.width);
@@ -485,7 +549,7 @@ Item {
485549 {tag: "under greeter", greeter: true, app: false, launcher: false, indicators: false, expectedShown: false},
486550 {tag: "under app", greeter: false, app: true, launcher: false, indicators: false, expectedShown: false},
487551 {tag: "under launcher", greeter: false, app: false, launcher: true, indicators: false, expectedShown: true},
488− {tag: "under indicators", greeter: false, app: false, launcher: false, indicators: true, expectedShown: true},
552+ {tag: "under indicators", greeter: false, app: false, launcher: false, indicators: true, expectedShown: false},
489553 ]
490554 }
491555
@@ -515,14 +579,24 @@ Item {
515579 }
516580
517581 function test_focusRequestedHidesGreeter() {
518− var greeter = findChild(shell, "greeter")
582+ var greeter = findChild(shell, "greeter");
519583
520− greeter.show()
521− tryCompare(greeter, "showProgress", 1)
584+ var app = ApplicationManager.startApplication("dialer-app");
585+ // wait until the app is fully loaded (ie, real surface replaces splash screen)
586+ tryCompareFunction(function() { return app.surface != null }, true);
522587
523− ApplicationManager.focusRequested("notes-app")
524− tryCompare(greeter, "showProgress", 0)
525− waitUntilApplicationWindowIsFullyVisible()
588+ // Minimize the application we just launched
589+ swipeFromLeftEdge(units.gu(27));
590+
591+ // Wait for the whole UI to settle down
592+ waitUntilApplicationWindowIsFullyHidden();
593+
594+ greeter.show();
595+ tryCompare(greeter, "showProgress", 1);
596+
597+ // The main point of this test
598+ ApplicationManager.requestFocusApplication("dialer-app");
599+ tryCompare(greeter, "showProgress", 0);
526600 }
527601
528602 function test_showGreeterDBusCall() {