@@ -0,0 +1,332 @@
2+ * Copyright 2014 Canonical Ltd.
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20+import "../../../qml/Greeter"
21+import LightDM 0.1 as LightDM
22+import Ubuntu.Components 0.1
23+import Unity.Test 0.1 as UT
34+ width: root.width - controls.width
35+ height: parent.height
37+ property bool itemDestroyed: false
38+ sourceComponent: Component {
40+ background: Qt.resolvedUrl("../../../qml/graphics/phone_background.jpg")
41+ userModel: LightDM.Users
42+ infographicModel: LightDM.Infographic
44+ launcherOffset: parseFloat(launcherOffsetField.text)
45+ currentIndex: parseInt(currentIndexField.text, 10)
46+ delayMinutes: parseInt(delayMinutesField.text, 10)
47+ backgroundTopMargin: parseFloat(backgroundTopMarginField.text)
48+ locked: lockedCheckBox.checked
49+ alphanumeric: alphanumericCheckBox.checked
51+ Component.onDestruction: {
52+ loader.itemDestroyed = true
56+ currentIndexField.text = index;
66+ height: parent.height
69+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
74+ text: "Show Last Chance"
75+ onClicked: loader.item.showLastChance()
81+ onClicked: loader.item.hide()
87+ onClicked: loader.item.reset()
93+ onClicked: loader.item.showMessage(messageField.text)
104+ onClicked: loader.item.showPrompt(promptField.text, isSecretCheckBox.checked, isDefaultPromptCheckBox.checked)
112+ id: isSecretCheckBox
118+ id: isDefaultPromptCheckBox
126+ text: "Authenticated"
127+ onClicked: loader.item.authenticated(successCheckBox.checked)
138+ text: "Try To Unlock"
139+ onClicked: loader.item.tryToUnlock(toTheRightCheckBox.checked)
142+ id: toTheRightCheckBox
150+ id: launcherOffsetField
155+ text: "launcherOffset"
160+ id: currentIndexField
165+ text: "currentIndex"
170+ id: delayMinutesField
175+ text: "delayMinutes"
180+ id: backgroundTopMarginField
185+ text: "backgroundTopMargin"
198+ id: alphanumericCheckBox
201+ text: "alphanumeric"
206+ text: "selected: " + selectedSpy.count
211+ text: "responded: " + respondedSpy.count
216+ text: "teased: " + teaseSpy.count
221+ text: "emergency: " + emergencySpy.count
228+ loader.active = false;
229+ loader.active = true;
240+ signalName: "selected"
246+ signalName: "responded"
258+ signalName: "emergencyCall"
265+ property Item view: loader.status === Loader.Ready ? loader.item : null
268+ view.currentIndex = 0; // break binding with text field
269+ selectedSpy.clear();
270+ respondedSpy.clear();
272+ emergencySpy.clear();
275+ function cleanup() {
276+ loader.itemDestroyed = false;
277+ loader.active = false;
278+ tryCompare(loader, "status", Loader.Null);
279+ tryCompare(loader, "item", null);
280+ tryCompare(loader, "itemDestroyed", true);
281+ loader.active = true;
282+ tryCompare(loader, "status", Loader.Ready);
283+ removeTimeConstraintsFromDirectionalDragAreas(loader.item);
286+ function swipeAwayCover() {
287+ tryCompare(view, "fullyShown", true);
288+ var touchY = view.height / 2;
289+ touchFlick(view, view.width, touchY, 0, touchY);
290+ var coverPage = findChild(view, "coverPage");
291+ tryCompare(coverPage, "showProgress", 0);
292+ waitForRendering(view);
295+ function enterPin(pin) {
296+ for (var i = 0; i < pin.length; ++i) {
297+ var character = pin.charAt(i);
298+ var button = findChild(view, "pinPadButton" + character);
303+ function test_tease() {
305+ compare(teaseSpy.count, 1);
308+ function test_respondedWithPin() {
312+ compare(respondedSpy.count, 1);
313+ compare(respondedSpy.signalArguments[0][0], "1234");
316+ function test_respondedWithPassphrase() {
318+ view.alphanumeric = true;
321+ keyClick(Qt.Key_Enter);
322+ compare(respondedSpy.count, 1);
323+ compare(respondedSpy.signalArguments[0][0], "test");
326+ function test_respondedWithSwipe() {
328+ compare(respondedSpy.count, 1);
329+ compare(respondedSpy.signalArguments[0][0], "");