Merge lp:~jonas-drange/ubuntu-settings-components/apl into lp:ubuntu-settings-components
- apl
- Merge into trunk
Proposed by Jonas G. Drange
Status: | Merged |
---|---|
Approved by: | Nick Dedekind |
Approved revision: | 181 |
Merged at revision: | 179 |
Proposed branch: | lp:~jonas-drange/ubuntu-settings-components/apl |
Merge into: | lp:ubuntu-settings-components |
Diff against target: | 418 lines (+206/-15) 7 files modified debian/changelog (+7/-0) plugins/Ubuntu/Settings/Fingerprint/Fingerprint.qml (+3/-1) plugins/Ubuntu/Settings/Fingerprint/Fingerprints.qml (+42/-5) plugins/Ubuntu/Settings/Fingerprint/Setup.qml (+3/-5) plugins/Ubuntu/Settings/Vpn/VpnEditor.qml (+3/-2) tests/qmltests/Fingerprint/tst_FingerprintNames.qml (+18/-0) tests/qmltests/Fingerprint/tst_Fingerprints.qml (+130/-2) |
To merge this branch: | bzr merge lp:~jonas-drange/ubuntu-settings-components/apl |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Nick Dedekind (community) | Approve | ||
Review via email: |
Commit message
Description of the change
* Fix issues discovered when migrating USS to APL.
* Bump version so as to allow USS to complete the migration.
To post a comment you must log in.
- 178. By Jonas G. Drange
-
syncs with trunk
- 179. By Jonas G. Drange
-
drops parentpage, unused variable
- 180. By Jonas G. Drange
-
clarifies changes
- 181. By Jonas G. Drange
-
fixes typos in Fingerprint
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2016-12-01 00:34:17 +0000 |
3 | +++ debian/changelog 2016-12-19 15:01:27 +0000 |
4 | @@ -1,3 +1,10 @@ |
5 | +ubuntu-settings-components (0.12+17.04.20161123-0ubuntu2) UNRELEASED; urgency=medium |
6 | + |
7 | + * Allows Fingerprint and VPN modules to work well with APL and pagestacks. |
8 | + * Bumps version to 0.12 so that consumers can migrate to APL safely. |
9 | + |
10 | + -- Jonas G. Drange <jonas.drange@canonical.com> Fri, 16 Dec 2016 14:16:24 +0100 |
11 | + |
12 | ubuntu-settings-components (0.11+17.04.20161201-0ubuntu1) zesty; urgency=medium |
13 | |
14 | * dateExt: take care of the numbers of days in month when adding |
15 | |
16 | === modified file 'plugins/Ubuntu/Settings/Fingerprint/Fingerprint.qml' |
17 | --- plugins/Ubuntu/Settings/Fingerprint/Fingerprint.qml 2016-06-15 10:45:27 +0000 |
18 | +++ plugins/Ubuntu/Settings/Fingerprint/Fingerprint.qml 2016-12-19 15:01:27 +0000 |
19 | @@ -23,11 +23,13 @@ |
20 | |
21 | Page { |
22 | id: root |
23 | + objectName: "fingerprintItemPage" |
24 | property string name |
25 | property string templateId |
26 | |
27 | signal requestDeletion(string templateId) |
28 | signal requestRename(string templateId, string name) |
29 | + signal done() |
30 | |
31 | function deletionFailed() { |
32 | PopupUtils.open(deletionFailed); |
33 | @@ -96,7 +98,7 @@ |
34 | onAccepted: { |
35 | if (text) { |
36 | requestRename(templateId, text); |
37 | - pageStack.pop(); |
38 | + done(); |
39 | } |
40 | } |
41 | } |
42 | |
43 | === modified file 'plugins/Ubuntu/Settings/Fingerprint/Fingerprints.qml' |
44 | --- plugins/Ubuntu/Settings/Fingerprint/Fingerprints.qml 2016-06-16 20:31:12 +0000 |
45 | +++ plugins/Ubuntu/Settings/Fingerprint/Fingerprints.qml 2016-12-19 15:01:27 +0000 |
46 | @@ -107,6 +107,31 @@ |
47 | } |
48 | } |
49 | |
50 | + // Pushes onto a pageStack or an APL. |
51 | + function pushShim(page, opts) { |
52 | + var incubator; |
53 | + if (typeof opts === 'undefined') |
54 | + opts = {}; |
55 | + if (pageStack.push) { |
56 | + return pageStack.push(page, opts); |
57 | + } else { |
58 | + page = Qt.createComponent(page); |
59 | + incubator = pageStack.addPageToNextColumn(root, page, opts); |
60 | + incubator.forceCompletion(); |
61 | + return incubator.object; |
62 | + } |
63 | + } |
64 | + |
65 | + /* Pops a pageStack or APL. The page argument is only effective if the |
66 | + pageStack is an APL, in which case all child pages of page are removed. */ |
67 | + function popShim(page) { |
68 | + if (pageStack.pop) { |
69 | + pageStack.pop(); |
70 | + } else { |
71 | + pageStack.removePages(page); |
72 | + } |
73 | + } |
74 | + |
75 | signal requestPasscode() |
76 | |
77 | Component.onCompleted: { |
78 | @@ -231,7 +256,7 @@ |
79 | |
80 | ListItem { |
81 | height: fpLayout.height + (divider.visible ? divider.height : 0) |
82 | - onClicked: _fpInstancePage = pageStack.push( |
83 | + onClicked: _fpInstancePage = pushShim( |
84 | Qt.resolvedUrl("Fingerprint.qml"), { |
85 | name: modelData.name, |
86 | templateId: modelData.templateId |
87 | @@ -261,7 +286,7 @@ |
88 | ListItem { |
89 | height: addFpLayout.height + (divider.visible ? divider.height : 0) |
90 | onClicked: { |
91 | - _setupPage = pageStack.push(Qt.resolvedUrl("Setup.qml")); |
92 | + _setupPage = pushShim(Qt.resolvedUrl("Setup.qml")); |
93 | root.enroll(); |
94 | } |
95 | enabled: parent.enabled |
96 | @@ -342,7 +367,11 @@ |
97 | Connections { |
98 | target: _setupPage |
99 | onEnroll: root.enroll() |
100 | - onCancel: root.cancel() |
101 | + onCancel: { |
102 | + root.cancel(); |
103 | + popShim(root); |
104 | + } |
105 | + onDone: popShim(root) |
106 | } |
107 | |
108 | Connections { |
109 | @@ -353,6 +382,7 @@ |
110 | _removalOperation.start(removalObserver); |
111 | } |
112 | onRequestRename: renameTemplate(templateId, name) |
113 | + onDone: popShim(root) |
114 | } |
115 | |
116 | Observer { |
117 | @@ -404,8 +434,15 @@ |
118 | onCanceled: _removalOperation = null |
119 | onSucceeded: { |
120 | _removalOperation = null; |
121 | - if (pageStack.currentPage === _fpInstancePage) |
122 | - pageStack.pop(); |
123 | + /* If we have a currentPage, pop one page. If not, pop every child |
124 | + of root. */ |
125 | + if (pageStack.currentPage) { |
126 | + if (pageStack.currentPage === _fpInstancePage) { |
127 | + popShim(); |
128 | + } |
129 | + } else { |
130 | + popShim(root); |
131 | + } |
132 | root.removeTemplate(result); |
133 | } |
134 | } |
135 | |
136 | === modified file 'plugins/Ubuntu/Settings/Fingerprint/Setup.qml' |
137 | --- plugins/Ubuntu/Settings/Fingerprint/Setup.qml 2016-07-12 12:32:18 +0000 |
138 | +++ plugins/Ubuntu/Settings/Fingerprint/Setup.qml 2016-12-19 15:01:27 +0000 |
139 | @@ -29,6 +29,7 @@ |
140 | |
141 | signal enroll() |
142 | signal cancel() |
143 | + signal done() |
144 | |
145 | function enrollmentFailed(error) { |
146 | root.state = "failed"; |
147 | @@ -346,10 +347,7 @@ |
148 | } |
149 | height: parent.height |
150 | width: units.gu(10) |
151 | - onClicked: { |
152 | - root.cancel(); |
153 | - pageStack.pop(); |
154 | - } |
155 | + onClicked: root.cancel() |
156 | |
157 | Label { |
158 | id: cancelButtonText |
159 | @@ -370,7 +368,7 @@ |
160 | enabled: false |
161 | height: parent.height |
162 | width: units.gu(10) |
163 | - onClicked: pageStack.pop() |
164 | + onClicked: root.done() |
165 | |
166 | Label { |
167 | id: doneButtonText |
168 | |
169 | === modified file 'plugins/Ubuntu/Settings/Vpn/VpnEditor.qml' |
170 | --- plugins/Ubuntu/Settings/Vpn/VpnEditor.qml 2016-04-27 12:30:12 +0000 |
171 | +++ plugins/Ubuntu/Settings/Vpn/VpnEditor.qml 2016-12-19 15:01:27 +0000 |
172 | @@ -31,6 +31,7 @@ |
173 | |
174 | signal typeChanged(var connection, int type) |
175 | signal reconnectionPrompt() |
176 | + signal done() |
177 | |
178 | function commit () { |
179 | editorLoader.item.state = 'committing'; |
180 | @@ -137,7 +138,7 @@ |
181 | if (editor.isNew) { |
182 | connection.remove(); |
183 | } |
184 | - pageStack.pop(); |
185 | + done(); |
186 | } |
187 | Layout.fillWidth: true |
188 | } |
189 | @@ -187,7 +188,7 @@ |
190 | if (connection.active) { |
191 | editor.reconnectionPrompt(); |
192 | } |
193 | - pageStack.pop(); |
194 | + done(); |
195 | } |
196 | } |
197 | } |
198 | |
199 | === modified file 'tests/qmltests/Fingerprint/tst_FingerprintNames.qml' |
200 | --- tests/qmltests/Fingerprint/tst_FingerprintNames.qml 2016-08-17 11:11:24 +0000 |
201 | +++ tests/qmltests/Fingerprint/tst_FingerprintNames.qml 2016-12-19 15:01:27 +0000 |
202 | @@ -279,6 +279,11 @@ |
203 | signalName: "requestRename" |
204 | } |
205 | |
206 | + SignalSpy { |
207 | + id: doneSpy |
208 | + signalName: "done" |
209 | + } |
210 | + |
211 | UbuntuTestCase { |
212 | name: "TestTemplate" |
213 | when: windowShown |
214 | @@ -310,11 +315,13 @@ |
215 | pageStack.push(templateInstance); |
216 | requestRenameSpy.target = templateInstance; |
217 | requestDeletionSpy.target = templateInstance; |
218 | + doneSpy.target = templateInstance; |
219 | } |
220 | |
221 | function cleanup() { |
222 | requestRenameSpy.clear(); |
223 | requestDeletionSpy.clear(); |
224 | + doneSpy.clear(); |
225 | pageStack.pop(); |
226 | templateInstance.destroy(); |
227 | templateInstance = null; |
228 | @@ -347,6 +354,17 @@ |
229 | compare(requestRenameSpy.signalArguments[0][1], "Your finger"); |
230 | } |
231 | |
232 | + function test_requestDone() { |
233 | + templateInstance.templateId = "tmplId"; |
234 | + templateInstance.name = "My finger"; |
235 | + |
236 | + getNameInput().text = "Your finger"; |
237 | + getNameInput().accepted(); |
238 | + doneSpy.wait(); |
239 | + |
240 | + compare(doneSpy.count, 1); |
241 | + } |
242 | + |
243 | function test_deletionFailed() { |
244 | templateInstance.deletionFailed(); |
245 | tryCompareFunction(function () { |
246 | |
247 | === modified file 'tests/qmltests/Fingerprint/tst_Fingerprints.qml' |
248 | --- tests/qmltests/Fingerprint/tst_Fingerprints.qml 2016-08-17 11:56:24 +0000 |
249 | +++ tests/qmltests/Fingerprint/tst_Fingerprints.qml 2016-12-19 15:01:27 +0000 |
250 | @@ -18,6 +18,7 @@ |
251 | |
252 | import QtQuick 2.4 |
253 | import QtTest 1.0 |
254 | +import Ubuntu.Components 1.3 |
255 | import Ubuntu.Test 0.1 |
256 | import Ubuntu.Settings.Fingerprint 0.1 |
257 | import Biometryd 0.0 |
258 | @@ -29,6 +30,16 @@ |
259 | height: units.gu(90) |
260 | |
261 | Component { |
262 | + id: testPageStackComponent |
263 | + PageStack {} |
264 | + } |
265 | + |
266 | + Component { |
267 | + id: testAplComponent |
268 | + AdaptivePageLayout {} |
269 | + } |
270 | + |
271 | + Component { |
272 | id: fingerprintsComponent |
273 | |
274 | Fingerprints { |
275 | @@ -44,18 +55,21 @@ |
276 | name: "Fingerprints" |
277 | when: windowShown |
278 | |
279 | + property var testPageStack: null |
280 | property var fingerprintsInstance: null |
281 | |
282 | function init() { |
283 | Biometryd.setAvailable(true); |
284 | - fingerprintsInstance = fingerprintsComponent.createObject(testRoot); |
285 | + testPageStack = testPageStackComponent.createObject(testRoot); |
286 | + fingerprintsInstance = testPageStack.push(fingerprintsComponent); |
287 | } |
288 | |
289 | function cleanup() { |
290 | spy.clear(); |
291 | spy.target = null; |
292 | spy.signalName = ""; |
293 | - fingerprintsInstance.destroy(); |
294 | + testPageStack.pop(); |
295 | + testPageStack.destroy(); |
296 | GSettingsController.setFingerprintNames({}); |
297 | } |
298 | |
299 | @@ -226,5 +240,119 @@ |
300 | return GSettingsController.fingerprintNames()["tmplId"]; |
301 | }, targetFingerprintName); |
302 | } |
303 | + |
304 | + function test_goToSetup() { |
305 | + var btn = getSetupEntry(); |
306 | + fingerprintsInstance.passcodeSet = true; |
307 | + mouseClick(btn, btn.width / 2, btn.height / 2); |
308 | + compare(testPageStack.currentPage.objectName, "fingerprintSetupPage"); |
309 | + |
310 | + // Go back |
311 | + testPageStack.currentPage.done(); |
312 | + compare(testPageStack.currentPage, fingerprintsInstance); |
313 | + } |
314 | + |
315 | + function test_goToFingerprint() { |
316 | + var obs = getEnrollmentObserver(); |
317 | + var btn; |
318 | + |
319 | + // Prerequisites for test: |
320 | + fingerprintsInstance.passcodeSet = true; |
321 | + obs.mockEnroll("tmplId", ""); |
322 | + |
323 | + btn = findChild(fingerprintsInstance, "fingerprintInstance-0"); |
324 | + waitForRendering(btn); |
325 | + mouseClick(btn, btn.width / 2, btn.height / 2); |
326 | + tryCompareFunction(function () { |
327 | + return !!findChild(testRoot, "fingerprintItemPage"); |
328 | + }, true); |
329 | + |
330 | + // Go back |
331 | + testPageStack.currentPage.done(); |
332 | + compare(testPageStack.currentPage, fingerprintsInstance); |
333 | + } |
334 | + } |
335 | + |
336 | + |
337 | + UbuntuTestCase { |
338 | + name: "FingerprintsAdaptivePageLayout" |
339 | + when: windowShown |
340 | + |
341 | + Component { |
342 | + id: pageComponent |
343 | + Page { |
344 | + header: PageHeader {} |
345 | + } |
346 | + } |
347 | + |
348 | + property var testApl: null |
349 | + property var fingerprintsInstance: null |
350 | + |
351 | + function waitFor(objectName) { |
352 | + tryCompareFunction(function () { |
353 | + return !!findChild(testRoot, objectName); |
354 | + }, true); |
355 | + } |
356 | + |
357 | + function waitForDestruction(objectName) { |
358 | + tryCompareFunction(function () { |
359 | + return !!findChild(testRoot, objectName); |
360 | + }, false); |
361 | + } |
362 | + |
363 | + function init() { |
364 | + var incubator; |
365 | + Biometryd.setAvailable(true); |
366 | + testApl = testAplComponent.createObject(testRoot, { |
367 | + primaryPageSource: pageComponent |
368 | + }); |
369 | + |
370 | + // Wait until the primaryPage has been created. |
371 | + tryCompareFunction(function () { |
372 | + return !!testApl.primaryPage |
373 | + }, true); |
374 | + |
375 | + // Synchronously create the fingerprint instance on the APL. |
376 | + incubator = testApl.addPageToNextColumn( |
377 | + testApl.primaryPage, fingerprintsComponent |
378 | + ); |
379 | + incubator.forceCompletion(); |
380 | + fingerprintsInstance = incubator.object; |
381 | + waitForRendering(fingerprintsInstance) |
382 | + } |
383 | + |
384 | + function cleanup() { |
385 | + testApl.removePages(testApl.primaryPage); |
386 | + testApl.destroy(); |
387 | + } |
388 | + |
389 | + function test_goToSetup() { |
390 | + var btn = findChild(fingerprintsInstance, "fingerprintSetupEntry");; |
391 | + fingerprintsInstance.passcodeSet = true; |
392 | + mouseClick(btn, btn.width / 2, btn.height / 2); |
393 | + waitFor("fingerprintSetupPage"); |
394 | + |
395 | + // Go back out |
396 | + findChild(testRoot, "fingerprintSetupPage").done(); |
397 | + waitForDestruction("fingerprintSetupPage"); |
398 | + } |
399 | + |
400 | + function test_goToFingerprint() { |
401 | + var obs = findInvisibleChild(fingerprintsInstance, "enrollmentObserver"); |
402 | + var btn; |
403 | + |
404 | + // Prerequisites for test: |
405 | + fingerprintsInstance.passcodeSet = true; |
406 | + obs.mockEnroll("tmplId", ""); |
407 | + |
408 | + btn = findChild(fingerprintsInstance, "fingerprintInstance-0"); |
409 | + waitForRendering(btn); |
410 | + mouseClick(btn, btn.width / 2, btn.height / 2); |
411 | + waitFor("fingerprintItemPage"); |
412 | + |
413 | + // Go back out. |
414 | + findChild(testRoot, "fingerprintItemPage").done(); |
415 | + waitForDestruction("fingerprintItemPage"); |
416 | + } |
417 | } |
418 | } |
Looks ok