@@ -0,0 +1,111 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+# Copyright 2013 Canonical
3+#
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.
7+
8+
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.
12+#
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:
15+#
16+# test_testname.blacklist = (FormFactors.Tablet, FormFactors.Desktop,)
17+#
18+# Available form factors are:
19+# FormFactors.Phone
20+# FormFactors.Tablet
21+# FormFactors.Desktop
22+
23+
24+"""Tests for the Shell"""
25+
26+from __future__ import absolute_import
27+
28+from unity8.shell.tests import Unity8TestCase
29+from unity8.shell.tests.helpers import TestShellHelpers
30+
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
36+
37+import unittest
38+import time
39+import os
40+from os import path
41+
42+
43+class TestLockscreen(Unity8TestCase):
44+
45+ """Tests for the lock screen."""
46+
47+ # if model() == 'Desktop':
48+ # scenarios = [
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")),
51+ # ]
52+ # else:
53+ # scenarios = [
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")),
56+ # ]
57+
58+ # def setUp(self):
59+ # super(TestLockscreen, self).setUp()
60+
61+
62+ # dash = self.main_window.get_dash()
63+ # self.assertThat(dash.showScopeOnLoaded, Eventually(Equals(""), timeout=30))
64+
65+ def test_can_unlock_screen(self):
66+ """Must be able to unlock the screen."""
67+ self.app = self.launch_unity()
68+
69+ # def test_unlock(self):
70+ # self.unlock_greeter()
71+
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)))
76+
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)))
83+ # else:
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)))
88+
89+ # def test_unlock_wrong(self):
90+ # self.unlock_greeter()
91+
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()
97+
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))
104+
105+ # self.assertThat(pinentryField.text, Eventually(Equals("")))
106+ # self.assertThat(lockscreen.shown, Eventually(Equals(True)))
107+ # else:
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)))