@@ -1,387 +0,0 @@
2− * Copyright (C) 2013,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/>.
19−import AccountsService 0.1
21−import LightDM 0.1 as LightDM
22−import Ubuntu.Components 1.1
23−import Ubuntu.Telephony 0.1 as Telephony
24−import Unity.Application 0.1
25−import Unity.Connectivity 0.1
38− target: MouseTouchAdaptor
43− Component.onCompleted: {
44− GSettingsController.setUsageMode("com.canonical.Unity8", "Windowed")
45− // must set the mock mode before loading the Shell
46− LightDM.Greeter.mockMode = "full";
47− LightDM.Users.mockMode = "full";
49− // ensures apps which are tested decorations are in view.
50− WindowStateStorage.geometry = {
51− 'unity8-dash': Qt.rect(0, units.gu(3), units.gu(50), units.gu(40)),
52− 'dialer-app': Qt.rect(units.gu(51), units.gu(3), units.gu(50), units.gu(40)),
53− 'camera-app': Qt.rect(0, units.gu(44), units.gu(50), units.gu(40)),
56− shellLoader.active = true;
60− id: applicationArguments
62− function hasGeometry() {
81− width: parent.width - units.gu(30)
82− height: parent.height
84− property bool itemDestroyed: false
85− sourceComponent: Component {
87− property string indicatorProfile: "desktop"
89− Component.onDestruction: {
90− shellLoader.itemDestroyed = true
99− height: parent.height
102− anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
103− spacing: units.gu(1)
105− text: "Show Greeter"
107− if (shellLoader.status !== Loader.Ready)
110− var greeter = testCase.findChild(shellLoader.item, "greeter")
111− if (!greeter.shown) {
117− text: "Hide Greeter"
119− if (shellLoader.status !== Loader.Ready)
122− var greeter = testCase.findChild(shellLoader.item, "greeter")
123− if (greeter.shown) {
130− text: "Start all apps"
132− for (var i = 0; i < ApplicationManager.availableApplications.length; i++) {
133− var appId = ApplicationManager.availableApplications[i];
134− if (ApplicationManager.findApplication(appId) == null) {
135− print("starting", appId)
136− ApplicationManager.startApplication(appId)
144− model: ApplicationManager.availableApplications
149− height: childrenRect.height
153− enabled: modelData != "unity8-dash"
154− property var application: null
156− Component.onCompleted: {
157− application = ApplicationManager.findApplication(modelData);
161− target: ApplicationManager
163− appColumn.application = ApplicationManager.findApplication(modelData);
170− if (checked) ApplicationManager.startApplication(modelData);
171− else ApplicationManager.stopApplication(modelData);
176− value: appColumn.application != null
181− text: appColumn.application ? appColumn.application.name : modelData
192− signalName: "sessionStarted"
196− id: dashCommunicatorSpy
197− signalName: "setCurrentScopeCalled"
201− id: unlockAllModemsSpy
202− target: Connectivity
203− signalName: "unlockingAllModems"
208− name: "DesktopShell"
211− property Item shell: shellLoader.status === Loader.Ready ? shellLoader.item : null
214− tryCompare(shell, "enabled", true); // will be enabled when greeter is all ready
215− var userList = findChild(shell, "userList");
216− tryCompare(userList, "movingInternally", false);
218− sessionSpy.target = findChild(shell, "greeter")
219− dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator")
222− function cleanup() {
223− tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
225− shellLoader.itemDestroyed = false
227− shellLoader.active = false
229− tryCompare(shellLoader, "status", Loader.Null)
230− tryCompare(shellLoader, "item", null)
231− // Loader.status might be Loader.Null and Loader.item might be null but the Loader
232− // item might still be alive. So if we set Loader.active back to true
233− // again right now we will get the very same Shell instance back. So no reload
234− // actually took place. Likely because Loader waits until the next event loop
235− // iteration to do its work. So to ensure the reload, we will wait until the
236− // Shell instance gets destroyed.
237− tryCompare(shellLoader, "itemDestroyed", true)
239− // kill all (fake) running apps
242− unlockAllModemsSpy.clear()
243− AccountsService.demoEdges = false
244− LightDM.Greeter.authenticate(""); // reset greeter
246− // reload our test subject to get it in a fresh state once again
247− shellLoader.active = true
249− tryCompare(shellLoader, "status", Loader.Ready)
250− removeTimeConstraintsFromDirectionalDragAreas(shellLoader.item)
253− function killApps() {
254− while (ApplicationManager.count > 1) {
255− var appIndex = ApplicationManager.get(0).appId == "unity8-dash" ? 1 : 0
256− ApplicationManager.stopApplication(ApplicationManager.get(appIndex).appId)
258− compare(ApplicationManager.count, 1)
261− function selectIndex(i) {
262− // We could be anywhere in list; find target index to know which direction
263− var greeter = findChild(shell, "greeter")
264− var userlist = findChild(greeter, "userList")
265− if (userlist.currentIndex == i)
266− keyClick(Qt.Key_Escape) // Reset state if we're not moving
267− while (userlist.currentIndex != i) {
268− var next = userlist.currentIndex + 1
269− if (userlist.currentIndex > i) {
270− next = userlist.currentIndex - 1
272− tap(findChild(greeter, "username"+next));
273− tryCompare(userlist, "currentIndex", next)
274− tryCompare(userlist, "movingInternally", false)
278− function selectUser(name) {
279− // Find index of user with the right name
280− for (var i = 0; i < LightDM.Users.count; i++) {
281− if (LightDM.Users.data(i, LightDM.UserRoles.NameRole) == name) {
285− if (i == LightDM.Users.count) {
286− fail("Didn't find name")
293− function clickPasswordInput(isButton) {
294− var greeter = findChild(shell, "greeter")
295− tryCompare(greeter, "fullyShown", true);
297− var passwordMouseArea = findChild(shell, "passwordMouseArea")
298− tryCompare(passwordMouseArea, "enabled", isButton)
300− var passwordInput = findChild(shell, "passwordInput")
301− mouseClick(passwordInput)
304− function confirmLoggedIn(loggedIn) {
305− var greeter = findChild(shell, "greeter");
306− tryCompare(greeter, "shown", loggedIn ? false : true);
307− verify(loggedIn ? sessionSpy.count > 0 : sessionSpy.count === 0);
310− function swipeFromLeftEdge(swipeLength) {
312− var touchStartY = shell.height / 2
313− touchFlick(shell, touchStartX, touchStartY, swipeLength, touchStartY)
316− function waitUntilAppSurfaceShowsUp(appId) {
317− var appWindow = findChild(shell, "appWindow_" + appId);
319− var appWindowStates = findInvisibleChild(appWindow, "applicationWindowStateGroup");
320− verify(appWindowStates);
321− tryCompare(appWindowStates, "state", "surface");
324− function startApplication(appId) {
325− var app = ApplicationManager.findApplication(appId);
327− app = ApplicationManager.startApplication(appId);
330− waitUntilAppSurfaceShowsUp(appId);
331− verify(app.session.surface);
335− function test_appFocusSwitch_data() {
337− {tag: "dash", apps: [ "unity8-dash", "dialer-app", "camera-app" ], focusfrom: 0, focusTo: 1 },
338− {tag: "dash", apps: [ "unity8-dash", "dialer-app", "camera-app" ], focusfrom: 1, focusTo: 0 },
342− function test_appFocusSwitch(data) {
343− selectUser("no-password");
344− clickPasswordInput(true)
345− confirmLoggedIn(true);
348− for (i = 0; i < data.apps.length; i++) {
349− startApplication(data.apps[i]);
352− ApplicationManager.requestFocusApplication(data.apps[data.focusfrom]);
353− tryCompare(ApplicationManager.findApplication(data.apps[data.focusfrom]).session.surface, "activeFocus", true);
355− ApplicationManager.requestFocusApplication(data.apps[data.focusTo]);
356− tryCompare(ApplicationManager.findApplication(data.apps[data.focusTo]).session.surface, "activeFocus", true);
359− function test_decorationPressFocusesApplication_data() {
361− {tag: "dash", apps: [ "unity8-dash", "dialer-app", "camera-app" ], focusfrom: 0, focusTo: 1 },
362− {tag: "dash", apps: [ "unity8-dash", "dialer-app", "camera-app" ], focusfrom: 1, focusTo: 0 },
366− function test_decorationPressFocusesApplication(data) {
367− selectUser("no-password");
368− clickPasswordInput(true)
369− confirmLoggedIn(true);
372− for (i = 0; i < data.apps.length; i++) {
373− startApplication(data.apps[i]);
376− var fromAppDecoration = findChild(shell, "appWindowDecoration_" + data.apps[data.focusfrom]);
377− verify(fromAppDecoration);
378− mouseClick(fromAppDecoration);
379− tryCompare(ApplicationManager.findApplication(data.apps[data.focusfrom]).session.surface, "activeFocus", true);
381− var toAppDecoration = findChild(shell, "appWindowDecoration_" + data.apps[data.focusTo]);
382− verify(toAppDecoration);
383− mouseClick(toAppDecoration);
384− tryCompare(ApplicationManager.findApplication(data.apps[data.focusTo]).session.surface, "activeFocus", true);