Merge lp:~jonas-drange/ubuntu-settings-components/apl into lp:ubuntu-settings-components

Proposed by Jonas G. Drange on 2016-12-16
Status: Merged
Approved by: Nick Dedekind on 2016-12-20
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
Reviewer Review Type Date Requested Status
Nick Dedekind (community) 2016-12-16 Approve on 2016-12-20
Review via email: mp+313432@code.launchpad.net

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 on 2016-12-19

syncs with trunk

179. By Jonas G. Drange on 2016-12-19

drops parentpage, unused variable

180. By Jonas G. Drange on 2016-12-19

clarifies changes

181. By Jonas G. Drange on 2016-12-19

fixes typos in Fingerprint

Nick Dedekind (nick-dedekind) wrote :

Looks ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2016-12-01 00:34:17 +0000
+++ debian/changelog 2016-12-19 15:01:27 +0000
@@ -1,3 +1,10 @@
1ubuntu-settings-components (0.12+17.04.20161123-0ubuntu2) UNRELEASED; urgency=medium
2
3 * Allows Fingerprint and VPN modules to work well with APL and pagestacks.
4 * Bumps version to 0.12 so that consumers can migrate to APL safely.
5
6 -- Jonas G. Drange <jonas.drange@canonical.com> Fri, 16 Dec 2016 14:16:24 +0100
7
1ubuntu-settings-components (0.11+17.04.20161201-0ubuntu1) zesty; urgency=medium8ubuntu-settings-components (0.11+17.04.20161201-0ubuntu1) zesty; urgency=medium
29
3 * dateExt: take care of the numbers of days in month when adding10 * dateExt: take care of the numbers of days in month when adding
411
=== modified file 'plugins/Ubuntu/Settings/Fingerprint/Fingerprint.qml'
--- plugins/Ubuntu/Settings/Fingerprint/Fingerprint.qml 2016-06-15 10:45:27 +0000
+++ plugins/Ubuntu/Settings/Fingerprint/Fingerprint.qml 2016-12-19 15:01:27 +0000
@@ -23,11 +23,13 @@
2323
24Page {24Page {
25 id: root25 id: root
26 objectName: "fingerprintItemPage"
26 property string name27 property string name
27 property string templateId28 property string templateId
2829
29 signal requestDeletion(string templateId)30 signal requestDeletion(string templateId)
30 signal requestRename(string templateId, string name)31 signal requestRename(string templateId, string name)
32 signal done()
3133
32 function deletionFailed() {34 function deletionFailed() {
33 PopupUtils.open(deletionFailed);35 PopupUtils.open(deletionFailed);
@@ -96,7 +98,7 @@
96 onAccepted: {98 onAccepted: {
97 if (text) {99 if (text) {
98 requestRename(templateId, text);100 requestRename(templateId, text);
99 pageStack.pop();101 done();
100 }102 }
101 }103 }
102 }104 }
103105
=== modified file 'plugins/Ubuntu/Settings/Fingerprint/Fingerprints.qml'
--- plugins/Ubuntu/Settings/Fingerprint/Fingerprints.qml 2016-06-16 20:31:12 +0000
+++ plugins/Ubuntu/Settings/Fingerprint/Fingerprints.qml 2016-12-19 15:01:27 +0000
@@ -107,6 +107,31 @@
107 }107 }
108 }108 }
109109
110 // Pushes onto a pageStack or an APL.
111 function pushShim(page, opts) {
112 var incubator;
113 if (typeof opts === 'undefined')
114 opts = {};
115 if (pageStack.push) {
116 return pageStack.push(page, opts);
117 } else {
118 page = Qt.createComponent(page);
119 incubator = pageStack.addPageToNextColumn(root, page, opts);
120 incubator.forceCompletion();
121 return incubator.object;
122 }
123 }
124
125 /* Pops a pageStack or APL. The page argument is only effective if the
126 pageStack is an APL, in which case all child pages of page are removed. */
127 function popShim(page) {
128 if (pageStack.pop) {
129 pageStack.pop();
130 } else {
131 pageStack.removePages(page);
132 }
133 }
134
110 signal requestPasscode()135 signal requestPasscode()
111136
112 Component.onCompleted: {137 Component.onCompleted: {
@@ -231,7 +256,7 @@
231256
232 ListItem {257 ListItem {
233 height: fpLayout.height + (divider.visible ? divider.height : 0)258 height: fpLayout.height + (divider.visible ? divider.height : 0)
234 onClicked: _fpInstancePage = pageStack.push(259 onClicked: _fpInstancePage = pushShim(
235 Qt.resolvedUrl("Fingerprint.qml"), {260 Qt.resolvedUrl("Fingerprint.qml"), {
236 name: modelData.name,261 name: modelData.name,
237 templateId: modelData.templateId262 templateId: modelData.templateId
@@ -261,7 +286,7 @@
261 ListItem {286 ListItem {
262 height: addFpLayout.height + (divider.visible ? divider.height : 0)287 height: addFpLayout.height + (divider.visible ? divider.height : 0)
263 onClicked: {288 onClicked: {
264 _setupPage = pageStack.push(Qt.resolvedUrl("Setup.qml"));289 _setupPage = pushShim(Qt.resolvedUrl("Setup.qml"));
265 root.enroll();290 root.enroll();
266 }291 }
267 enabled: parent.enabled292 enabled: parent.enabled
@@ -342,7 +367,11 @@
342 Connections {367 Connections {
343 target: _setupPage368 target: _setupPage
344 onEnroll: root.enroll()369 onEnroll: root.enroll()
345 onCancel: root.cancel()370 onCancel: {
371 root.cancel();
372 popShim(root);
373 }
374 onDone: popShim(root)
346 }375 }
347376
348 Connections {377 Connections {
@@ -353,6 +382,7 @@
353 _removalOperation.start(removalObserver);382 _removalOperation.start(removalObserver);
354 }383 }
355 onRequestRename: renameTemplate(templateId, name)384 onRequestRename: renameTemplate(templateId, name)
385 onDone: popShim(root)
356 }386 }
357387
358 Observer {388 Observer {
@@ -404,8 +434,15 @@
404 onCanceled: _removalOperation = null434 onCanceled: _removalOperation = null
405 onSucceeded: {435 onSucceeded: {
406 _removalOperation = null;436 _removalOperation = null;
407 if (pageStack.currentPage === _fpInstancePage)437 /* If we have a currentPage, pop one page. If not, pop every child
408 pageStack.pop();438 of root. */
439 if (pageStack.currentPage) {
440 if (pageStack.currentPage === _fpInstancePage) {
441 popShim();
442 }
443 } else {
444 popShim(root);
445 }
409 root.removeTemplate(result);446 root.removeTemplate(result);
410 }447 }
411 }448 }
412449
=== modified file 'plugins/Ubuntu/Settings/Fingerprint/Setup.qml'
--- plugins/Ubuntu/Settings/Fingerprint/Setup.qml 2016-07-12 12:32:18 +0000
+++ plugins/Ubuntu/Settings/Fingerprint/Setup.qml 2016-12-19 15:01:27 +0000
@@ -29,6 +29,7 @@
2929
30 signal enroll()30 signal enroll()
31 signal cancel()31 signal cancel()
32 signal done()
3233
33 function enrollmentFailed(error) {34 function enrollmentFailed(error) {
34 root.state = "failed";35 root.state = "failed";
@@ -346,10 +347,7 @@
346 }347 }
347 height: parent.height348 height: parent.height
348 width: units.gu(10)349 width: units.gu(10)
349 onClicked: {350 onClicked: root.cancel()
350 root.cancel();
351 pageStack.pop();
352 }
353351
354 Label {352 Label {
355 id: cancelButtonText353 id: cancelButtonText
@@ -370,7 +368,7 @@
370 enabled: false368 enabled: false
371 height: parent.height369 height: parent.height
372 width: units.gu(10)370 width: units.gu(10)
373 onClicked: pageStack.pop()371 onClicked: root.done()
374372
375 Label {373 Label {
376 id: doneButtonText374 id: doneButtonText
377375
=== modified file 'plugins/Ubuntu/Settings/Vpn/VpnEditor.qml'
--- plugins/Ubuntu/Settings/Vpn/VpnEditor.qml 2016-04-27 12:30:12 +0000
+++ plugins/Ubuntu/Settings/Vpn/VpnEditor.qml 2016-12-19 15:01:27 +0000
@@ -31,6 +31,7 @@
3131
32 signal typeChanged(var connection, int type)32 signal typeChanged(var connection, int type)
33 signal reconnectionPrompt()33 signal reconnectionPrompt()
34 signal done()
3435
35 function commit () {36 function commit () {
36 editorLoader.item.state = 'committing';37 editorLoader.item.state = 'committing';
@@ -137,7 +138,7 @@
137 if (editor.isNew) {138 if (editor.isNew) {
138 connection.remove();139 connection.remove();
139 }140 }
140 pageStack.pop();141 done();
141 }142 }
142 Layout.fillWidth: true143 Layout.fillWidth: true
143 }144 }
@@ -187,7 +188,7 @@
187 if (connection.active) {188 if (connection.active) {
188 editor.reconnectionPrompt();189 editor.reconnectionPrompt();
189 }190 }
190 pageStack.pop();191 done();
191 }192 }
192 }193 }
193}194}
194195
=== modified file 'tests/qmltests/Fingerprint/tst_FingerprintNames.qml'
--- tests/qmltests/Fingerprint/tst_FingerprintNames.qml 2016-08-17 11:11:24 +0000
+++ tests/qmltests/Fingerprint/tst_FingerprintNames.qml 2016-12-19 15:01:27 +0000
@@ -279,6 +279,11 @@
279 signalName: "requestRename"279 signalName: "requestRename"
280 }280 }
281281
282 SignalSpy {
283 id: doneSpy
284 signalName: "done"
285 }
286
282 UbuntuTestCase {287 UbuntuTestCase {
283 name: "TestTemplate"288 name: "TestTemplate"
284 when: windowShown289 when: windowShown
@@ -310,11 +315,13 @@
310 pageStack.push(templateInstance);315 pageStack.push(templateInstance);
311 requestRenameSpy.target = templateInstance;316 requestRenameSpy.target = templateInstance;
312 requestDeletionSpy.target = templateInstance;317 requestDeletionSpy.target = templateInstance;
318 doneSpy.target = templateInstance;
313 }319 }
314320
315 function cleanup() {321 function cleanup() {
316 requestRenameSpy.clear();322 requestRenameSpy.clear();
317 requestDeletionSpy.clear();323 requestDeletionSpy.clear();
324 doneSpy.clear();
318 pageStack.pop();325 pageStack.pop();
319 templateInstance.destroy();326 templateInstance.destroy();
320 templateInstance = null;327 templateInstance = null;
@@ -347,6 +354,17 @@
347 compare(requestRenameSpy.signalArguments[0][1], "Your finger");354 compare(requestRenameSpy.signalArguments[0][1], "Your finger");
348 }355 }
349356
357 function test_requestDone() {
358 templateInstance.templateId = "tmplId";
359 templateInstance.name = "My finger";
360
361 getNameInput().text = "Your finger";
362 getNameInput().accepted();
363 doneSpy.wait();
364
365 compare(doneSpy.count, 1);
366 }
367
350 function test_deletionFailed() {368 function test_deletionFailed() {
351 templateInstance.deletionFailed();369 templateInstance.deletionFailed();
352 tryCompareFunction(function () {370 tryCompareFunction(function () {
353371
=== modified file 'tests/qmltests/Fingerprint/tst_Fingerprints.qml'
--- tests/qmltests/Fingerprint/tst_Fingerprints.qml 2016-08-17 11:56:24 +0000
+++ tests/qmltests/Fingerprint/tst_Fingerprints.qml 2016-12-19 15:01:27 +0000
@@ -18,6 +18,7 @@
1818
19import QtQuick 2.419import QtQuick 2.4
20import QtTest 1.020import QtTest 1.0
21import Ubuntu.Components 1.3
21import Ubuntu.Test 0.122import Ubuntu.Test 0.1
22import Ubuntu.Settings.Fingerprint 0.123import Ubuntu.Settings.Fingerprint 0.1
23import Biometryd 0.024import Biometryd 0.0
@@ -29,6 +30,16 @@
29 height: units.gu(90)30 height: units.gu(90)
3031
31 Component {32 Component {
33 id: testPageStackComponent
34 PageStack {}
35 }
36
37 Component {
38 id: testAplComponent
39 AdaptivePageLayout {}
40 }
41
42 Component {
32 id: fingerprintsComponent43 id: fingerprintsComponent
3344
34 Fingerprints {45 Fingerprints {
@@ -44,18 +55,21 @@
44 name: "Fingerprints"55 name: "Fingerprints"
45 when: windowShown56 when: windowShown
4657
58 property var testPageStack: null
47 property var fingerprintsInstance: null59 property var fingerprintsInstance: null
4860
49 function init() {61 function init() {
50 Biometryd.setAvailable(true);62 Biometryd.setAvailable(true);
51 fingerprintsInstance = fingerprintsComponent.createObject(testRoot);63 testPageStack = testPageStackComponent.createObject(testRoot);
64 fingerprintsInstance = testPageStack.push(fingerprintsComponent);
52 }65 }
5366
54 function cleanup() {67 function cleanup() {
55 spy.clear();68 spy.clear();
56 spy.target = null;69 spy.target = null;
57 spy.signalName = "";70 spy.signalName = "";
58 fingerprintsInstance.destroy();71 testPageStack.pop();
72 testPageStack.destroy();
59 GSettingsController.setFingerprintNames({});73 GSettingsController.setFingerprintNames({});
60 }74 }
6175
@@ -226,5 +240,119 @@
226 return GSettingsController.fingerprintNames()["tmplId"];240 return GSettingsController.fingerprintNames()["tmplId"];
227 }, targetFingerprintName);241 }, targetFingerprintName);
228 }242 }
243
244 function test_goToSetup() {
245 var btn = getSetupEntry();
246 fingerprintsInstance.passcodeSet = true;
247 mouseClick(btn, btn.width / 2, btn.height / 2);
248 compare(testPageStack.currentPage.objectName, "fingerprintSetupPage");
249
250 // Go back
251 testPageStack.currentPage.done();
252 compare(testPageStack.currentPage, fingerprintsInstance);
253 }
254
255 function test_goToFingerprint() {
256 var obs = getEnrollmentObserver();
257 var btn;
258
259 // Prerequisites for test:
260 fingerprintsInstance.passcodeSet = true;
261 obs.mockEnroll("tmplId", "");
262
263 btn = findChild(fingerprintsInstance, "fingerprintInstance-0");
264 waitForRendering(btn);
265 mouseClick(btn, btn.width / 2, btn.height / 2);
266 tryCompareFunction(function () {
267 return !!findChild(testRoot, "fingerprintItemPage");
268 }, true);
269
270 // Go back
271 testPageStack.currentPage.done();
272 compare(testPageStack.currentPage, fingerprintsInstance);
273 }
274 }
275
276
277 UbuntuTestCase {
278 name: "FingerprintsAdaptivePageLayout"
279 when: windowShown
280
281 Component {
282 id: pageComponent
283 Page {
284 header: PageHeader {}
285 }
286 }
287
288 property var testApl: null
289 property var fingerprintsInstance: null
290
291 function waitFor(objectName) {
292 tryCompareFunction(function () {
293 return !!findChild(testRoot, objectName);
294 }, true);
295 }
296
297 function waitForDestruction(objectName) {
298 tryCompareFunction(function () {
299 return !!findChild(testRoot, objectName);
300 }, false);
301 }
302
303 function init() {
304 var incubator;
305 Biometryd.setAvailable(true);
306 testApl = testAplComponent.createObject(testRoot, {
307 primaryPageSource: pageComponent
308 });
309
310 // Wait until the primaryPage has been created.
311 tryCompareFunction(function () {
312 return !!testApl.primaryPage
313 }, true);
314
315 // Synchronously create the fingerprint instance on the APL.
316 incubator = testApl.addPageToNextColumn(
317 testApl.primaryPage, fingerprintsComponent
318 );
319 incubator.forceCompletion();
320 fingerprintsInstance = incubator.object;
321 waitForRendering(fingerprintsInstance)
322 }
323
324 function cleanup() {
325 testApl.removePages(testApl.primaryPage);
326 testApl.destroy();
327 }
328
329 function test_goToSetup() {
330 var btn = findChild(fingerprintsInstance, "fingerprintSetupEntry");;
331 fingerprintsInstance.passcodeSet = true;
332 mouseClick(btn, btn.width / 2, btn.height / 2);
333 waitFor("fingerprintSetupPage");
334
335 // Go back out
336 findChild(testRoot, "fingerprintSetupPage").done();
337 waitForDestruction("fingerprintSetupPage");
338 }
339
340 function test_goToFingerprint() {
341 var obs = findInvisibleChild(fingerprintsInstance, "enrollmentObserver");
342 var btn;
343
344 // Prerequisites for test:
345 fingerprintsInstance.passcodeSet = true;
346 obs.mockEnroll("tmplId", "");
347
348 btn = findChild(fingerprintsInstance, "fingerprintInstance-0");
349 waitForRendering(btn);
350 mouseClick(btn, btn.width / 2, btn.height / 2);
351 waitFor("fingerprintItemPage");
352
353 // Go back out.
354 findChild(testRoot, "fingerprintItemPage").done();
355 waitForDestruction("fingerprintItemPage");
356 }
229 }357 }
230}358}

Subscribers

People subscribed via source and target branches

to all changes: