on xenial help sign in
merge dednick's branch
22f86a7Michael Zanetti
tests/mocks/GSettings.1.0/fake_gsettings.h+2−2
@@ -78,10 +78,10 @@ public:
78 ~GSettingsControllerQml();
78 ~GSettingsControllerQml();
79
79
80 QString pictureUri() const;
80 QString pictureUri() const;
81− void setPictureUri(const QString &str);
81+ Q_INVOKABLE void setPictureUri(const QString &str);
82
82
83 QString usageMode() const;
83 QString usageMode() const;
84− void setUsageMode(const QString &usageMode);
84+ Q_INVOKABLE void setUsageMode(const QString &usageMode);
85
85
86Q_SIGNALS:
86Q_SIGNALS:
87 void pictureUriChanged(const QString&);
87 void pictureUriChanged(const QString&);
tests/mocks/GSettings.1.0/plugin.cpp+6
@@ -19,8 +19,14 @@
19
19
20#include <QtQml/qqml.h>
20#include <QtQml/qqml.h>
21
21
22+static QObject* controllerProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
23+{
24+ return GSettingsControllerQml::instance();
25+}
26+
22void FakeGSettingsQmlPlugin::registerTypes(const char *uri)
27void FakeGSettingsQmlPlugin::registerTypes(const char *uri)
23{
28{
29+ qmlRegisterSingletonType<GSettingsControllerQml>(uri, 1, 0, "GSettingsController", controllerProvider);
24 qmlRegisterType<GSettingsQml>(uri, 1, 0, "GSettings");
30 qmlRegisterType<GSettingsQml>(uri, 1, 0, "GSettings");
25 qmlRegisterUncreatableType<GSettingsSchemaQml>(uri, 1, 0, "GSettingsSchema",
31 qmlRegisterUncreatableType<GSettingsSchemaQml>(uri, 1, 0, "GSettingsSchema",
26 "GSettingsSchema can only be used inside of a GSettings component");
32 "GSettingsSchema can only be used inside of a GSettings component");
tests/mocks/Utils/CMakeLists.txt+2
@@ -19,6 +19,8 @@ set(QMLPLUGIN_SRC
19 ${CMAKE_SOURCE_DIR}/plugins/Utils/easingcurve.cpp
19 ${CMAKE_SOURCE_DIR}/plugins/Utils/easingcurve.cpp
20 ${CMAKE_SOURCE_DIR}/plugins/Utils/inputwatcher.cpp
20 ${CMAKE_SOURCE_DIR}/plugins/Utils/inputwatcher.cpp
21 ${CMAKE_SOURCE_DIR}/plugins/Utils/spreadflickable.cpp
21 ${CMAKE_SOURCE_DIR}/plugins/Utils/spreadflickable.cpp
22+ constants.cpp
23+ plugin.cpp
22 windowstatestorage.cpp
24 windowstatestorage.cpp
23 plugin.cpp
25 plugin.cpp
24 )
26 )
tests/mocks/Utils/constants.cppnew file+23
@@ -0,0 +1,23 @@
1+/*
2+ * Copyright 2015 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU Lesser General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
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 Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+*/
16+
17+#include "constants.h"
18+
19+Constants::Constants(QObject *parent)
20+ : QObject(parent)
21+{
22+ m_indicatorValueTimeout = 5000;
23+}
tests/mocks/Utils/constants.hnew file+43
@@ -0,0 +1,43 @@
1+/*
2+ * Copyright 2015 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU Lesser General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
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 Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+*/
16+
17+#ifndef CONSTANTS_H
18+#define CONSTANTS_H
19+
20+#include <QObject>
21+
22+/**
23+ * @brief The Constants class
24+ *
25+ * This singleton class exposes contants to Qml
26+ *
27+ */
28+
29+class Constants: public QObject
30+{
31+ Q_OBJECT
32+ Q_PROPERTY(int indicatorValueTimeout READ indicatorValueTimeout CONSTANT)
33+
34+public:
35+ Constants(QObject *parent = 0);
36+
37+ int indicatorValueTimeout() const { return m_indicatorValueTimeout; }
38+
39+private:
40+ int m_indicatorValueTimeout;
41+};
42+
43+#endif
tests/mocks/Utils/plugin.cpp+10−1
@@ -25,15 +25,16 @@
25
25
26// local
26// local
27#include "inputwatcher.h"
27#include "inputwatcher.h"
28−#include "easingcurve.h"
29#include "qlimitproxymodelqml.h"
28#include "qlimitproxymodelqml.h"
30#include "unitysortfilterproxymodelqml.h"
29#include "unitysortfilterproxymodelqml.h"
31#include "relativetimeformatter.h"
30#include "relativetimeformatter.h"
32#include "timeformatter.h"
31#include "timeformatter.h"
33#include "unitymenumodelpaths.h"
32#include "unitymenumodelpaths.h"
34#include "windowkeysfilter.h"
33#include "windowkeysfilter.h"
34+#include "easingcurve.h"
35#include "windowstatestorage.h"
35#include "windowstatestorage.h"
36#include "spreadflickable.h"
36#include "spreadflickable.h"
37+#include "constants.h"
37
38
38static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine)
39static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine)
39{
40{
@@ -42,6 +43,13 @@ static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEn
42 return new WindowStateStorage();
43 return new WindowStateStorage();
43}
44}
44
45
46+static QObject *createConstants(QQmlEngine *engine, QJSEngine *scriptEngine)
47+{
48+ Q_UNUSED(engine)
49+ Q_UNUSED(scriptEngine)
50+ return new Constants();
51+}
52+
45void FakeUtilsPlugin::registerTypes(const char *uri)
53void FakeUtilsPlugin::registerTypes(const char *uri)
46{
54{
47 Q_ASSERT(uri == QLatin1String("Utils"));
55 Q_ASSERT(uri == QLatin1String("Utils"));
@@ -57,6 +65,7 @@ void FakeUtilsPlugin::registerTypes(const char *uri)
57 qmlRegisterSingletonType<WindowStateStorage>(uri, 0, 1, "WindowStateStorage", createWindowStateStorage);
65 qmlRegisterSingletonType<WindowStateStorage>(uri, 0, 1, "WindowStateStorage", createWindowStateStorage);
58 qmlRegisterType<InputWatcher>(uri, 0, 1, "InputWatcher");
66 qmlRegisterType<InputWatcher>(uri, 0, 1, "InputWatcher");
59 qmlRegisterType<SpreadFlickable>(uri, 0, 1, "SpreadFlickable");
67 qmlRegisterType<SpreadFlickable>(uri, 0, 1, "SpreadFlickable");
68+ qmlRegisterSingletonType<Constants>(uri, 0, 1, "Constants", createConstants);
60}
69}
61
70
62void FakeUtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
71void FakeUtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
tests/qmltests/Stages/ApplicationCheckBox.qml+49−20
@@ -22,27 +22,67 @@ import Unity.Application 0.1
22RowLayout {
22RowLayout {
23 id: root
23 id: root
24 property string appId
24 property string appId
25− property alias checked: checkbox.checked
25+ property bool checked: false
26
26
27 enabled: appId !== "unity8-dash"
27 enabled: appId !== "unity8-dash"
28
28
29+ onCheckedChanged: {
30+ if (d.bindGuard) { return; }
31+ d.bindGuard = true;
32+
33+ if (checked) {
34+ ApplicationManager.startApplication(root.appId);
35+ } else {
36+ ApplicationManager.stopApplication(root.appId);
37+ }
38+ d.bindGuard = false;
39+ }
40+
41+ QtObject {
42+ id: d
43+ property bool bindGuard: false
44+ property var application: null
45+ Component.onCompleted: {
46+ application = ApplicationManager.findApplication(root.appId);
47+ }
48+ }
49+
50+ Connections {
51+ target: ApplicationManager
52+ onCountChanged: {
53+ d.application = ApplicationManager.findApplication(root.appId);
54+ }
55+ }
56+
29 Layout.fillWidth: true
57 Layout.fillWidth: true
30 CheckBox {
58 CheckBox {
31 id: checkbox
59 id: checkbox
32 checked: false
60 checked: false
33 activeFocusOnPress: false
61 activeFocusOnPress: false
34− property bool noop: false
62+
35− onCheckedChanged: {
63+ onTriggered: {
36− if (noop) {
37− return;
64+ if (d.bindGuard) { return; }
38− }
65+ d.bindGuard = true;
66+
39 if (checked) {
67 if (checked) {
40− var application = ApplicationManager.startApplication(root.appId);
68+ ApplicationManager.startApplication(root.appId);
41− appConnections.target = application;
42 } else {
69 } else {
43− appConnections.target = null;
44 ApplicationManager.stopApplication(root.appId);
70 ApplicationManager.stopApplication(root.appId);
45 }
71 }
72+ d.bindGuard = false;
73+ }
74+ onCheckedChanged: {
75+ if (d.bindGuard) { return; }
76+ d.bindGuard = true;
77+
78+ root.checked = checked;
79+
80+ d.bindGuard = false;
81+ }
82+ Binding {
83+ target: checkbox
84+ property: "checked"
85+ value: d.application != null
46 }
86 }
47 }
87 }
48 Label {
88 Label {
@@ -50,15 +90,4 @@ RowLayout {
50 color: "white"
90 color: "white"
51 anchors.verticalCenter: parent.verticalCenter
91 anchors.verticalCenter: parent.verticalCenter
52 }
92 }
53−
54− Connections {
55− id: appConnections
56− onStateChanged: {
57− if (target.state == ApplicationInfoInterface.Stopped) {
58− checkbox.noop = true;
59− checkbox.checked = false;
60− checkbox.noop = false;
61− }
62− }
63− }
64}
93}
tests/qmltests/Stages/tst_DesktopStage.qml+56−67
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2015 Canonical, Ltd.
2+ * Copyright (C) 2013,2014 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
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
5 * it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@ import Ubuntu.Components 1.1
20import Ubuntu.Components.ListItems 1.0 as ListItem
20import Ubuntu.Components.ListItems 1.0 as ListItem
21import Unity.Application 0.1
21import Unity.Application 0.1
22import Unity.Test 0.1
22import Unity.Test 0.1
23+import Utils 0.1
23
24
24import "../../../qml/Stages"
25import "../../../qml/Stages"
25
26
@@ -29,31 +30,18 @@ Rectangle {
29 width: desktopStageLoader.width + controls.width
30 width: desktopStageLoader.width + controls.width
30 height: desktopStageLoader.height
31 height: desktopStageLoader.height
31
32
32− QtObject {
33+ Binding {
33− id: fakeWindowStateStorage
34+ target: MouseTouchAdaptor
34−
35− property var storedGeom: [
35+ property: "enabled"
36− ["unity8-dash", Qt.rect(units.gu(2), units.gu(2), units.gu(50), units.gu(50))],
36+ value: false
37− ["webbrowser-app", Qt.rect(units.gu(60), units.gu(2), units.gu(50), units.gu(50))]
37+ }
38− ]
39
38
40− function saveGeometry(windowId, geometry) {
39+ Component.onCompleted: {
41− for (var i = 0; i < storedGeom.length; ++i) {
40+ // ensures apps which are tested decorations are in view.
42− if (storedGeom[i][0] === windowId) {
41+ WindowStateStorage.geometry = {
43− storedGeom[i][1] = geometry;
42+ 'unity8-dash': Qt.rect(0, units.gu(3), units.gu(50), units.gu(40)),
44− return;
43+ 'dialer-app': Qt.rect(units.gu(51), units.gu(3), units.gu(50), units.gu(40)),
45− }
44+ 'camera-app': Qt.rect(0, units.gu(44), units.gu(50), units.gu(40)),
46− }
47− // if new
48− storedGeom[storedGeom.length] = [windowId, geometry];
49− }
50− function getGeometry(windowId, defaultGeometry) {
51− for (var i = 0; i < storedGeom.length; ++i) {
52− if (storedGeom[i][0] === windowId) {
53− return storedGeom[i][1];
54− }
55− }
56− return defaultGeometry;
57 }
45 }
58 }
46 }
59
47
@@ -70,7 +58,6 @@ Rectangle {
70 sourceComponent: Component {
58 sourceComponent: Component {
71 DesktopStage {
59 DesktopStage {
72 anchors.fill: parent
60 anchors.fill: parent
73− windowStateStorage: fakeWindowStateStorage
74 Component.onDestruction: {
61 Component.onDestruction: {
75 desktopStageLoader.itemDestroyed = true;
62 desktopStageLoader.itemDestroyed = true;
76 }
63 }
@@ -145,57 +132,59 @@ Rectangle {
145 tryCompare(appWindowStates, "state", "surface");
132 tryCompare(appWindowStates, "state", "surface");
146 }
133 }
147
134
148− function rectsIntersect(aLocal, bLocal) {
135+ function startApplication(appId) {
149−
136+ var app = ApplicationManager.findApplication(appId);
150− var a = aLocal.mapToItem(null, 0, 0, aLocal.width, aLocal.height);
137+ if (!app) {
151− var b = bLocal.mapToItem(null, 0, 0, bLocal.width, bLocal.height);
138+ app = ApplicationManager.startApplication(appId);
152−
139+ }
140+ verify(app);
141+ waitUntilAppSurfaceShowsUp(appId);
142+ verify(app.session.surface);
153− return !((a.y+a.height) < b.y
143+ return app;
154− || a.y > (b.y+b.height)
155− || (a.x+a.width) < b.x
156− || a.x > (b.x+b.width));
157 }
144 }
158
145
159− function test_tappingOnWindowChangesFocusedApp() {
146+ function test_appFocusSwitch_data() {
160− ApplicationManager.startApplication("webbrowser-app");
147+ return [
161− waitUntilAppSurfaceShowsUp("webbrowser-app");
148+ {tag: "dash", apps: [ "unity8-dash", "dialer-app", "camera-app" ], focusfrom: 0, focusTo: 1 },
162−
149+ {tag: "dash", apps: [ "unity8-dash", "dialer-app", "camera-app" ], focusfrom: 1, focusTo: 0 },
163− var webbrowserWindow = findChild(desktopStage, "appWindow_webbrowser-app");
150+ ]
164− verify(webbrowserWindow);
151+ }
165− var dashWindow = findChild(desktopStage, "appWindow_unity8-dash");
166− verify(dashWindow);
167
152
168− // some sanity check
153+ function test_appFocusSwitch(data) {
169− compare(rectsIntersect(dashWindow, webbrowserWindow), false);
154+ var i;
155+ for (i = 0; i < data.apps.length; i++) {
156+ startApplication(data.apps[i]);
157+ }
170
158
171− tap(dashWindow);
159+ ApplicationManager.requestFocusApplication(data.apps[data.focusfrom]);
172− compare(dashWindow.application.session.surface.activeFocus, true);
160+ tryCompare(ApplicationManager.findApplication(data.apps[data.focusfrom]).session.surface, "activeFocus", true);
173
161
174− tap(webbrowserWindow);
162+ ApplicationManager.requestFocusApplication(data.apps[data.focusTo]);
175− compare(webbrowserWindow.application.session.surface.activeFocus, true);
163+ tryCompare(ApplicationManager.findApplication(data.apps[data.focusTo]).session.surface, "activeFocus", true);
176 }
164 }
177
165
178− function test_tappingOnWindowTitleChangesFocusedApp() {
166+ function test_decorationPressFocusesApplication_data() {
179− ApplicationManager.startApplication("webbrowser-app");
167+ return [
180− waitUntilAppSurfaceShowsUp("webbrowser-app");
168+ {tag: "dash", apps: [ "unity8-dash", "dialer-app", "camera-app" ], focusfrom: 0, focusTo: 1 },
181−
169+ {tag: "dash", apps: [ "unity8-dash", "dialer-app", "camera-app" ], focusfrom: 1, focusTo: 0 },
182− var webbrowserWindow = findChild(desktopStage, "decoratedWindow_webbrowser-app");
170+ ]
183− verify(webbrowserWindow);
171+ }
184− var webbrowserWindowTitle = findChild(webbrowserWindow, "windowDecorationTitle");
185− verify(webbrowserWindowTitle);
186− var dashWindow = findChild(desktopStage, "decoratedWindow_unity8-dash");
187− verify(dashWindow);
188− var dashWindowTitle = findChild(dashWindow, "windowDecorationTitle");
189− verify(dashWindowTitle);
190
172
191− // some sanity check
173+ function test_decorationPressFocusesApplication(data) {
192− compare(rectsIntersect(dashWindow, webbrowserWindow), false);
174+ var i;
175+ for (i = 0; i < data.apps.length; i++) {
176+ startApplication(data.apps[i]);
177+ }
193
178
194− tap(dashWindowTitle);
179+ var fromAppDecoration = findChild(desktopStage, "appWindowDecoration_" + data.apps[data.focusfrom]);
195− compare(dashWindow.application.session.surface.activeFocus, true);
180+ verify(fromAppDecoration);
181+ mouseClick(fromAppDecoration);
182+ tryCompare(ApplicationManager.findApplication(data.apps[data.focusfrom]).session.surface, "activeFocus", true);
196
183
197− tap(webbrowserWindowTitle);
184+ var toAppDecoration = findChild(desktopStage, "appWindowDecoration_" + data.apps[data.focusTo]);
198− compare(webbrowserWindow.application.session.surface.activeFocus, true);
185+ verify(toAppDecoration);
186+ mouseClick(toAppDecoration);
187+ tryCompare(ApplicationManager.findApplication(data.apps[data.focusTo]).session.surface, "activeFocus", true);
199 }
188 }
200 }
189 }
201}
190}
tests/qmltests/tst_DesktopShell.qml → tests/qmltests/tst_DesktopShell.qml.THISrenamed

The content is the same.

tests/qmltests/tst_Shell.qml+111−7
@@ -34,6 +34,7 @@ import Powerd 0.1
34import Wizard 0.1 as Wizard
34import Wizard 0.1 as Wizard
35
35
36import "../../qml"
36import "../../qml"
37+import "Stages"
37
38
38Rectangle {
39Rectangle {
39 id: root
40 id: root
@@ -65,6 +66,7 @@ Rectangle {
65 }
66 }
66
67
67 Item {
68 Item {
69+ id: shellContainer
68 anchors.left: root.left
70 anchors.left: root.left
69 anchors.right: controls.left
71 anchors.right: controls.left
70 anchors.top: root.top
72 anchors.top: root.top
@@ -84,6 +86,11 @@ Rectangle {
84 width: units.gu(40)
86 width: units.gu(40)
85 height: units.gu(71)
87 height: units.gu(71)
86 }
88 }
89+ StateChangeScript {
90+ script: {
91+ GSettingsController.setUsageMode("Staged")
92+ }
93+ }
87 },
94 },
88 State {
95 State {
89 name: "tablet"
96 name: "tablet"
@@ -92,6 +99,28 @@ Rectangle {
92 width: units.gu(100)
99 width: units.gu(100)
93 height: units.gu(71)
100 height: units.gu(71)
94 }
101 }
102+ StateChangeScript {
103+ script: {
104+ GSettingsController.setUsageMode("Staged")
105+ }
106+ }
107+ },
108+ State {
109+ name: "desktop"
110+ PropertyChanges {
111+ target: shellLoader
112+ width: shellContainer.width
113+ height: shellContainer.height
114+ }
115+ PropertyChanges {
116+ target: mouseEmulation
117+ checked: false
118+ }
119+ StateChangeScript {
120+ script: {
121+ GSettingsController.setUsageMode("Windowed")
122+ }
123+ }
95 }
124 }
96 ]
125 ]
97
126
@@ -121,7 +150,6 @@ Rectangle {
121 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
150 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
122 spacing: units.gu(1)
151 spacing: units.gu(1)
123 Row {
152 Row {
124− anchors { left: parent.left; right: parent.right }
125 Button {
153 Button {
126 text: "Show Greeter"
154 text: "Show Greeter"
127 activeFocusOnPress: false
155 activeFocusOnPress: false
@@ -135,6 +163,19 @@ Rectangle {
135 }
163 }
136 }
164 }
137 }
165 }
166+ Button {
167+ text: "Hide Greeter"
168+ activeFocusOnPress: false
169+ onClicked: {
170+ if (shellLoader.status !== Loader.Ready)
171+ return;
172+
173+ var greeter = testCase.findChild(shellLoader.item, "greeter");
174+ if (greeter.shown) {
175+ greeter.hide()
176+ }
177+ }
178+ }
138 }
179 }
139 ListItem.ItemSelector {
180 ListItem.ItemSelector {
140 anchors { left: parent.left; right: parent.right }
181 anchors { left: parent.left; right: parent.right }
@@ -152,13 +193,45 @@ Rectangle {
152 anchors { left: parent.left; right: parent.right }
193 anchors { left: parent.left; right: parent.right }
153 activeFocusOnPress: false
194 activeFocusOnPress: false
154 text: "Size"
195 text: "Size"
155− model: ["phone", "tablet"]
196+ model: ["phone", "tablet", "desktop"]
156 onSelectedIndexChanged: {
197 onSelectedIndexChanged: {
157 shellLoader.active = false;
198 shellLoader.active = false;
158 shellLoader.state = model[selectedIndex];
199 shellLoader.state = model[selectedIndex];
159 shellLoader.active = true;
200 shellLoader.active = true;
160 }
201 }
202+ }
161− MouseTouchEmulationCheckbox { color: "white" }
203+ MouseTouchEmulationCheckbox {
204+ id: mouseEmulation
205+ checked: true
206+ color: "white"
207+ }
208+
209+ Button {
210+ anchors { left: parent.left; right: parent.right }
211+ text: "Start all apps"
212+ onClicked: {
213+ for (var i = 0; i < appRepeater.count; i++) {
214+ var appId = ApplicationManager.availableApplications[i]
215+ if (!ApplicationManager.findApplication(appId)) {
216+ ApplicationManager.startApplication(appId)
217+ }
218+ }
219+ }
220+ }
221+
222+ Column {
223+ anchors { left: parent.left; right: parent.right }
224+ spacing: units.gu(1)
225+
226+ Label { text: "Applications"; font.bold: true }
227+
228+ Repeater {
229+ id: appRepeater
230+ model: ApplicationManager.availableApplications
231+ ApplicationCheckBox {
232+ appId: modelData
233+ }
234+ }
162 }
235 }
163 }
236 }
164 }
237 }
@@ -237,6 +310,7 @@ Rectangle {
237 }
310 }
238
311
239 function cleanup() {
312 function cleanup() {
313+ mouseEmulation.checked = true;
240 tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
314 tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
241 tearDown();
315 tearDown();
242 }
316 }
@@ -685,8 +759,9 @@ Rectangle {
685
759
686 function test_launchedAppHasActiveFocus_data() {
760 function test_launchedAppHasActiveFocus_data() {
687 return [
761 return [
688− {tag:"phone", formFactor:"phone"},
762+ {tag: "phone", formFactor: "phone"},
689− {tag:"tablet", formFactor:"tablet"},
763+ {tag: "tablet", formFactor: "tablet"},
764+ {tag: "desktop", formFactor: "desktop"}
690 ];
765 ];
691 }
766 }
692
767
@@ -877,6 +952,7 @@ Rectangle {
877 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
952 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
878 loadShell("phone");
953 loadShell("phone");
879 swipeAwayGreeter();
954 swipeAwayGreeter();
955+
880 sessionSpy.clear();
956 sessionSpy.clear();
881 verify(sessionSpy.valid);
957 verify(sessionSpy.valid);
882
958
@@ -1125,8 +1201,7 @@ Rectangle {
1125 loadShell("phone");
1201 loadShell("phone");
1126 swipeAwayGreeter();
1202 swipeAwayGreeter();
1127 AccountsService.backgroundFile = data.accounts;
1203 AccountsService.backgroundFile = data.accounts;
1128− var backgroundSettings = findInvisibleChild(shell, "backgroundSettings");
1204+ GSettingsController.setPictureUri(data.gsettings);
1129− backgroundSettings.pictureUri = data.gsettings;
1130
1205
1131 if (data.output === "defaultBackground") {
1206 if (data.output === "defaultBackground") {
1132 tryCompare(shell, "background", shell.defaultBackground);
1207 tryCompare(shell, "background", shell.defaultBackground);
@@ -1183,5 +1258,34 @@ Rectangle {
1183 tryCompare(passwordInput, "focus", true)
1258 tryCompare(passwordInput, "focus", true)
1184 }
1259 }
1185 }
1260 }
1261+
1262+ function test_stageLoader_data() {
1263+ return [
1264+ {tag: "phone", source: "Stages/PhoneStage.qml"},
1265+ {tag: "tablet", source: "Stages/TabletStage.qml"},
1266+ {tag: "desktop", source: "Stages/DesktopStage.qml"}
1267+ ]
1268+ }
1269+
1270+ function test_stageLoader(data) {
1271+ loadShell(data.tag);
1272+ var stageLoader = findChild(shell, "applicationsDisplayLoader");
1273+ verify(String(stageLoader.source).indexOf(data.source) >= 0);
1274+ }
1275+
1276+ function test_launcherInverted_data() {
1277+ return [
1278+ {tag: "phone", formFactor: "phone"},
1279+ {tag: "tablet", formFactor: "tablet"},
1280+ {tag: "desktop", formFactor: "desktop"}
1281+ ];
1282+ }
1283+
1284+ function test_launcherInverted(data) {
1285+ loadShell(data.formFactor);
1286+
1287+ var launcher = findChild(shell, "launcher");
1288+ compare(launcher.inverted, data.formFactor !== "desktop");
1289+ }
1186 }
1290 }
1187}
1291}
tests/utils/modules/Unity/Test/MouseTouchEmulationCheckbox.qml+1
@@ -22,6 +22,7 @@ import Unity.Test 0.1
22RowLayout {
22RowLayout {
23 id: root
23 id: root
24 property alias color: label.color
24 property alias color: label.color
25+ property alias checked: checkbox.checked
25
26
26 Binding {
27 Binding {
27 target: MouseTouchAdaptor
28 target: MouseTouchAdaptor