Merge lp:~mterry/unity8/wizard-tests into lp:unity8

Proposed by Michael Terry
Status: Merged
Approved by: Andrea Cimitan
Approved revision: 1460
Merged at revision: 1476
Proposed branch: lp:~mterry/unity8/wizard-tests
Merge into: lp:unity8
Prerequisite: lp:~mterry/unity8/wizard-plugin
Diff against target: 1666 lines (+1109/-35)
47 files modified
debian/control (+4/-0)
plugins/Wizard/plugin.cpp (+1/-8)
qml/Wizard/Page.qml (+2/-0)
qml/Wizard/Pages.qml (+11/-4)
qml/Wizard/Pages/10-welcome.qml (+4/-0)
qml/Wizard/Pages/20-sim.qml (+2/-0)
qml/Wizard/Pages/30-passwd-type.qml (+4/-0)
qml/Wizard/Pages/40-wifi.qml (+2/-0)
qml/Wizard/Pages/50-location.qml (+10/-9)
qml/Wizard/Pages/60-reporting.qml (+2/-0)
qml/Wizard/Pages/80-finished.qml (+2/-0)
qml/Wizard/Pages/here-terms.qml (+4/-0)
qml/Wizard/Pages/passwd-confirm.qml (+2/-1)
qml/Wizard/Pages/passwd-set.qml (+1/-0)
tests/mocks/AccountsService/AccountsService.cpp (+7/-1)
tests/mocks/CMakeLists.txt (+1/-0)
tests/mocks/MeeGo/CMakeLists.txt (+1/-0)
tests/mocks/MeeGo/QOfono/CMakeLists.txt (+10/-0)
tests/mocks/MeeGo/QOfono/MockOfonoManager.qml (+23/-0)
tests/mocks/MeeGo/QOfono/MockOfonoSimManager.qml (+42/-0)
tests/mocks/MeeGo/QOfono/MockQOfono.cpp (+54/-0)
tests/mocks/MeeGo/QOfono/MockQOfono.h (+52/-0)
tests/mocks/MeeGo/QOfono/plugin.cpp (+33/-0)
tests/mocks/MeeGo/QOfono/plugin.h (+31/-0)
tests/mocks/MeeGo/QOfono/qmldir (+4/-0)
tests/mocks/QMenuModel/QDBusActionGroup.qml (+12/-0)
tests/mocks/Ubuntu/CMakeLists.txt (+1/-0)
tests/mocks/Ubuntu/SystemSettings/CMakeLists.txt (+2/-0)
tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/CMakeLists.txt (+1/-0)
tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/MockLanguagePlugin.qml (+23/-0)
tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/qmldir (+2/-0)
tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/CMakeLists.txt (+10/-0)
tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/MockSecurityPrivacy.cpp (+28/-0)
tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/MockSecurityPrivacy.h (+42/-0)
tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/plugin.cpp (+26/-0)
tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/plugin.h (+31/-0)
tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/qmldir (+2/-0)
tests/mocks/Wizard/MockSystem.cpp (+2/-1)
tests/mocks/Wizard/MockSystem.h (+1/-0)
tests/mocks/Wizard/mockplugin.cpp (+1/-8)
tests/plugins/Wizard/CMakeLists.txt (+9/-3)
tests/plugins/Wizard/tst_system.cpp (+124/-0)
tests/qmltests/CMakeLists.txt (+1/-0)
tests/qmltests/Wizard/licenses/en_US.html (+1/-0)
tests/qmltests/Wizard/licenses/fr_CA.html (+1/-0)
tests/qmltests/Wizard/licenses/fr_FR.html (+1/-0)
tests/qmltests/Wizard/tst_Wizard.qml (+479/-0)
To merge this branch: bzr merge lp:~mterry/unity8/wizard-tests
Reviewer Review Type Date Requested Status
Andrea Cimitan (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity Team Pending
Review via email: mp+242525@code.launchpad.net

Commit message

Add tests for welcome wizard.

Description of the change

Add tests for welcome wizard.

There a are a couple minor changes besides just adding tests:
 - Made PageList an instantiable object rather than a singleton so that when tests tear down and recreate new Wizard objects, each gets its own PageList
 - Rejiggered the skipping logic on the location page to better handle the mock situation (and simplify it in the process).

== Checklist ==

 * Are there any related MPs required for this MP to build/function as expected? Please list.
 Yes, the prerequisite lp:~mterry/unity8/wizard-plugin

 * Did you perform an exploratory manual test run of your code change and any related functionality?
 Yes

 * Did you make sure that your branch does not contain spurious tags?
 Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
 NA

 * If you changed the UI, has there been a design review?
 NA

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~mterry/unity8/wizard-tests updated
1450. By Michael Terry

Merge from wizard-plugin

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~mterry/unity8/wizard-tests updated
1451. By Michael Terry

add some copyright notices

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~mterry/unity8/wizard-tests updated
1452. By Michael Terry

Remove extra whitespace

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~mterry/unity8/wizard-tests updated
1453. By Michael Terry

Merge from wizard-plugin

1454. By Michael Terry

Merge from wizard-plugin

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) :
lp:~mterry/unity8/wizard-tests updated
1455. By Michael Terry

Re-enable tests, whoops

1456. By Michael Terry

Remove debug line

1457. By Michael Terry

review nits

Revision history for this message
Michael Terry (mterry) wrote :

Re: your comments:

- Removed the "////" separator, though I still disagree that it's an eyesore
- I left the unconditional "Q_EMIT availableChanged()" in place because it's just a mock and we don't care about making it perfect. I'd rather have the code be as simple as possible than efficient.
- Removed the debug line.
- And for the wait(100)... I added a much more verbose comment, but left it in. It does not affect jenkins runs, it's just for local runs. Not sure why the problem exists, and have never been able to track it down (despite spending some time on it). But whatever weird little ListView delegate race is happening, it doesn't happen when run under xfvb.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~mterry/unity8/wizard-tests updated
1458. By Michael Terry

Merge from wizard-plugin

1459. By Michael Terry

Add folderlistmodel to build-depends (and depends)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~mterry/unity8/wizard-tests updated
1460. By Michael Terry

Add missing dep and fix AS mock to allow setting null license path

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes
 * Did CI run pass? If not, please explain why.
AP
 * Did you make sure that the branch does not contain spurious tags?
yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-12-03 17:23:07 +0000
3+++ debian/control 2014-12-03 17:23:08 +0000
4@@ -33,6 +33,7 @@
5 python3-all:any,
6 python3-setuptools,
7 python:any (>= 2.7),
8+ qml-module-qt-labs-folderlistmodel,
9 qml-module-qtquick-layouts,
10 qml-module-qtquick-xmllistmodel,
11 qml-module-qtquick2,
12@@ -47,6 +48,7 @@
13 qtdeclarative5-qtmultimedia-plugin,
14 qtdeclarative5-ubuntu-settings-components (>= 0.4),
15 qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 1.1.1239) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 1.1.1239),
16+ qtdeclarative5-ubuntu-web-plugin,
17 ttf-ubuntu-font-family,
18 Standards-Version: 3.9.4
19 Homepage: http://launchpad.net/unity
20@@ -84,10 +86,12 @@
21 libcap2-bin,
22 libglib2.0-bin,
23 qmenumodel-qml (>= 0.2.8),
24+ qml-module-qt-labs-folderlistmodel,
25 qml-module-qtquick-xmllistmodel,
26 qtdeclarative5-gsettings1.0,
27 qtdeclarative5-qtmir-plugin (>= 0.4.4),
28 qtdeclarative5-ubuntu-telephony0.1,
29+ qtdeclarative5-ubuntu-web-plugin,
30 ubuntu-system-settings,
31 unity-launcher-impl-4,
32 unity8-common (= ${source:Version}),
33
34=== modified file 'plugins/Wizard/plugin.cpp'
35--- plugins/Wizard/plugin.cpp 2014-12-03 17:23:07 +0000
36+++ plugins/Wizard/plugin.cpp 2014-12-03 17:23:08 +0000
37@@ -20,13 +20,6 @@
38
39 #include <QtQml/qqml.h>
40
41-static QObject *pagelist_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
42-{
43- Q_UNUSED(engine)
44- Q_UNUSED(scriptEngine)
45- return new PageList();
46-}
47-
48 static QObject *system_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
49 {
50 Q_UNUSED(engine)
51@@ -37,6 +30,6 @@
52 void WizardPlugin::registerTypes(const char *uri)
53 {
54 Q_ASSERT(uri == QLatin1String("Wizard"));
55- qmlRegisterSingletonType<PageList>(uri, 0, 1, "PageList", pagelist_provider);
56+ qmlRegisterType<PageList>(uri, 0, 1, "PageList");
57 qmlRegisterSingletonType<System>(uri, 0, 1, "System", system_provider);
58 }
59
60=== modified file 'qml/Wizard/Page.qml'
61--- qml/Wizard/Page.qml 2014-12-03 17:23:07 +0000
62+++ qml/Wizard/Page.qml 2014-12-03 17:23:08 +0000
63@@ -77,6 +77,7 @@
64
65 StackButton {
66 id: backButton
67+ objectName: "backButton"
68 width: buttonWidth
69 anchors {
70 left: parent.left
71@@ -94,6 +95,7 @@
72
73 Loader {
74 id: forwardButton
75+ objectName: "forwardButton"
76 width: buttonWidth
77 anchors {
78 right: parent.right
79
80=== modified file 'qml/Wizard/Pages.qml'
81--- qml/Wizard/Pages.qml 2014-12-03 17:23:07 +0000
82+++ qml/Wizard/Pages.qml 2014-12-03 17:23:08 +0000
83@@ -22,6 +22,7 @@
84
85 Item {
86 id: root
87+ objectName: "wizardPages"
88 focus: true
89
90 // The background wallpaper to use
91@@ -36,6 +37,7 @@
92
93 UbuntuSecurityPrivacyPanel {
94 id: securityPrivacy
95+ objectName: "securityPrivacy"
96 }
97
98 function quitWizard() {
99@@ -69,21 +71,26 @@
100 visible: status === Image.Ready
101 }
102
103+ PageList {
104+ id: pageList
105+ }
106+
107 PageStack {
108 id: pageStack
109+ objectName: "pageStack"
110 anchors.fill: parent
111
112 function next() {
113 // If we've opened any extra (non-main) pages, pop them before
114 // continuing so back button returns to the previous main page.
115- while (PageList.index < pageStack.depth - 1)
116+ while (pageList.index < pageStack.depth - 1)
117 pop()
118- load(PageList.next())
119+ load(pageList.next())
120 }
121
122 function prev() {
123- if (PageList.index >= pageStack.depth - 1)
124- PageList.prev() // update PageList.index, but not for extra pages
125+ if (pageList.index >= pageStack.depth - 1)
126+ pageList.prev() // update pageList.index, but not for extra pages
127 pop()
128 if (!currentPage || currentPage.opacity === 0) { // undo skipped pages
129 prev()
130
131=== modified file 'qml/Wizard/Pages/10-welcome.qml'
132--- qml/Wizard/Pages/10-welcome.qml 2014-12-03 17:23:07 +0000
133+++ qml/Wizard/Pages/10-welcome.qml 2014-12-03 17:23:08 +0000
134@@ -22,6 +22,8 @@
135 import ".." as LocalComponents
136
137 LocalComponents.Page {
138+ objectName: "languagePage"
139+
140 title: i18n.tr("Hi!")
141 forwardButtonSourceComponent: forwardButton
142
143@@ -57,6 +59,7 @@
144
145 ComboButton {
146 id: combo
147+ objectName: "languageCombo"
148 anchors.left: parent.left
149 anchors.right: parent.right
150 text: listview.currentItem.text
151@@ -67,6 +70,7 @@
152 model: plugin.languageNames
153 currentIndex: plugin.currentLanguage
154 delegate: Standard {
155+ objectName: "languageDelegate" + index
156 text: modelData
157 onClicked: {
158 listview.currentIndex = index
159
160=== modified file 'qml/Wizard/Pages/20-sim.qml'
161--- qml/Wizard/Pages/20-sim.qml 2014-12-03 17:23:07 +0000
162+++ qml/Wizard/Pages/20-sim.qml 2014-12-03 17:23:08 +0000
163@@ -20,6 +20,8 @@
164 import ".." as LocalComponents
165
166 LocalComponents.Page {
167+ objectName: "simPage"
168+
169 title: i18n.tr("Add a SIM card and restart your device")
170 forwardButtonSourceComponent: forwardButton
171
172
173=== modified file 'qml/Wizard/Pages/30-passwd-type.qml'
174--- qml/Wizard/Pages/30-passwd-type.qml 2014-12-03 17:23:07 +0000
175+++ qml/Wizard/Pages/30-passwd-type.qml 2014-12-03 17:23:08 +0000
176@@ -34,6 +34,8 @@
177
178 LocalComponents.Page {
179 id: passwdPage
180+ objectName: "passwdPage"
181+
182 title: i18n.tr("Lock security")
183 forwardButtonSourceComponent: forwardButton
184
185@@ -84,6 +86,8 @@
186 selectedIndex: methodToIndex(root.passwordMethod)
187
188 delegate: OptionSelectorDelegate {
189+ objectName: "passwdDelegate" + index
190+
191 // use subText because we want the text to be small, and we have no other way to control it
192 subText: {
193 var method = indexToMethod(index)
194
195=== modified file 'qml/Wizard/Pages/40-wifi.qml'
196--- qml/Wizard/Pages/40-wifi.qml 2014-12-03 17:23:07 +0000
197+++ qml/Wizard/Pages/40-wifi.qml 2014-12-03 17:23:08 +0000
198@@ -23,6 +23,8 @@
199
200 LocalComponents.Page {
201 id: wifiPage
202+ objectName: "wifiPage"
203+
204 title: i18n.tr("Connect to Wi‑Fi")
205 forwardButtonSourceComponent: forwardButton
206
207
208=== modified file 'qml/Wizard/Pages/50-location.qml'
209--- qml/Wizard/Pages/50-location.qml 2014-12-03 17:23:07 +0000
210+++ qml/Wizard/Pages/50-location.qml 2014-12-03 17:23:08 +0000
211@@ -22,29 +22,26 @@
212 import ".." as LocalComponents
213
214 LocalComponents.Page {
215+ objectName: "locationPage"
216+
217 title: i18n.tr("Location")
218 forwardButtonSourceComponent: forwardButton
219
220 property bool pathSet: AccountsService.hereLicensePathValid
221- property bool countSet: false
222- skipValid: pathSet && (AccountsService.hereLicensePath === "" || countSet)
223- skip: skipValid && (AccountsService.hereLicensePath === "" || termsModel.count === 0)
224-
225- Connections {
226- target: termsModel
227- onCountChanged: if (pathSet) countSet = true
228- }
229+ skipValid: pathSet && (AccountsService.hereLicensePath === "" || termsModel.count > 0)
230+ skip: skipValid && (AccountsService.hereLicensePath === "" || termsModel.count === 2) // no files but . and ..
231
232 FolderListModel {
233 id: termsModel
234 folder: AccountsService.hereLicensePath
235 nameFilters: ["*.html"]
236- showDirs: false
237 showOnlyReadable: true
238+ showDotAndDotDot: true // so that count == 0 means we're not done scanning yet
239 }
240
241 QMenuModel.QDBusActionGroup {
242 id: locationActionGroup
243+ objectName: "locationActionGroup"
244 busType: QMenuModel.DBus.SessionBus
245 busName: "com.canonical.indicator.location"
246 objectPath: "/com/canonical/indicator/location"
247@@ -67,6 +64,7 @@
248
249 LocalComponents.CheckableSetting {
250 id: gpsCheck
251+ objectName: "gpsCheck"
252 showDivider: false
253 text: i18n.tr("Using GPS only (less accurate)")
254 onTriggered: {
255@@ -83,6 +81,7 @@
256
257 LocalComponents.CheckableSetting {
258 id: hereCheck
259+ objectName: "hereCheck"
260 showDivider: false
261 text: i18n.tr("Using GPS, anonymized Wi-Fi and cellular network info (recommended)")
262 checked: true
263@@ -94,6 +93,7 @@
264 }
265
266 Label {
267+ objectName: "hereTermsLink"
268 anchors.left: parent.left
269 anchors.leftMargin: hereCheck.labelOffset
270 anchors.right: parent.right
271@@ -107,6 +107,7 @@
272
273 LocalComponents.CheckableSetting {
274 id: nopeCheck
275+ objectName: "nopeCheck"
276 showDivider: false
277 text: i18n.tr("Not at all")
278 onTriggered: {
279
280=== modified file 'qml/Wizard/Pages/60-reporting.qml'
281--- qml/Wizard/Pages/60-reporting.qml 2014-12-03 17:23:07 +0000
282+++ qml/Wizard/Pages/60-reporting.qml 2014-12-03 17:23:08 +0000
283@@ -19,6 +19,8 @@
284 import ".." as LocalComponents
285
286 LocalComponents.Page {
287+ objectName: "reportingPage"
288+
289 title: i18n.tr("Improving your experience")
290 forwardButtonSourceComponent: forwardButton
291
292
293=== modified file 'qml/Wizard/Pages/80-finished.qml'
294--- qml/Wizard/Pages/80-finished.qml 2014-12-03 17:23:07 +0000
295+++ qml/Wizard/Pages/80-finished.qml 2014-12-03 17:23:08 +0000
296@@ -19,6 +19,8 @@
297 import ".." as LocalComponents
298
299 LocalComponents.Page {
300+ objectName: "finishedPage"
301+
302 title: i18n.tr("All done")
303 forwardButtonSourceComponent: forwardButton
304 hasBackButton: false
305
306=== modified file 'qml/Wizard/Pages/here-terms.qml'
307--- qml/Wizard/Pages/here-terms.qml 2014-12-03 17:23:07 +0000
308+++ qml/Wizard/Pages/here-terms.qml 2014-12-03 17:23:08 +0000
309@@ -22,6 +22,8 @@
310 import ".." as LocalComponents
311
312 LocalComponents.Page {
313+ objectName: "hereTermsPage"
314+
315 title: i18n.tr("Terms & Conditions")
316 customBack: true
317
318@@ -96,6 +98,7 @@
319
320 Label {
321 id: termsLabel
322+ objectName: "termsLabel"
323 anchors.left: parent.left
324 anchors.right: parent.right
325 wrapMode: Text.Wrap
326@@ -108,6 +111,7 @@
327
328 WebView {
329 id: webview
330+ objectName: "webview"
331 anchors.left: parent.left
332 anchors.right: parent.right
333 height: parent.height
334
335=== modified file 'qml/Wizard/Pages/passwd-confirm.qml'
336--- qml/Wizard/Pages/passwd-confirm.qml 2014-12-03 17:23:07 +0000
337+++ qml/Wizard/Pages/passwd-confirm.qml 2014-12-03 17:23:08 +0000
338@@ -26,7 +26,8 @@
339 */
340
341 LocalComponents.Page {
342- id: passwdSetPage
343+ id: passwdConfirmPage
344+ objectName: "passwdConfirmPage"
345 forwardButtonSourceComponent: forwardButton
346
347 skip: root.passwordMethod === UbuntuSecurityPrivacyPanel.Swipe
348
349=== modified file 'qml/Wizard/Pages/passwd-set.qml'
350--- qml/Wizard/Pages/passwd-set.qml 2014-12-03 17:23:07 +0000
351+++ qml/Wizard/Pages/passwd-set.qml 2014-12-03 17:23:08 +0000
352@@ -27,6 +27,7 @@
353
354 LocalComponents.Page {
355 id: passwdSetPage
356+ objectName: "passwdSetPage"
357 forwardButtonSourceComponent: forwardButton
358
359 skip: root.passwordMethod === UbuntuSecurityPrivacyPanel.Swipe
360
361=== modified file 'tests/mocks/AccountsService/AccountsService.cpp'
362--- tests/mocks/AccountsService/AccountsService.cpp 2014-12-03 17:23:07 +0000
363+++ tests/mocks/AccountsService/AccountsService.cpp 2014-12-03 17:23:08 +0000
364@@ -138,7 +138,13 @@
365 void AccountsService::setHereLicensePath(const QString &path)
366 {
367 // Path should always be valid (this code is all synchronous)
368- m_hereLicensePath = path.isNull() ? "" : path;
369+ if (path == " ") {
370+ m_hereLicensePath = QString::null;
371+ } else if (path.isNull()) { // because qml collapses null and empty
372+ m_hereLicensePath = "";
373+ } else {
374+ m_hereLicensePath = path;
375+ }
376 hereLicensePathChanged();
377 }
378
379
380=== modified file 'tests/mocks/CMakeLists.txt'
381--- tests/mocks/CMakeLists.txt 2014-12-03 17:23:07 +0000
382+++ tests/mocks/CMakeLists.txt 2014-12-03 17:23:08 +0000
383@@ -32,6 +32,7 @@
384 add_subdirectory(GSettings.1.0)
385 add_subdirectory(libusermetrics)
386 add_subdirectory(LightDM)
387+add_subdirectory(MeeGo)
388 add_subdirectory(Powerd)
389 add_subdirectory(QMenuModel)
390 add_subdirectory(Ubuntu)
391
392=== added directory 'tests/mocks/MeeGo'
393=== added file 'tests/mocks/MeeGo/CMakeLists.txt'
394--- tests/mocks/MeeGo/CMakeLists.txt 1970-01-01 00:00:00 +0000
395+++ tests/mocks/MeeGo/CMakeLists.txt 2014-12-03 17:23:08 +0000
396@@ -0,0 +1,1 @@
397+add_subdirectory(QOfono)
398
399=== added directory 'tests/mocks/MeeGo/QOfono'
400=== added file 'tests/mocks/MeeGo/QOfono/CMakeLists.txt'
401--- tests/mocks/MeeGo/QOfono/CMakeLists.txt 1970-01-01 00:00:00 +0000
402+++ tests/mocks/MeeGo/QOfono/CMakeLists.txt 2014-12-03 17:23:08 +0000
403@@ -0,0 +1,10 @@
404+set(MOCK_QOFONO_SOURCES
405+ plugin.cpp
406+ MockQOfono.cpp
407+)
408+
409+add_library(MockQOfono MODULE ${MOCK_QOFONO_SOURCES})
410+
411+qt5_use_modules(MockQOfono Qml Quick Core)
412+
413+add_unity8_mock(MeeGo.QOfono 0.2 MeeGo/QOfono TARGETS MockQOfono)
414
415=== added file 'tests/mocks/MeeGo/QOfono/MockOfonoManager.qml'
416--- tests/mocks/MeeGo/QOfono/MockOfonoManager.qml 1970-01-01 00:00:00 +0000
417+++ tests/mocks/MeeGo/QOfono/MockOfonoManager.qml 2014-12-03 17:23:08 +0000
418@@ -0,0 +1,23 @@
419+/*
420+ * Copyright (C) 2014 Canonical, Ltd.
421+ *
422+ * This program is free software; you can redistribute it and/or modify
423+ * it under the terms of the GNU General Public License as published by
424+ * the Free Software Foundation; version 3.
425+ *
426+ * This program is distributed in the hope that it will be useful,
427+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
428+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
429+ * GNU General Public License for more details.
430+ *
431+ * You should have received a copy of the GNU General Public License
432+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
433+ */
434+
435+import QtQuick 2.3
436+import MeeGo.QOfono 0.2
437+
438+Item {
439+ readonly property var modems: MockQOfono.modems
440+ readonly property bool available: MockQOfono.available
441+}
442
443=== added file 'tests/mocks/MeeGo/QOfono/MockOfonoSimManager.qml'
444--- tests/mocks/MeeGo/QOfono/MockOfonoSimManager.qml 1970-01-01 00:00:00 +0000
445+++ tests/mocks/MeeGo/QOfono/MockOfonoSimManager.qml 2014-12-03 17:23:08 +0000
446@@ -0,0 +1,42 @@
447+/*
448+ * Copyright (C) 2014 Canonical, Ltd.
449+ *
450+ * This program is free software; you can redistribute it and/or modify
451+ * it under the terms of the GNU General Public License as published by
452+ * the Free Software Foundation; version 3.
453+ *
454+ * This program is distributed in the hope that it will be useful,
455+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
456+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
457+ * GNU General Public License for more details.
458+ *
459+ * You should have received a copy of the GNU General Public License
460+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
461+ */
462+
463+import QtQuick 2.3
464+import MeeGo.QOfono 0.2
465+
466+Item {
467+ id: simManager
468+
469+ property string modemPath
470+ readonly property alias present: d.present
471+
472+ QtObject {
473+ id: d
474+
475+ property bool present: false
476+
477+ function updatePresence() {
478+ d.present = MockQOfono.isModemPresent(simManager.modemPath)
479+ }
480+ }
481+
482+ onModemPathChanged: d.updatePresence()
483+
484+ Connections {
485+ target: MockQOfono
486+ onModemsChanged: d.updatePresence()
487+ }
488+}
489
490=== added file 'tests/mocks/MeeGo/QOfono/MockQOfono.cpp'
491--- tests/mocks/MeeGo/QOfono/MockQOfono.cpp 1970-01-01 00:00:00 +0000
492+++ tests/mocks/MeeGo/QOfono/MockQOfono.cpp 2014-12-03 17:23:08 +0000
493@@ -0,0 +1,54 @@
494+/*
495+ * Copyright (C) 2014 Canonical, Ltd.
496+ *
497+ * This program is free software; you can redistribute it and/or modify
498+ * it under the terms of the GNU General Public License as published by
499+ * the Free Software Foundation; version 3.
500+ *
501+ * This program is distributed in the hope that it will be useful,
502+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
503+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
504+ * GNU General Public License for more details.
505+ *
506+ * You should have received a copy of the GNU General Public License
507+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
508+ */
509+
510+#include "MockQOfono.h"
511+
512+MockQOfono::MockQOfono(QObject *parent)
513+ : QObject(parent),
514+ m_available(false),
515+ m_modems()
516+{
517+}
518+
519+bool MockQOfono::available() const
520+{
521+ return m_available;
522+}
523+
524+void MockQOfono::setAvailable(bool available)
525+{
526+ m_available = available;
527+ Q_EMIT availableChanged();
528+}
529+
530+QStringList MockQOfono::modems() const
531+{
532+ return m_modems.keys();
533+}
534+
535+void MockQOfono::setModems(const QStringList &modems, const QList<bool> &present)
536+{
537+ m_modems.clear();
538+ for (int i = 0; i < modems.length(); i++) {
539+ m_modems[modems[i]] = present[i];
540+ }
541+ Q_EMIT modemsChanged();
542+}
543+
544+bool MockQOfono::isModemPresent(const QString &modem)
545+{
546+ return m_modems.value(modem, false);
547+}
548
549=== added file 'tests/mocks/MeeGo/QOfono/MockQOfono.h'
550--- tests/mocks/MeeGo/QOfono/MockQOfono.h 1970-01-01 00:00:00 +0000
551+++ tests/mocks/MeeGo/QOfono/MockQOfono.h 2014-12-03 17:23:08 +0000
552@@ -0,0 +1,52 @@
553+/*
554+ * Copyright (C) 2014 Canonical, Ltd.
555+ *
556+ * This program is free software; you can redistribute it and/or modify
557+ * it under the terms of the GNU General Public License as published by
558+ * the Free Software Foundation; version 3.
559+ *
560+ * This program is distributed in the hope that it will be useful,
561+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
562+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
563+ * GNU General Public License for more details.
564+ *
565+ * You should have received a copy of the GNU General Public License
566+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
567+ */
568+
569+// This class just exists as a backend for the instantiable Qml objects to pull
570+// from. It exists only for this mock plugin.
571+
572+#ifndef MOCK_QOFONO_H
573+#define MOCK_QOFONO_H
574+
575+#include <QObject>
576+#include <QMap>
577+#include <QStringList>
578+
579+class MockQOfono : public QObject
580+{
581+ Q_OBJECT
582+ Q_PROPERTY(bool available READ available WRITE setAvailable NOTIFY availableChanged)
583+ Q_PROPERTY(QStringList modems READ modems NOTIFY modemsChanged)
584+
585+public:
586+ explicit MockQOfono(QObject *parent = 0);
587+
588+ bool available() const;
589+ void setAvailable(bool available);
590+ QStringList modems() const;
591+
592+ Q_INVOKABLE void setModems(const QStringList &modems, const QList<bool> &present);
593+ Q_INVOKABLE bool isModemPresent(const QString &modem);
594+
595+Q_SIGNALS:
596+ void availableChanged();
597+ void modemsChanged();
598+
599+private:
600+ bool m_available;
601+ QMap<QString, bool> m_modems;
602+};
603+
604+#endif // MOCK_QOFONO_H
605
606=== added file 'tests/mocks/MeeGo/QOfono/plugin.cpp'
607--- tests/mocks/MeeGo/QOfono/plugin.cpp 1970-01-01 00:00:00 +0000
608+++ tests/mocks/MeeGo/QOfono/plugin.cpp 2014-12-03 17:23:08 +0000
609@@ -0,0 +1,33 @@
610+/*
611+ * Copyright (C) 2014 Canonical, Ltd.
612+ *
613+ * This program is free software; you can redistribute it and/or modify
614+ * it under the terms of the GNU General Public License as published by
615+ * the Free Software Foundation; version 3.
616+ *
617+ * This program is distributed in the hope that it will be useful,
618+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
619+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
620+ * GNU General Public License for more details.
621+ *
622+ * You should have received a copy of the GNU General Public License
623+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
624+ */
625+
626+#include "plugin.h"
627+#include "MockQOfono.h"
628+
629+#include <QtQml>
630+
631+static QObject *mock_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
632+{
633+ Q_UNUSED(engine)
634+ Q_UNUSED(scriptEngine)
635+ return new MockQOfono();
636+}
637+
638+void BackendPlugin::registerTypes(const char *uri)
639+{
640+ Q_ASSERT(uri == QLatin1String("MeeGo.QOfono"));
641+ qmlRegisterSingletonType<MockQOfono>(uri, 0, 2, "MockQOfono", mock_provider); // just for mock
642+}
643
644=== added file 'tests/mocks/MeeGo/QOfono/plugin.h'
645--- tests/mocks/MeeGo/QOfono/plugin.h 1970-01-01 00:00:00 +0000
646+++ tests/mocks/MeeGo/QOfono/plugin.h 2014-12-03 17:23:08 +0000
647@@ -0,0 +1,31 @@
648+/*
649+ * Copyright (C) 2014 Canonical, Ltd.
650+ *
651+ * This program is free software; you can redistribute it and/or modify
652+ * it under the terms of the GNU General Public License as published by
653+ * the Free Software Foundation; version 3.
654+ *
655+ * This program is distributed in the hope that it will be useful,
656+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
657+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
658+ * GNU General Public License for more details.
659+ *
660+ * You should have received a copy of the GNU General Public License
661+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
662+ */
663+
664+#ifndef MOCK_QOFONO_PLUGIN_H
665+#define MOCK_QOFONO_PLUGIN_H
666+
667+#include <QQmlExtensionPlugin>
668+
669+class BackendPlugin : public QQmlExtensionPlugin
670+{
671+ Q_OBJECT
672+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
673+
674+public:
675+ void registerTypes(const char *uri);
676+};
677+
678+#endif // MOCK_QOFONO_PLUGIN_H
679
680=== added file 'tests/mocks/MeeGo/QOfono/qmldir'
681--- tests/mocks/MeeGo/QOfono/qmldir 1970-01-01 00:00:00 +0000
682+++ tests/mocks/MeeGo/QOfono/qmldir 2014-12-03 17:23:08 +0000
683@@ -0,0 +1,4 @@
684+module MeeGo.QOfono
685+plugin MockQOfono
686+OfonoManager 0.2 MockOfonoManager.qml
687+OfonoSimManager 0.2 MockOfonoSimManager.qml
688
689=== modified file 'tests/mocks/QMenuModel/QDBusActionGroup.qml'
690--- tests/mocks/QMenuModel/QDBusActionGroup.qml 2014-07-04 17:53:52 +0000
691+++ tests/mocks/QMenuModel/QDBusActionGroup.qml 2014-12-03 17:23:08 +0000
692@@ -21,6 +21,7 @@
693 import Ubuntu.Settings.Menus 0.1 as Menus
694
695 QtObject {
696+ id: actionGroup
697 property int busType
698 property string busName
699 property string objectPath
700@@ -78,6 +79,17 @@
701 'percent': 0.0
702 }
703 }
704+ case "gps-detection-enabled":
705+ case "location-detection-enabled":
706+ return Qt.createQmlObject("
707+import QtQuick 2.3
708+QtObject {
709+ property bool valid: true
710+ property bool state: false
711+ function activate() {
712+ state = !state;
713+ }
714+}", actionGroup);
715 default:
716 break;
717 }
718
719=== modified file 'tests/mocks/Ubuntu/CMakeLists.txt'
720--- tests/mocks/Ubuntu/CMakeLists.txt 2014-09-01 09:13:08 +0000
721+++ tests/mocks/Ubuntu/CMakeLists.txt 2014-12-03 17:23:08 +0000
722@@ -2,5 +2,6 @@
723 add_subdirectory(DownloadDaemonListener)
724 add_subdirectory(Payments)
725 add_subdirectory(SystemImage)
726+add_subdirectory(SystemSettings)
727 add_subdirectory(Telephony)
728 add_subdirectory(Thumbnailer)
729
730=== added directory 'tests/mocks/Ubuntu/SystemSettings'
731=== added file 'tests/mocks/Ubuntu/SystemSettings/CMakeLists.txt'
732--- tests/mocks/Ubuntu/SystemSettings/CMakeLists.txt 1970-01-01 00:00:00 +0000
733+++ tests/mocks/Ubuntu/SystemSettings/CMakeLists.txt 2014-12-03 17:23:08 +0000
734@@ -0,0 +1,2 @@
735+add_subdirectory(LanguagePlugin)
736+add_subdirectory(SecurityPrivacy)
737
738=== added directory 'tests/mocks/Ubuntu/SystemSettings/LanguagePlugin'
739=== added file 'tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/CMakeLists.txt'
740--- tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/CMakeLists.txt 1970-01-01 00:00:00 +0000
741+++ tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/CMakeLists.txt 2014-12-03 17:23:08 +0000
742@@ -0,0 +1,1 @@
743+add_unity8_mock(Ubuntu.SystemSettings.LanguagePlugin 1.0 Ubuntu/SystemSettings/LanguagePlugin)
744
745=== added file 'tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/MockLanguagePlugin.qml'
746--- tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/MockLanguagePlugin.qml 1970-01-01 00:00:00 +0000
747+++ tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/MockLanguagePlugin.qml 2014-12-03 17:23:08 +0000
748@@ -0,0 +1,23 @@
749+/*
750+ * Copyright (C) 2014 Canonical, Ltd.
751+ *
752+ * This program is free software; you can redistribute it and/or modify
753+ * it under the terms of the GNU General Public License as published by
754+ * the Free Software Foundation; version 3.
755+ *
756+ * This program is distributed in the hope that it will be useful,
757+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
758+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
759+ * GNU General Public License for more details.
760+ *
761+ * You should have received a copy of the GNU General Public License
762+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
763+ */
764+
765+import QtQuick 2.3
766+
767+Item {
768+ property var languageNames: ["English", "French", "Spanish"]
769+ property var languageCodes: ["en", "fr", "es"]
770+ property int currentLanguage: 0
771+}
772
773=== added file 'tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/qmldir'
774--- tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/qmldir 1970-01-01 00:00:00 +0000
775+++ tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/qmldir 2014-12-03 17:23:08 +0000
776@@ -0,0 +1,2 @@
777+module Ubuntu.SystemSettings.LanguagePlugin
778+UbuntuLanguagePlugin 1.0 MockLanguagePlugin.qml
779
780=== added directory 'tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy'
781=== added file 'tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/CMakeLists.txt'
782--- tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/CMakeLists.txt 1970-01-01 00:00:00 +0000
783+++ tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/CMakeLists.txt 2014-12-03 17:23:08 +0000
784@@ -0,0 +1,10 @@
785+set(MOCK_SECURITYPRIVACY_SOURCES
786+ plugin.cpp
787+ MockSecurityPrivacy.cpp
788+)
789+
790+add_library(MockSecurityPrivacy MODULE ${MOCK_SECURITYPRIVACY_SOURCES})
791+
792+qt5_use_modules(MockSecurityPrivacy Qml Quick Core)
793+
794+add_unity8_mock(Ubuntu.SystemSettings.SecurityPrivacy 1.0 Ubuntu/SystemSettings/SecurityPrivacy TARGETS MockSecurityPrivacy)
795
796=== added file 'tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/MockSecurityPrivacy.cpp'
797--- tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/MockSecurityPrivacy.cpp 1970-01-01 00:00:00 +0000
798+++ tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/MockSecurityPrivacy.cpp 2014-12-03 17:23:08 +0000
799@@ -0,0 +1,28 @@
800+/*
801+ * Copyright (C) 2014 Canonical, Ltd.
802+ *
803+ * This program is free software; you can redistribute it and/or modify
804+ * it under the terms of the GNU General Public License as published by
805+ * the Free Software Foundation; version 3.
806+ *
807+ * This program is distributed in the hope that it will be useful,
808+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
809+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
810+ * GNU General Public License for more details.
811+ *
812+ * You should have received a copy of the GNU General Public License
813+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
814+ */
815+
816+#include "MockSecurityPrivacy.h"
817+
818+MockSecurityPrivacy::MockSecurityPrivacy(QObject *parent)
819+ : QObject(parent)
820+{
821+}
822+
823+QString MockSecurityPrivacy::setSecurity(const QString &oldPasswd, const QString &newPasswd, SecurityType newType)
824+{
825+ Q_EMIT setSecurityCalled(oldPasswd, newPasswd, newType);
826+ return "";
827+}
828
829=== added file 'tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/MockSecurityPrivacy.h'
830--- tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/MockSecurityPrivacy.h 1970-01-01 00:00:00 +0000
831+++ tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/MockSecurityPrivacy.h 2014-12-03 17:23:08 +0000
832@@ -0,0 +1,42 @@
833+/*
834+ * Copyright (C) 2014 Canonical, Ltd.
835+ *
836+ * This program is free software; you can redistribute it and/or modify
837+ * it under the terms of the GNU General Public License as published by
838+ * the Free Software Foundation; version 3.
839+ *
840+ * This program is distributed in the hope that it will be useful,
841+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
842+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
843+ * GNU General Public License for more details.
844+ *
845+ * You should have received a copy of the GNU General Public License
846+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
847+ */
848+
849+#ifndef MOCK_SECURITYPRIVACY_H
850+#define MOCK_SECURITYPRIVACY_H
851+
852+#include <QObject>
853+
854+class MockSecurityPrivacy : public QObject
855+{
856+ Q_OBJECT
857+ Q_ENUMS(SecurityType)
858+
859+public:
860+ enum SecurityType {
861+ Swipe,
862+ Passcode,
863+ Passphrase,
864+ };
865+
866+ MockSecurityPrivacy(QObject *parent = 0);
867+
868+ Q_INVOKABLE QString setSecurity(const QString &oldPasswd, const QString &newPasswd, SecurityType newType);
869+
870+Q_SIGNALS:
871+ void setSecurityCalled(const QString &oldPasswd, const QString &newPasswd, SecurityType newType); // only in mock
872+};
873+
874+#endif // MOCK_SECURITYPRIVACY_H
875
876=== added file 'tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/plugin.cpp'
877--- tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/plugin.cpp 1970-01-01 00:00:00 +0000
878+++ tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/plugin.cpp 2014-12-03 17:23:08 +0000
879@@ -0,0 +1,26 @@
880+/*
881+ * Copyright (C) 2014 Canonical, Ltd.
882+ *
883+ * This program is free software; you can redistribute it and/or modify
884+ * it under the terms of the GNU General Public License as published by
885+ * the Free Software Foundation; version 3.
886+ *
887+ * This program is distributed in the hope that it will be useful,
888+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
889+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
890+ * GNU General Public License for more details.
891+ *
892+ * You should have received a copy of the GNU General Public License
893+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
894+ */
895+
896+#include "plugin.h"
897+#include "MockSecurityPrivacy.h"
898+
899+#include <QtQml>
900+
901+void BackendPlugin::registerTypes(const char *uri)
902+{
903+ Q_ASSERT(uri == QLatin1String("Ubuntu.SystemSettings.SecurityPrivacy"));
904+ qmlRegisterType<MockSecurityPrivacy>(uri, 1, 0, "UbuntuSecurityPrivacyPanel");
905+}
906
907=== added file 'tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/plugin.h'
908--- tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/plugin.h 1970-01-01 00:00:00 +0000
909+++ tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/plugin.h 2014-12-03 17:23:08 +0000
910@@ -0,0 +1,31 @@
911+/*
912+ * Copyright (C) 2014 Canonical, Ltd.
913+ *
914+ * This program is free software; you can redistribute it and/or modify
915+ * it under the terms of the GNU General Public License as published by
916+ * the Free Software Foundation; version 3.
917+ *
918+ * This program is distributed in the hope that it will be useful,
919+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
920+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
921+ * GNU General Public License for more details.
922+ *
923+ * You should have received a copy of the GNU General Public License
924+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
925+ */
926+
927+#ifndef MOCK_SECURITYPRIVACY_PLUGIN_H
928+#define MOCK_SECURITYPRIVACY_PLUGIN_H
929+
930+#include <QQmlExtensionPlugin>
931+
932+class BackendPlugin : public QQmlExtensionPlugin
933+{
934+ Q_OBJECT
935+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
936+
937+public:
938+ void registerTypes(const char *uri);
939+};
940+
941+#endif // MOCK_SECURITYPRIVACY_PLUGIN_H
942
943=== added file 'tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/qmldir'
944--- tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/qmldir 1970-01-01 00:00:00 +0000
945+++ tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/qmldir 2014-12-03 17:23:08 +0000
946@@ -0,0 +1,2 @@
947+module Ubuntu.SystemSettings.SecurityPrivacy
948+plugin MockSecurityPrivacy
949
950=== modified file 'tests/mocks/Wizard/MockSystem.cpp'
951--- tests/mocks/Wizard/MockSystem.cpp 2014-12-03 17:23:07 +0000
952+++ tests/mocks/Wizard/MockSystem.cpp 2014-12-03 17:23:08 +0000
953@@ -33,6 +33,7 @@
954 Q_EMIT wizardEnabledChanged();
955 }
956
957-void MockSystem::updateSessionLanguage(const QString &)
958+void MockSystem::updateSessionLanguage(const QString &locale)
959 {
960+ Q_EMIT updateSessionLanguageCalled(locale);
961 }
962
963=== modified file 'tests/mocks/Wizard/MockSystem.h'
964--- tests/mocks/Wizard/MockSystem.h 2014-12-03 17:23:07 +0000
965+++ tests/mocks/Wizard/MockSystem.h 2014-12-03 17:23:08 +0000
966@@ -36,6 +36,7 @@
967
968 Q_SIGNALS:
969 void wizardEnabledChanged();
970+ void updateSessionLanguageCalled(const QString &locale); // only in mock
971
972 private:
973 Q_DISABLE_COPY(MockSystem)
974
975=== modified file 'tests/mocks/Wizard/mockplugin.cpp'
976--- tests/mocks/Wizard/mockplugin.cpp 2014-12-03 17:23:07 +0000
977+++ tests/mocks/Wizard/mockplugin.cpp 2014-12-03 17:23:08 +0000
978@@ -20,13 +20,6 @@
979
980 #include <QtQml/qqml.h>
981
982-static QObject *pagelist_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
983-{
984- Q_UNUSED(engine)
985- Q_UNUSED(scriptEngine)
986- return new PageList();
987-}
988-
989 static QObject *system_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
990 {
991 Q_UNUSED(engine)
992@@ -37,6 +30,6 @@
993 void MockWizardPlugin::registerTypes(const char *uri)
994 {
995 Q_ASSERT(uri == QLatin1String("Wizard"));
996- qmlRegisterSingletonType<PageList>(uri, 0, 1, "PageList", pagelist_provider);
997+ qmlRegisterType<PageList>(uri, 0, 1, "PageList");
998 qmlRegisterSingletonType<MockSystem>(uri, 0, 1, "System", system_provider);
999 }
1000
1001=== modified file 'tests/plugins/Wizard/CMakeLists.txt'
1002--- tests/plugins/Wizard/CMakeLists.txt 2014-12-03 17:23:07 +0000
1003+++ tests/plugins/Wizard/CMakeLists.txt 2014-12-03 17:23:08 +0000
1004@@ -3,10 +3,16 @@
1005 ${CMAKE_SOURCE_DIR}/plugins/Wizard
1006 )
1007
1008-add_executable(tst-pagelist
1009+add_executable(tst-wizard-pagelist
1010 tst_pagelist.cpp
1011 ${CMAKE_SOURCE_DIR}/plugins/Wizard/PageList.cpp
1012 )
1013-qt5_use_modules(tst-pagelist Core Qml Test)
1014+qt5_use_modules(tst-wizard-pagelist Core Qml Test)
1015+add_test(NAME wizardpagelisttest COMMAND env UNITY_TEST_ENV=1 ${CMAKE_CURRENT_BINARY_DIR}/tst-wizard-pagelist)
1016
1017-add_test(NAME pagelisttest COMMAND env UNITY_TEST_ENV=1 ${CMAKE_CURRENT_BINARY_DIR}/tst-pagelist)
1018+add_executable(tst-wizard-system
1019+ tst_system.cpp
1020+ ${CMAKE_SOURCE_DIR}/plugins/Wizard/System.cpp
1021+)
1022+qt5_use_modules(tst-wizard-system Core DBus Qml Test)
1023+add_test(NAME wizardsystemtest COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tst-wizard-system)
1024
1025=== added file 'tests/plugins/Wizard/tst_system.cpp'
1026--- tests/plugins/Wizard/tst_system.cpp 1970-01-01 00:00:00 +0000
1027+++ tests/plugins/Wizard/tst_system.cpp 2014-12-03 17:23:08 +0000
1028@@ -0,0 +1,124 @@
1029+/*
1030+ * Copyright (C) 2014 Canonical Ltd.
1031+ *
1032+ * This program is free software: you can redistribute it and/or modify it
1033+ * under the terms of the GNU General Public License version 3, as published
1034+ * by the Free Software Foundation.
1035+ *
1036+ * This program is distributed in the hope that it will be useful, but
1037+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1038+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1039+ * PURPOSE. See the GNU General Public License for more details.
1040+ *
1041+ * You should have received a copy of the GNU General Public License along
1042+ * with this program. If not, see <http://www.gnu.org/licenses/>.
1043+ */
1044+
1045+#include "System.h"
1046+
1047+#include <QDebug>
1048+#include <QObject>
1049+#include <QSignalSpy>
1050+#include <QTemporaryDir>
1051+#include <QTest>
1052+
1053+class SystemTest: public QObject
1054+{
1055+ Q_OBJECT
1056+
1057+public:
1058+ SystemTest();
1059+
1060+private Q_SLOTS:
1061+ void testEnable();
1062+ void testDisable();
1063+ void testNoticeChanges();
1064+
1065+private:
1066+ void enable();
1067+ void disable();
1068+ bool isEnabled();
1069+
1070+ QTemporaryDir dir;
1071+ QDir enableDir;
1072+ QFile enableFile;
1073+};
1074+
1075+SystemTest::SystemTest()
1076+{
1077+ qputenv("HOME", dir.path().toUtf8());
1078+ enableDir.setPath(dir.path() + "/.config/ubuntu-system-settings");
1079+ enableFile.setFileName(enableDir.filePath("wizard-has-run"));
1080+}
1081+
1082+void SystemTest::enable()
1083+{
1084+ enableFile.remove();
1085+ QCOMPARE(isEnabled(), true);
1086+}
1087+
1088+void SystemTest::disable()
1089+{
1090+ enableDir.mkpath(".");
1091+ enableFile.open(QIODevice::WriteOnly);
1092+ enableFile.close();
1093+ QCOMPARE(isEnabled(), false);
1094+}
1095+
1096+bool SystemTest::isEnabled()
1097+{
1098+ return !enableFile.exists();
1099+}
1100+
1101+void SystemTest::testEnable()
1102+{
1103+ disable();
1104+
1105+ System system;
1106+ QVERIFY(!system.wizardEnabled());
1107+
1108+ system.setWizardEnabled(true);
1109+ QVERIFY(system.wizardEnabled());
1110+ QVERIFY(isEnabled());
1111+}
1112+
1113+void SystemTest::testDisable()
1114+{
1115+ enable();
1116+
1117+ System system;
1118+ QVERIFY(system.wizardEnabled());
1119+
1120+ system.setWizardEnabled(false);
1121+ QVERIFY(!system.wizardEnabled());
1122+ QVERIFY(!isEnabled());
1123+}
1124+
1125+void SystemTest::testNoticeChanges()
1126+{
1127+ enable();
1128+
1129+ System system;
1130+ QSignalSpy spy(&system, SIGNAL(wizardEnabledChanged()));
1131+
1132+ // System only guarantees its signals work correcty when using its own set
1133+ // methods (i.e. it won't necessarily notice if we modify the file behind
1134+ // the scenes). This is because watching all parent directories of the
1135+ // wizard-has-run file with QFileSystemWatcher is a nightmare and waste of
1136+ // resources for the corner case it is. So we'll just test the set method.
1137+
1138+ system.setWizardEnabled(false);
1139+ QTRY_COMPARE(spy.count(), 1);
1140+
1141+ system.setWizardEnabled(true);
1142+ QTRY_COMPARE(spy.count(), 2);
1143+
1144+ system.setWizardEnabled(false);
1145+ QTRY_COMPARE(spy.count(), 3);
1146+
1147+ system.setWizardEnabled(true);
1148+ QTRY_COMPARE(spy.count(), 4);
1149+}
1150+
1151+QTEST_MAIN(SystemTest)
1152+#include "tst_system.moc"
1153
1154=== modified file 'tests/qmltests/CMakeLists.txt'
1155--- tests/qmltests/CMakeLists.txt 2014-11-10 08:40:37 +0000
1156+++ tests/qmltests/CMakeLists.txt 2014-12-03 17:23:08 +0000
1157@@ -87,3 +87,4 @@
1158 add_qml_test(Stages SurfaceContainer ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
1159 add_qml_test(Stages SessionContainer ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
1160 add_qml_test(Stages Splash)
1161+add_qml_test(Wizard Wizard)
1162
1163=== added directory 'tests/qmltests/Wizard'
1164=== added directory 'tests/qmltests/Wizard/licenses'
1165=== added file 'tests/qmltests/Wizard/licenses/en_US.html'
1166--- tests/qmltests/Wizard/licenses/en_US.html 1970-01-01 00:00:00 +0000
1167+++ tests/qmltests/Wizard/licenses/en_US.html 2014-12-03 17:23:08 +0000
1168@@ -0,0 +1,1 @@
1169+en_US
1170
1171=== added file 'tests/qmltests/Wizard/licenses/fr_CA.html'
1172--- tests/qmltests/Wizard/licenses/fr_CA.html 1970-01-01 00:00:00 +0000
1173+++ tests/qmltests/Wizard/licenses/fr_CA.html 2014-12-03 17:23:08 +0000
1174@@ -0,0 +1,1 @@
1175+fr_CA
1176
1177=== added file 'tests/qmltests/Wizard/licenses/fr_FR.html'
1178--- tests/qmltests/Wizard/licenses/fr_FR.html 1970-01-01 00:00:00 +0000
1179+++ tests/qmltests/Wizard/licenses/fr_FR.html 2014-12-03 17:23:08 +0000
1180@@ -0,0 +1,1 @@
1181+fr_FR
1182
1183=== added directory 'tests/qmltests/Wizard/nolicenses'
1184=== added file 'tests/qmltests/Wizard/tst_Wizard.qml'
1185--- tests/qmltests/Wizard/tst_Wizard.qml 1970-01-01 00:00:00 +0000
1186+++ tests/qmltests/Wizard/tst_Wizard.qml 2014-12-03 17:23:08 +0000
1187@@ -0,0 +1,479 @@
1188+/*
1189+ * Copyright 2014 Canonical Ltd.
1190+ *
1191+ * This program is free software; you can redistribute it and/or modify
1192+ * it under the terms of the GNU General Public License as published by
1193+ * the Free Software Foundation; version 3.
1194+ *
1195+ * This program is distributed in the hope that it will be useful,
1196+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1197+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1198+ * GNU General Public License for more details.
1199+ *
1200+ * You should have received a copy of the GNU General Public License
1201+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1202+ */
1203+
1204+import QtQuick 2.3
1205+import QtTest 1.0
1206+import AccountsService 0.1
1207+import MeeGo.QOfono 0.2
1208+import Ubuntu.Components 1.1
1209+import Ubuntu.SystemSettings.SecurityPrivacy 1.0
1210+import Unity.Test 0.1 as UT
1211+import Wizard 0.1
1212+import "../../../qml/Wizard"
1213+
1214+Item {
1215+ id: root
1216+ width: units.gu(40)
1217+ height: units.gu(71)
1218+
1219+ Loader {
1220+ id: wizardLoader
1221+ anchors.fill: parent
1222+
1223+ property bool itemDestroyed: false
1224+ sourceComponent: Component {
1225+ Wizard {
1226+ id: wizard
1227+ anchors.fill: parent
1228+ background: Qt.resolvedUrl("../../../qml/graphics/phone_background.jpg")
1229+
1230+ Component.onDestruction: {
1231+ wizardLoader.itemDestroyed = true;
1232+ }
1233+ }
1234+ }
1235+ }
1236+
1237+ SignalSpy {
1238+ id: updateSessionLanguageSpy
1239+ target: System
1240+ signalName: "updateSessionLanguageCalled"
1241+ }
1242+
1243+ SignalSpy {
1244+ id: setSecuritySpy
1245+ signalName: "setSecurityCalled"
1246+ }
1247+
1248+ function setup() {
1249+ AccountsService.hereEnabled = false;
1250+ AccountsService.hereLicensePath = Qt.resolvedUrl("licenses");
1251+ i18n.language = "en";
1252+ MockQOfono.setModems(["sim1"], [false]);
1253+ MockQOfono.available = true;
1254+ System.wizardEnabled = true;
1255+
1256+ updateSessionLanguageSpy.clear();
1257+ setSecuritySpy.clear();
1258+ }
1259+
1260+ Component.onCompleted: {
1261+ Theme.name = "Ubuntu.Components.Themes.SuruGradient";
1262+ setup();
1263+ }
1264+
1265+ UT.UnityTestCase {
1266+ id: wizardTests
1267+ name: "Wizard"
1268+ when: windowShown
1269+
1270+ property Item wizard: wizardLoader.status === Loader.Ready ? wizardLoader.item : null
1271+
1272+ function cleanup() {
1273+ wizardLoader.itemDestroyed = false;
1274+
1275+ wizardLoader.active = false;
1276+
1277+ tryCompare(wizardLoader, "status", Loader.Null);
1278+ tryCompare(wizardLoader, "item", null);
1279+ // Loader.status might be Loader.Null and Loader.item might be null but the Loader
1280+ // item might still be alive. So if we set Loader.active back to true
1281+ // again right now we will get the very same Shell instance back. So no reload
1282+ // actually took place. Likely because Loader waits until the next event loop
1283+ // iteration to do its work. So to ensure the reload, we will wait until the
1284+ // Shell instance gets destroyed.
1285+ tryCompare(wizardLoader, "itemDestroyed", true);
1286+
1287+ // reload our test subject to get it in a fresh state once again
1288+ wizardLoader.active = true;
1289+
1290+ tryCompare(wizardLoader, "status", Loader.Ready);
1291+
1292+ var pages = findChild(wizard, "wizardPages");
1293+ var security = findInvisibleChild(pages, "securityPrivacy");
1294+ setSecuritySpy.target = security;
1295+
1296+ setup();
1297+ }
1298+
1299+ function waitForPage(name) {
1300+ var pages = findChild(wizard, "wizardPages");
1301+ var stack = findChild(pages, "pageStack");
1302+ // don't simply call tryCompare here, because stack.currentPage will be swapped out itself
1303+ tryCompareFunction(function() { return stack.currentPage.objectName; }, name);
1304+ tryCompare(stack.currentPage, "opacity", 1.0);
1305+ tryCompare(stack.currentPage, "enabled", true);
1306+ waitForRendering(stack.currentPage);
1307+ return stack.currentPage;
1308+ }
1309+
1310+ function goToPage(name, skipSim, skipLocation) {
1311+ if (skipSim === undefined) {
1312+ skipSim = false;
1313+ }
1314+ if (skipLocation === undefined) {
1315+ skipLocation = false;
1316+ }
1317+
1318+ var page = waitForPage("languagePage");
1319+ if (name === page.objectName) return page;
1320+ tap(findChild(page, "forwardButton"));
1321+
1322+ if (!skipSim) {
1323+ page = waitForPage("simPage");
1324+ if (name === page.objectName) return page;
1325+ tap(findChild(page, "forwardButton"));
1326+ }
1327+
1328+ page = waitForPage("passwdPage");
1329+ if (name === page.objectName) return page;
1330+ tap(findChild(page, "passwdDelegate0"));
1331+ tap(findChild(page, "forwardButton"));
1332+
1333+ page = waitForPage("wifiPage");
1334+ if (name === page.objectName) return page;
1335+ tap(findChild(page, "forwardButton"));
1336+
1337+ if (!skipLocation) {
1338+ page = waitForPage("locationPage");
1339+ if (name === page.objectName) return page;
1340+ tap(findChild(page, "forwardButton"));
1341+ }
1342+
1343+ page = waitForPage("reportingPage");
1344+ if (name === page.objectName) return page;
1345+ tap(findChild(page, "forwardButton"));
1346+
1347+ page = waitForPage("finishedPage");
1348+ if (name === page.objectName) return page;
1349+ tap(findChild(page, "forwardButton"));
1350+
1351+ tryCompare(wizard, "shown", false);
1352+ compare(name, null);
1353+ return null;
1354+ }
1355+
1356+ function test_languageChange() {
1357+ var page = goToPage("languagePage");
1358+ tap(findChild(page, "languageCombo"));
1359+ waitForRendering(findChild(page, "languageDelegate1"));
1360+
1361+ // For some reason, the delegate *sometimes* (like 1 in 10 maybe)
1362+ // needs more time before it can process a tap() call. I can't
1363+ // find a rhyme or reason, its properties all seem the same in
1364+ // cases where it works and does not. This failure to receive a
1365+ // tap() call below does *not* happen when running in xvfb, so
1366+ // jenkins is unaffected (and we don't have to worry about 100 not
1367+ // being enough time in its slow environment). This wait() call is
1368+ // just to help local runs not trip up.
1369+ wait(100);
1370+ tap(findChild(page, "languageDelegate1"));
1371+
1372+ tryCompare(i18n, "language", "fr");
1373+ tap(findChild(page, "forwardButton"));
1374+ tryCompare(updateSessionLanguageSpy, "count", 1);
1375+ compare(updateSessionLanguageSpy.signalArguments[0][0], "fr");
1376+ }
1377+
1378+ function test_languageNoChange() {
1379+ goToPage("simPage"); // one past language page
1380+ compare(updateSessionLanguageSpy.count, 0);
1381+ }
1382+
1383+ function test_simUnavailableSkip() {
1384+ MockQOfono.available = false;
1385+ goToPage("passwdPage", true);
1386+ }
1387+
1388+ function test_simNoModemsSkip() {
1389+ MockQOfono.setModems([], []);
1390+ goToPage("passwdPage", true);
1391+ }
1392+
1393+ function test_simFirstSkip() {
1394+ MockQOfono.setModems(["a", "b"], [true, false]);
1395+ goToPage("passwdPage", true);
1396+ }
1397+
1398+ function test_simSecondSkip() {
1399+ MockQOfono.setModems(["a", "b"], [false, true]);
1400+ goToPage("passwdPage", true);
1401+ }
1402+
1403+ function test_simBothSkip() {
1404+ MockQOfono.setModems(["a", "b"], [true, true]);
1405+ goToPage("passwdPage", true);
1406+ }
1407+
1408+ function enterPasscode(passcode) {
1409+ for (var i = 0; i < passcode.length; ++i) {
1410+ var character = passcode.charAt(i);
1411+ var button = findChild(wizard, "pinPadButton" + character);
1412+ tap(button);
1413+ }
1414+ }
1415+
1416+ function test_passwdPasscode() {
1417+ var page = goToPage("passwdPage");
1418+
1419+ tap(findChild(page, "forwardButton"));
1420+ page = waitForPage("passwdSetPage");
1421+
1422+ enterPasscode("1111");
1423+ page = waitForPage("passwdConfirmPage");
1424+
1425+ // make sure we go back to 'set' page not 'type' page
1426+ tap(findChild(page, "backButton"));
1427+ page = waitForPage("passwdSetPage");
1428+
1429+ enterPasscode("1111");
1430+ page = waitForPage("passwdConfirmPage");
1431+
1432+ enterPasscode("1112");
1433+ var error = findChild(page, "wrongNoticeLabel");
1434+ tryCompareFunction(function() { return error.text !== ""; }, true);
1435+
1436+ enterPasscode("1111");
1437+ page = waitForPage("wifiPage");
1438+
1439+ // now finish up
1440+ tap(findChild(page, "forwardButton"));
1441+ page = waitForPage("locationPage");
1442+ tap(findChild(page, "forwardButton"));
1443+ page = waitForPage("reportingPage");
1444+ tap(findChild(page, "forwardButton"));
1445+ page = waitForPage("finishedPage");
1446+ tap(findChild(page, "forwardButton"));
1447+
1448+ tryCompare(setSecuritySpy, "count", 1);
1449+ compare(setSecuritySpy.signalArguments[0][0], "");
1450+ compare(setSecuritySpy.signalArguments[0][1], "1111");
1451+ compare(setSecuritySpy.signalArguments[0][2], UbuntuSecurityPrivacyPanel.Passcode);
1452+ }
1453+
1454+ function test_passwdPassphrase() {
1455+ var page = goToPage("passwdPage");
1456+ tap(findChild(page, "passwdDelegate2"));
1457+
1458+ tap(findChild(page, "forwardButton"));
1459+ page = waitForPage("passwdSetPage");
1460+
1461+ typeString("aaa");
1462+ var continueButton = findChild(page, "forwardButton");
1463+ tryCompare(continueButton.item, "enabled", false);
1464+ keyClick(Qt.Key_Enter);
1465+ var error = findChild(page, "wrongNoticeLabel");
1466+ tryCompareFunction(function() { return error.text !== ""; }, true);
1467+
1468+ typeString("aaaa");
1469+ tap(continueButton);
1470+ page = waitForPage("passwdConfirmPage");
1471+
1472+ // make sure we go back to 'set' page not 'type' page
1473+ var back = findChild(page, "backButton");
1474+ tap(back);
1475+ page = waitForPage("passwdSetPage");
1476+
1477+ typeString("aaaa");
1478+ keyClick(Qt.Key_Enter);
1479+ page = waitForPage("passwdConfirmPage");
1480+
1481+ continueButton = findChild(page, "forwardButton");
1482+ typeString("aaab");
1483+ tryCompare(continueButton.item, "enabled", false);
1484+ keyClick(Qt.Key_Enter);
1485+ var error = findChild(page, "wrongNoticeLabel");
1486+ tryCompareFunction(function() { return error.text !== ""; }, true);
1487+
1488+ typeString("aaaa");
1489+ tap(continueButton);
1490+ page = waitForPage("wifiPage");
1491+
1492+ // now finish up
1493+ tap(findChild(page, "forwardButton"));
1494+ page = waitForPage("locationPage");
1495+ tap(findChild(page, "forwardButton"));
1496+ page = waitForPage("reportingPage");
1497+ tap(findChild(page, "forwardButton"));
1498+ page = waitForPage("finishedPage");
1499+ tap(findChild(page, "forwardButton"));
1500+
1501+ tryCompare(setSecuritySpy, "count", 1);
1502+ compare(setSecuritySpy.signalArguments[0][0], "");
1503+ compare(setSecuritySpy.signalArguments[0][1], "aaaa");
1504+ compare(setSecuritySpy.signalArguments[0][2], UbuntuSecurityPrivacyPanel.Passphrase);
1505+ }
1506+
1507+ function test_passwdSwipe() {
1508+ goToPage(null);
1509+
1510+ tryCompare(setSecuritySpy, "count", 1);
1511+ compare(setSecuritySpy.signalArguments[0][0], "");
1512+ compare(setSecuritySpy.signalArguments[0][1], "");
1513+ compare(setSecuritySpy.signalArguments[0][2], UbuntuSecurityPrivacyPanel.Swipe);
1514+ }
1515+
1516+ function test_locationSkipNoPath() {
1517+ AccountsService.hereLicensePath = "";
1518+ goToPage("reportingPage", false, true);
1519+ }
1520+
1521+ function test_locationSkipNoFiles() {
1522+ AccountsService.hereLicensePath = Qt.resolvedUrl("nolicenses");
1523+ goToPage("reportingPage", false, true);
1524+ }
1525+
1526+ function test_locationWaitOnPath() {
1527+ AccountsService.hereLicensePath = " "; // means we're still getting the path from dbus
1528+
1529+ var page = goToPage("wifiPage");
1530+
1531+ var pages = findChild(wizard, "wizardPages");
1532+ var stack = findChild(pages, "pageStack");
1533+ tap(findChild(page, "forwardButton"));
1534+ // don't simply call tryCompare here, because stack.currentPage will be swapped out itself
1535+ tryCompareFunction(function() { return stack.currentPage.objectName; }, "locationPage");
1536+ compare(stack.currentPage.enabled, false);
1537+ compare(stack.currentPage.skipValid, false);
1538+
1539+ AccountsService.hereLicensePath = "";
1540+ waitForPage("reportingPage");
1541+ }
1542+
1543+ function test_locationGpsOnly() {
1544+ var page = goToPage("locationPage");
1545+ var gpsCheck = findChild(page, "gpsCheck");
1546+ var hereCheck = findChild(page, "hereCheck");
1547+ var nopeCheck = findChild(page, "nopeCheck");
1548+
1549+ var locationActionGroup = findInvisibleChild(page, "locationActionGroup");
1550+ tryCompare(locationActionGroup.location, "state", false);
1551+ tryCompare(locationActionGroup.gps, "state", false);
1552+
1553+ tap(gpsCheck);
1554+ tryCompare(gpsCheck, "checked", true);
1555+ tryCompare(hereCheck, "checked", false);
1556+ tryCompare(nopeCheck, "checked", false);
1557+
1558+ tap(findChild(page, "forwardButton"));
1559+ tryCompare(AccountsService, "hereEnabled", false);
1560+ tryCompare(locationActionGroup.location, "state", true);
1561+ tryCompare(locationActionGroup.gps, "state", true);
1562+ }
1563+
1564+ function test_locationNope() {
1565+ var page = goToPage("locationPage");
1566+ var gpsCheck = findChild(page, "gpsCheck");
1567+ var hereCheck = findChild(page, "hereCheck");
1568+ var nopeCheck = findChild(page, "nopeCheck");
1569+
1570+ var locationActionGroup = findInvisibleChild(page, "locationActionGroup");
1571+ tryCompare(locationActionGroup.location, "state", false);
1572+ tryCompare(locationActionGroup.gps, "state", false);
1573+
1574+ tap(nopeCheck);
1575+ tryCompare(gpsCheck, "checked", false);
1576+ tryCompare(hereCheck, "checked", false);
1577+ tryCompare(nopeCheck, "checked", true);
1578+
1579+ tap(findChild(page, "forwardButton"));
1580+ tryCompare(AccountsService, "hereEnabled", false);
1581+ tryCompare(locationActionGroup.location, "state", false);
1582+ tryCompare(locationActionGroup.gps, "state", false);
1583+ }
1584+
1585+ function test_locationHere() {
1586+ var page = goToPage("locationPage");
1587+ var gpsCheck = findChild(page, "gpsCheck");
1588+ var hereCheck = findChild(page, "hereCheck");
1589+ var nopeCheck = findChild(page, "nopeCheck");
1590+
1591+ var locationActionGroup = findInvisibleChild(page, "locationActionGroup");
1592+ tryCompare(locationActionGroup.location, "state", false);
1593+ tryCompare(locationActionGroup.gps, "state", false);
1594+
1595+ // no tap because HERE is the default
1596+ tryCompare(gpsCheck, "checked", false);
1597+ tryCompare(hereCheck, "checked", true);
1598+ tryCompare(nopeCheck, "checked", false);
1599+
1600+ tap(findChild(page, "forwardButton"));
1601+ tryCompare(AccountsService, "hereEnabled", true);
1602+ tryCompare(locationActionGroup.location, "state", true);
1603+ tryCompare(locationActionGroup.gps, "state", true);
1604+ }
1605+
1606+ function test_locationHereTerms() {
1607+ var page = goToPage("locationPage");
1608+
1609+ var link = findChild(page, "hereTermsLink");
1610+
1611+ // Test our language lookup code a bit
1612+
1613+ i18n.language = "fr_FR.UTF-8";
1614+ link.linkActivated("not-used");
1615+ page = waitForPage("hereTermsPage");
1616+ tryCompare(findChild(page, "termsLabel"), "text", "fr_FR\n");
1617+ tap(findChild(page, "backButton"));
1618+ waitForPage("locationPage");
1619+
1620+ i18n.language = "fr_CA";
1621+ link.linkActivated("not-used");
1622+ page = waitForPage("hereTermsPage");
1623+ tryCompare(findChild(page, "termsLabel"), "text", "fr_CA\n");
1624+ tap(findChild(page, "backButton"));
1625+ waitForPage("locationPage");
1626+
1627+ i18n.language = "fr_US";
1628+ link.linkActivated("not-used");
1629+ page = waitForPage("hereTermsPage");
1630+ tryCompare(findChild(page, "termsLabel"), "text", "fr_FR\n");
1631+ tap(findChild(page, "backButton"));
1632+ waitForPage("locationPage");
1633+
1634+ i18n.language = "fr.utf8";
1635+ link.linkActivated("not-used");
1636+ page = waitForPage("hereTermsPage");
1637+ tryCompare(findChild(page, "termsLabel"), "text", "fr_FR\n");
1638+ tap(findChild(page, "backButton"));
1639+ waitForPage("locationPage");
1640+
1641+ i18n.language = "es"; // will not be found
1642+ link.linkActivated("not-used");
1643+ page = waitForPage("hereTermsPage");
1644+ tryCompare(findChild(page, "termsLabel"), "text", "en_US\n");
1645+
1646+ // OK, done with languages, back to actual page
1647+
1648+ var label = findChild(page, "termsLabel");
1649+ label.linkActivated(Qt.resolvedUrl("licenses/en_US.html"));
1650+ tryCompare(label, "visible", false);
1651+
1652+ var webview = findChild(page, "webview");
1653+ tryCompare(webview, "visible", true);
1654+ tryCompare(webview, "url", Qt.resolvedUrl("licenses/en_US.html"));
1655+ tryCompare(webview, "loadProgress", 100);
1656+
1657+ tap(findChild(page, "backButton"));
1658+ waitForPage("hereTermsPage"); // confirm we're on same page
1659+ tryCompare(webview, "visible", false);
1660+ tryCompare(label, "visible", true);
1661+
1662+ tap(findChild(page, "backButton"));
1663+ waitForPage("locationPage");
1664+ }
1665+ }
1666+}

Subscribers

People subscribed via source and target branches