@@ -0,0 +1,111 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+# Copyright 2013 Canonical
4+# This program is free software: you can redistribute it and/or modify it
5+# under the terms of the GNU General Public License version 3, as published
6+# by the Free Software Foundation.
9+# This file contains general purpose test cases for Unity.
10+# Each test written in this file will be executed for a variety of
11+# configurations, such as Phone, Tablet or Desktop form factors.
13+# Sometimes there is the need to disable a certain test for a particular
14+# configuration. To do so, add this in a new line directly below your test:
16+# test_testname.blacklist = (FormFactors.Tablet, FormFactors.Desktop,)
18+# Available form factors are:
24+"""Tests for the Shell"""
26+from __future__ import absolute_import
28+from unity8.shell.tests import Unity8TestCase
29+from unity8.shell.tests.helpers import TestShellHelpers
31+from autopilot.input import Mouse, Touch, Pointer
32+from testtools.matchers import Equals, NotEquals, GreaterThan, MismatchError
33+from autopilot.matchers import Eventually
34+from autopilot.display import Display
35+from autopilot.platform import model
43+class TestLockscreen(Unity8TestCase):
45+ """Tests for the lock screen."""
47+ # if model() == 'Desktop':
49+ # ('Pinlock', dict(app_width=768, app_height=1280, grid_unit_px=18, lightdm_mock="single-pin")),
50+ # ('Keylock', dict(app_width=768, app_height=1280, grid_unit_px=18, lightdm_mock="single-passphrase")),
54+ # ('Pinlock', dict(app_width=0, app_height=0, grid_unit_px=0, lightdm_mock="single-pin")),
55+ # ('Keylock', dict(app_width=0, app_height=0, grid_unit_px=0, lightdm_mock="single-key")),
59+ # super(TestLockscreen, self).setUp()
62+ # dash = self.main_window.get_dash()
63+ # self.assertThat(dash.showScopeOnLoaded, Eventually(Equals(""), timeout=30))
65+ def test_can_unlock_screen(self):
66+ """Must be able to unlock the screen."""
67+ self.app = self.launch_unity()
69+ # def test_unlock(self):
70+ # self.unlock_greeter()
72+ # pinPadLoader = self.main_window.get_pinPadLoader();
73+ # self.assertThat(pinPadLoader.progress, Eventually(Equals(1)))
74+ # lockscreen = self.main_window.get_lockscreen();
75+ # self.assertThat(lockscreen.shown, Eventually(Equals(True)))
77+ # if self.lightdm_mock == "single-pin":
78+ # self.touch.tap_object(self.main_window.get_pinPadButton(1))
79+ # self.touch.tap_object(self.main_window.get_pinPadButton(2))
80+ # self.touch.tap_object(self.main_window.get_pinPadButton(3))
81+ # self.touch.tap_object(self.main_window.get_pinPadButton(4))
82+ # self.assertThat(lockscreen.shown, Eventually(Equals(False)))
84+ # pinentryField = self.main_window.get_pinentryField()
85+ # self.touch.tap_object(pinentryField)
86+ # self.keyboard.type("password\n")
87+ # self.assertThat(lockscreen.shown, Eventually(Equals(False)))
89+ # def test_unlock_wrong(self):
90+ # self.unlock_greeter()
92+ # pinPadLoader = self.main_window.get_pinPadLoader();
93+ # self.assertThat(pinPadLoader.progress, Eventually(Equals(1)))
94+ # lockscreen = self.main_window.get_lockscreen();
95+ # self.assertThat(lockscreen.shown, Eventually(Equals(True)))
96+ # pinentryField = self.main_window.get_pinentryField()
98+ # if self.lightdm_mock == "single-pin":
99+ # self.touch.tap_object(self.main_window.get_pinPadButton(4))
100+ # self.touch.tap_object(self.main_window.get_pinPadButton(3))
101+ # self.touch.tap_object(self.main_window.get_pinPadButton(2))
102+ # self.assertThat(pinentryField.text, Eventually(Equals("432")))
103+ # self.touch.tap_object(self.main_window.get_pinPadButton(1))
105+ # self.assertThat(pinentryField.text, Eventually(Equals("")))
106+ # self.assertThat(lockscreen.shown, Eventually(Equals(True)))
108+ # self.touch.tap_object(pinentryField)
109+ # self.keyboard.type("foobar\n")
110+ # self.assertThat(pinentryField.text, Eventually(Equals("")))
111+ # self.assertThat(lockscreen.shown, Eventually(Equals(True)))