Merge lp:~kissiel/checkbox/dryify-checkbox-converged into lp:checkbox

Proposed by Maciej Kisielewski
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 4025
Merged at revision: 4011
Proposed branch: lp:~kissiel/checkbox/dryify-checkbox-converged
Merge into: lp:checkbox
Diff against target: 1005 lines (+243/-436)
13 files modified
checkbox-touch/checkbox-touch.qml (+32/-43)
checkbox-touch/components/AutomatedTestPage.qml (+4/-27)
checkbox-touch/components/InteractIntroPage.qml (+7/-59)
checkbox-touch/components/ManualIntroPage.qml (+7/-65)
checkbox-touch/components/QmlConfinedPage.qml (+6/-63)
checkbox-touch/components/QmlNativePage.qml (+7/-64)
checkbox-touch/components/TestPageBody.qml (+77/-0)
checkbox-touch/components/TestVerificationPage.qml (+7/-64)
checkbox-touch/components/UserInteractSummaryPage.qml (+7/-48)
checkbox-touch/components/actions/AddCommentAction.qml (+39/-0)
checkbox-touch/components/actions/SkipAction.qml (+47/-0)
checkbox-touch/tests/autopilot/checkbox_touch/test_checkbox_touch.py (+2/-2)
checkbox-touch/tests/autopilot/run (+1/-1)
To merge this branch: bzr merge lp:~kissiel/checkbox/dryify-checkbox-converged
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Review via email: mp+271120@code.launchpad.net

Description of the change

This MR does three things to make checkbox-converged more DRY.

1) Introduces actions components, so pages don't have to redefine their look & feel.
2) Introduces a component based on ColumnLayout that is common among pages that display tests.
3) Introduces a helper function for dynamic page creation that checks wether the loaded file is a proper, error-free qml stuff.

and of course it applies those three to the code.

22523b2 checkbox-touch:autopilot: don't require autopilot (not autopilot3)
9798a93 checkbox-touch: add AddCommentAction as a distinct component
f0f9eaa checkbox-touch: add SkipAction as a distinct component
6e9bc85 checkbox-touch: use action components on ManualIntroPage
552821f checkbox-touch: use action components on InteractIntroPage
ba28672 checkbox-touch: use action components on UserInteractSummary
dd8ea8c checkbox-touch: use action components on TestVerificationPage
be2496d checkbox-touch: use action components on QmlNativePage
5879de1 checkbox-touch: use action components on QmlConfinedPage
4b089a0 checkbox-touch: add TestPageBody component
0ac3579 checkbox-touch: use TestPageBody in AutomatedTestPage
b7a9fa2 checkbox-touch: use TestPageBody in InteractIntroPage
ef931b7 checkbox-touch: use TestPageBody in ManualIntroPage
5eb08e4 checkbox-touch: use TestPageBody in TestVerificationPage
889ae91 checkbox-touch: use TestPageBody in UserInteractSummaryPage
1cc717d checkbox-touch: use TestPageBody in QmlConfinedPage
19cfda1 checkbox-touch: use TestPageBody in QmlNativePage
c46562f checkbox-touch: remove dead code
b73193d checkbox-touch: add `createPage` helper
0149d03 checkbox-touch: use `createPage` helper throughout the app

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Really pleasant review, Thanks :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox-touch/checkbox-touch.qml'
2--- checkbox-touch/checkbox-touch.qml 2015-09-08 18:33:18 +0000
3+++ checkbox-touch/checkbox-touch.qml 2015-09-15 12:54:51 +0000
4@@ -1,7 +1,7 @@
5 /*
6 * This file is part of Checkbox
7 *
8- * Copyright 2014 Canonical Ltd.
9+ * Copyright 2014, 2015 Canonical Ltd.
10 *
11 * Authors:
12 * - Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
13@@ -400,6 +400,27 @@
14 visible: false
15 __customHeaderContents: progressHeader;
16 }
17+ /*
18+ * Create a page from a Component defined in `url` with a common
19+ * progress header if `test` is supplied.
20+ * If Component definition has errors, display a proper popup.
21+ */
22+ function createPage(url, test) {
23+ var pageComponent = Qt.createComponent(Qt.resolvedUrl(url));
24+ if (pageComponent.status == Component.Error) {
25+ var msg = i18n.tr("Could not create component '") + url + "'\n" + pageComponent.errorString();
26+ console.error(msg);
27+ ErrorLogic.showError(mainView, msg, Qt.quit, i18n.tr("Quit"));
28+ } else {
29+ var pageObject = pageComponent.createObject();
30+ if (test) {
31+ pageObject.test = test;
32+ pageObject.__customHeaderContents = progressHeader;
33+ progressHeader.update(test)
34+ }
35+ return pageObject;
36+ }
37+ }
38
39 function resumeOrStartSession() {
40 app.isSessionResumable(function(result) {
41@@ -501,7 +522,7 @@
42 function showResultsScreen() {
43 pageStack.clear();
44 app.getResults(function(results) {
45- var resultsPage = Qt.createComponent(Qt.resolvedUrl("components/ResultsPage.qml")).createObject();
46+ var resultsPage = createPage("components/ResultsPage.qml");
47 resultsPage.results = results;
48 if (appSettings["submission"]) {
49 resultsPage.submissionName = appSettings["submission"].name;
50@@ -558,29 +579,22 @@
51 }
52
53 function performAutomatedTest(test) {
54- var automatedTestPage = Qt.createComponent(Qt.resolvedUrl("components/AutomatedTestPage.qml")).createObject();
55- automatedTestPage.test = test;
56- automatedTestPage.__customHeaderContents = progressHeader;
57- progressHeader.update(test);
58+ var automatedTestPage = createPage("components/AutomatedTestPage.qml", test);
59 pageStack.push(automatedTestPage);
60 runTestActivity(test, completeTest);
61 }
62
63 function performManualTest(test) {
64 runTestActivity(test, function(test) {
65- var manualIntroPage = Qt.createComponent(Qt.resolvedUrl("components/ManualIntroPage.qml")).createObject();
66- manualIntroPage.test = test
67+ var manualIntroPage = createPage("components/ManualIntroPage.qml", test);
68 manualIntroPage.testDone.connect(completeTest);
69 manualIntroPage.continueClicked.connect(function() { showVerificationScreen(test); });
70- manualIntroPage.__customHeaderContents = progressHeader;
71- progressHeader.update(test);
72 pageStack.push(manualIntroPage);
73 });
74 }
75
76 function performUserInteractVerifyTest(test) {
77- var InteractIntroPage = Qt.createComponent(Qt.resolvedUrl("components/InteractIntroPage.qml")).createObject();
78- InteractIntroPage.test = test;
79+ var InteractIntroPage = createPage("components/InteractIntroPage.qml", test);
80 InteractIntroPage.testStarted.connect(function() {
81 runTestActivity(test, function(test) {
82 InteractIntroPage.stopActivity();
83@@ -588,75 +602,51 @@
84 });
85 });
86 InteractIntroPage.testDone.connect(completeTest);
87- InteractIntroPage.__customHeaderContents = progressHeader;
88- progressHeader.update(test);
89 pageStack.push(InteractIntroPage);
90 }
91
92 function performUserInteractTest(test) {
93- var InteractIntroPage = Qt.createComponent(Qt.resolvedUrl("components/InteractIntroPage.qml")).createObject();
94- InteractIntroPage.test = test;
95+ var InteractIntroPage = createPage("components/InteractIntroPage.qml", test);
96 InteractIntroPage.testStarted.connect(function() {
97 runTestActivity(test, function(test) {
98 InteractIntroPage.stopActivity();
99- var userInteractSummaryPage = Qt.createComponent(Qt.resolvedUrl("components/UserInteractSummaryPage.qml")).createObject();
100- userInteractSummaryPage.test = test;
101+ var userInteractSummaryPage = createPage("components/UserInteractSummaryPage.qml", test);
102 userInteractSummaryPage.testDone.connect(completeTest);
103- userInteractSummaryPage.__customHeaderContents = progressHeader;
104- progressHeader.update(test);
105 pageStack.push(userInteractSummaryPage);
106 });
107 });
108 InteractIntroPage.testDone.connect(completeTest);
109- InteractIntroPage.__customHeaderContents = progressHeader;
110- progressHeader.update(test);
111 pageStack.push(InteractIntroPage);
112 }
113
114 function performUserVerifyTest(test) {
115- var InteractIntroPage = Qt.createComponent(Qt.resolvedUrl("components/InteractIntroPage.qml")).createObject();
116- InteractIntroPage.test = test;
117+ var InteractIntroPage = createPage("components/InteractIntroPage.qml", test);
118 InteractIntroPage.testDone.connect(completeTest);
119 InteractIntroPage.testStarted.connect(function() {
120 runTestActivity(test, function(test) { showVerificationScreen(test); } );
121 });
122- InteractIntroPage.__customHeaderContents = progressHeader;
123- progressHeader.update(test);
124 pageStack.push(InteractIntroPage);
125 }
126
127 function performQmlTest(test) {
128 runTestActivity(test, function(test) {
129- var comp = Qt.createComponent(Qt.resolvedUrl("components/QmlNativePage.qml"))
130- console.log(comp.errorString());
131- var qmlNativePage = comp.createObject();
132- qmlNativePage.test = test
133+ var qmlNativePage = createPage("components/QmlNativePage.qml", test);
134 qmlNativePage.testDone.connect(completeTest);
135- qmlNativePage.__customHeaderContents = progressHeader;
136- progressHeader.update(test);
137 pageStack.push(qmlNativePage);
138 });
139 }
140 function performConfinedQmlTest(test) {
141 runTestActivity(test, function(test) {
142- var comp = Qt.createComponent(Qt.resolvedUrl("components/QmlConfinedPage.qml"))
143- console.log(comp.errorString());
144- var qmlNativePage = comp.createObject();
145- qmlNativePage.test = test
146+ var qmlNativePage = createPage("components/QmlConfinedPage.qm;");
147 qmlNativePage.applicationVersion = app.applicationVersion;
148 qmlNativePage.testDone.connect(completeTest);
149- qmlNativePage.__customHeaderContents = progressHeader;
150- progressHeader.update(test);
151 pageStack.push(qmlNativePage);
152 });
153 }
154
155 function showVerificationScreen(test) {
156- var verificationPage = Qt.createComponent(Qt.resolvedUrl("components/TestVerificationPage.qml")).createObject();
157- verificationPage.test = test
158+ var verificationPage = createPage("components/TestVerificationPage.qml", test);
159 verificationPage.testDone.connect(completeTest);
160- verificationPage.__customHeaderContents = progressHeader;
161- progressHeader.update(test);
162 pageStack.push(verificationPage);
163 }
164 function getSubmissionInput(continuation, cancelContinuation) {
165@@ -672,7 +662,6 @@
166 var process_input = function() {
167 if (input_vars.length > 0) {
168 var input = input_vars.shift();
169- var dlg_cmp = Qt.createComponent(Qt.resolvedUrl("components/InputDialog.qml"));
170 var dlg = Qt.createComponent(Qt.resolvedUrl("components/InputDialog.qml")).createObject(mainView);
171 dlg.prompt = input.prompt;
172 dlg.textEntered.connect(function(text) {
173
174=== modified file 'checkbox-touch/components/AutomatedTestPage.qml'
175--- checkbox-touch/components/AutomatedTestPage.qml 2015-07-17 08:36:57 +0000
176+++ checkbox-touch/components/AutomatedTestPage.qml 2015-09-15 12:54:51 +0000
177@@ -1,7 +1,7 @@
178 /*
179 * This file is part of Checkbox
180 *
181- * Copyright 2014 Canonical Ltd.
182+ * Copyright 2014, 2015 Canonical Ltd.
183 *
184 * Authors:
185 * - Maciej Kisielewski <maciej.kisielewski@canonical.com>
186@@ -40,32 +40,9 @@
187
188 visible: false
189
190- ColumnLayout {
191- spacing: units.gu(3)
192- anchors {
193- top: parent.top
194- left: parent.left
195- right: parent.right
196- topMargin: units.gu(3)
197- bottomMargin: units.gu(3)
198- leftMargin: units.gu(1)
199- rightMargin: units.gu(1)
200- }
201-
202- Label {
203- fontSize: "large"
204- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
205- Layout.alignment: Qt.AlignLeft
206- text: test["name"]
207- font.bold: true
208- }
209-
210- Label {
211- fontSize: "medium"
212- Layout.fillWidth: true
213- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
214- text: test["description"]
215- }
216+ TestPageBody {
217+ header: test["name"]
218+ body: test["description"]
219 }
220 ColumnLayout {
221 anchors {
222
223=== modified file 'checkbox-touch/components/InteractIntroPage.qml'
224--- checkbox-touch/components/InteractIntroPage.qml 2015-09-11 13:28:35 +0000
225+++ checkbox-touch/components/InteractIntroPage.qml 2015-09-15 12:54:51 +0000
226@@ -1,7 +1,7 @@
227 /*
228 * This file is part of Checkbox
229 *
230- * Copyright 2014 Canonical Ltd.
231+ * Copyright 2014, 2015 Canonical Ltd.
232 *
233 * Authors:
234 * - Maciej Kisielewski <maciej.kisielewski@canonical.com>
235@@ -30,7 +30,7 @@
236 import Ubuntu.Components 1.1
237 import Ubuntu.Components.Popups 0.1
238 import QtQuick.Layouts 1.1
239-import "ConfirmationLogic.js" as ConfirmationLogic
240+import "actions"
241
242 Page {
243 id: userInteractVerifyIntroPage
244@@ -48,36 +48,9 @@
245 title: i18n.tr("Test Description")
246 head {
247 actions: [
248- Action {
249- id: addCommentAction
250- iconName: "note-new"
251- text: i18n.tr("Add comment")
252- onTriggered: {
253- commentsDialog.commentDefaultText = test["comments"] || "";
254- commentsDialog.commentAdded.connect(function(comment) {
255- test["comments"] = comment;
256- });
257- PopupUtils.open(commentsDialog.dialogComponent);
258- }
259- },
260- Action {
261+ AddCommentAction {},
262+ SkipAction {
263 id: skipAction
264- objectName: "skip"
265- iconName: "media-seek-forward"
266- text: i18n.tr("Skip")
267- onTriggered: {
268- var confirmationOptions = {
269- question : i18n.tr("Do you really want to skip this test?"),
270- remember : true,
271- }
272- ConfirmationLogic.confirmRequest(userInteractVerifyIntroPage,
273- confirmationOptions, function(res) {
274- if (res) {
275- test["outcome"] = "skip";
276- testDone(test);
277- }
278- });
279- }
280 }
281 ]
282 }
283@@ -96,34 +69,9 @@
284 }
285 ]
286
287- ColumnLayout {
288- id: descriptionContent
289- spacing: units.gu(3)
290- anchors {
291- fill: parent
292- topMargin: units.gu(3)
293- bottomMargin: units.gu(3)
294- leftMargin: units.gu(1)
295- rightMargin: units.gu(1)
296- }
297-
298- Label {
299- objectName: "testNameLabel"
300- fontSize: "large"
301- Layout.fillWidth: true
302- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
303- text: test["name"]
304- font.bold: true
305- }
306-
307- Label {
308- fontSize: "medium"
309- Layout.fillWidth: true
310- Layout.fillHeight: true
311- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
312- text: test["description"]
313- }
314-
315+ TestPageBody {
316+ header: test["name"]
317+ body: test["description"]
318 ActivityIndicator {
319 id: activity
320 Layout.alignment: Qt.AlignHCenter
321
322=== modified file 'checkbox-touch/components/ManualIntroPage.qml'
323--- checkbox-touch/components/ManualIntroPage.qml 2015-09-14 08:28:09 +0000
324+++ checkbox-touch/components/ManualIntroPage.qml 2015-09-15 12:54:51 +0000
325@@ -1,7 +1,7 @@
326 /*
327 * This file is part of Checkbox
328 *
329- * Copyright 2014 Canonical Ltd.
330+ * Copyright 2014, 2015 Canonical Ltd.
331 *
332 * Authors:
333 * - Maciej Kisielewski <maciej.kisielewski@canonical.com>
334@@ -29,7 +29,7 @@
335 import Ubuntu.Components 1.1
336 import QtQuick.Layouts 1.1
337 import Ubuntu.Components.Popups 0.1
338-import "ConfirmationLogic.js" as ConfirmationLogic
339+import "actions"
340
341 Page {
342 id: manualIntroPage
343@@ -42,72 +42,14 @@
344 title: i18n.tr("Test Description")
345 head {
346 actions: [
347- Action {
348- id: addCommentAction
349- iconName: "note-new"
350- text: i18n.tr("Add comment")
351- onTriggered: {
352- commentsDialog.commentDefaultText = test["comments"] || "";
353- commentsDialog.commentAdded.connect(function(comment) {
354- test["comments"] = comment;
355- });
356- PopupUtils.open(commentsDialog.dialogComponent);
357- }
358- },
359- Action {
360- id: skipAction
361- objectName: "skip"
362- iconName: "media-seek-forward"
363- text: i18n.tr("Skip")
364- onTriggered: {
365- var confirmationOptions = {
366- question : i18n.tr("Do you really want to skip this test?"),
367- remember : true,
368- }
369- ConfirmationLogic.confirmRequest(manualIntroPage,
370- confirmationOptions, function(res) {
371- if (res) {
372- test["outcome"] = "skip";
373- testDone(test);
374- }
375- });
376- }
377- }
378+ AddCommentAction {},
379+ SkipAction {}
380 ]
381 }
382
383- ColumnLayout {
384- spacing: units.gu(3)
385- anchors {
386- fill: parent
387- topMargin: units.gu(3)
388- bottomMargin: units.gu(3)
389- leftMargin: units.gu(1)
390- rightMargin: units.gu(1)
391- }
392-
393- Label {
394- fontSize: "large"
395- Layout.fillWidth: true
396- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
397- text: test["name"]
398- font.bold: true
399- }
400-
401- Flickable {
402- Layout.fillWidth: true
403- Layout.fillHeight: true
404- contentHeight: childrenRect.height
405- flickableDirection: Flickable.VerticalFlick
406- clip: true
407- Label {
408- fontSize: "medium"
409- anchors.fill: parent
410- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
411- text: test["description"]
412- }
413- }
414-
415+ TestPageBody {
416+ header: test["name"]
417+ body: test["description"]
418 Button {
419 objectName: "continueButton"
420 color: UbuntuColors.green
421
422=== modified file 'checkbox-touch/components/QmlConfinedPage.qml'
423--- checkbox-touch/components/QmlConfinedPage.qml 2015-09-14 08:28:09 +0000
424+++ checkbox-touch/components/QmlConfinedPage.qml 2015-09-15 12:54:51 +0000
425@@ -26,8 +26,8 @@
426 import Ubuntu.Components 1.1
427 import Ubuntu.Components.Popups 0.1
428 import QtQuick.Layouts 1.1
429-import "ConfirmationLogic.js" as ConfirmationLogic
430 import Ubuntu.Content 1.1
431+import "actions"
432
433 Page {
434 id: qmlNativePage
435@@ -76,71 +76,14 @@
436
437 head {
438 actions: [
439- Action {
440- id: addCommentAction
441- iconName: "note-new"
442- text: i18n.tr("Add comment")
443- onTriggered: {
444- commentsDialog.commentDefaultText = test["comments"] || "";
445- commentsDialog.commentAdded.connect(function(comment) {
446- test["comments"] = comment;
447- });
448- PopupUtils.open(commentsDialog.dialogComponent);
449- }
450- },
451- Action {
452- id: skipAction
453- iconName: "media-seek-forward"
454- text: i18n.tr("Skip")
455- onTriggered: {
456- var confirmationOptions = {
457- question : i18n.tr("Do you really want to skip this test?"),
458- remember : true,
459- }
460- ConfirmationLogic.confirmRequest(qmlNativePage,
461- confirmationOptions, function(res) {
462- if (res) {
463- test["outcome"] = "skip";
464- testDone(test);
465- }
466- });
467- }
468- }
469+ AddCommentAction {},
470+ SkipAction {}
471 ]
472 }
473
474- ColumnLayout {
475- id: body
476- spacing: units.gu(3)
477- anchors {
478- fill: parent
479- topMargin: units.gu(3)
480- bottomMargin: units.gu(3)
481- leftMargin: units.gu(1)
482- rightMargin: units.gu(1)
483- }
484-
485- Label {
486- fontSize: "large"
487- Layout.fillWidth: true
488- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
489- text: test["name"]
490- font.bold: true
491- }
492-
493- Flickable {
494- Layout.fillWidth: true
495- Layout.fillHeight: true
496- contentHeight: childrenRect.height
497- flickableDirection: Flickable.VerticalFlick
498- clip: true
499- Label {
500- fontSize: "medium"
501- anchors.fill: parent
502- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
503- text: test["description"]
504- }
505- }
506+ TestPageBody {
507+ header: test["name"]
508+ body: test["description"]
509
510 ColumnLayout {
511 id: busyIndicatorGroup
512
513=== modified file 'checkbox-touch/components/QmlNativePage.qml'
514--- checkbox-touch/components/QmlNativePage.qml 2015-09-14 08:28:09 +0000
515+++ checkbox-touch/components/QmlNativePage.qml 2015-09-15 12:54:51 +0000
516@@ -1,7 +1,7 @@
517 /*
518 * This file is part of Checkbox
519 *
520- * Copyright 2014 Canonical Ltd.
521+ * Copyright 2014, 2015 Canonical Ltd.
522 *
523 * Authors:
524 * - Maciej Kisielewski <maciej.kisielewski@canonical.com>
525@@ -26,7 +26,7 @@
526 import Ubuntu.Components 1.1
527 import Ubuntu.Components.Popups 0.1
528 import QtQuick.Layouts 1.1
529-import "ConfirmationLogic.js" as ConfirmationLogic
530+import "actions"
531
532 Page {
533 id: qmlNativePage
534@@ -49,71 +49,14 @@
535
536 head {
537 actions: [
538- Action {
539- id: addCommentAction
540- iconName: "note-new"
541- text: i18n.tr("Add comment")
542- onTriggered: {
543- commentsDialog.commentDefaultText = test["comments"] || "";
544- commentsDialog.commentAdded.connect(function(comment) {
545- test["comments"] = comment;
546- });
547- PopupUtils.open(commentsDialog.dialogComponent);
548- }
549- },
550- Action {
551- id: skipAction
552- iconName: "media-seek-forward"
553- text: i18n.tr("Skip")
554- onTriggered: {
555- var confirmationOptions = {
556- question : i18n.tr("Do you really want to skip this test?"),
557- remember : true,
558- }
559- ConfirmationLogic.confirmRequest(qmlNativePage,
560- confirmationOptions, function(res) {
561- if (res) {
562- test["outcome"] = "skip";
563- testDone(test);
564- }
565- });
566- }
567- }
568+ AddCommentAction {},
569+ SkipAction {}
570 ]
571 }
572
573- ColumnLayout {
574- id: body
575- spacing: units.gu(3)
576- anchors {
577- fill: parent
578- topMargin: units.gu(3)
579- bottomMargin: units.gu(3)
580- leftMargin: units.gu(1)
581- rightMargin: units.gu(1)
582- }
583-
584- Label {
585- fontSize: "large"
586- Layout.fillWidth: true
587- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
588- text: test["name"]
589- font.bold: true
590- }
591-
592- Flickable {
593- Layout.fillWidth: true
594- Layout.fillHeight: true
595- contentHeight: childrenRect.height
596- flickableDirection: Flickable.VerticalFlick
597- clip: true
598- Label {
599- fontSize: "medium"
600- anchors.fill: parent
601- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
602- text: test["description"]
603- }
604- }
605+ TestPageBody {
606+ header: test["name"]
607+ body: test["description"]
608
609 LatchButton {
610 objectName: "continueButton"
611
612=== added file 'checkbox-touch/components/TestPageBody.qml'
613--- checkbox-touch/components/TestPageBody.qml 1970-01-01 00:00:00 +0000
614+++ checkbox-touch/components/TestPageBody.qml 2015-09-15 12:54:51 +0000
615@@ -0,0 +1,77 @@
616+/*
617+ * This file is part of Checkbox
618+ *
619+ * Copyright 2015 Canonical Ltd.
620+ *
621+ * Authors:
622+ * - Maciej Kisielewski <maciej.kisielewski@canonical.com>
623+ *
624+ * This program is free software; you can redistribute it and/or modify
625+ * it under the terms of the GNU General Public License as published by
626+ * the Free Software Foundation; version 3.
627+ *
628+ * This program is distributed in the hope that it will be useful,
629+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
630+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
631+ * GNU General Public License for more details.
632+ *
633+ * You should have received a copy of the GNU General Public License
634+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
635+ */
636+
637+/*! \brief ColumnLayout components with header and body labels already included
638+ * and some common UX properties already set.
639+ */
640+
641+import QtQuick 2.0
642+import QtQuick.Layouts 1.1
643+import Ubuntu.Components 1.1
644+import Ubuntu.Components.Popups 0.1
645+
646+ColumnLayout {
647+ /* this property is the text to be shown in the top label */
648+ property var header: ""
649+
650+ /* this property is the text that's used as the main body of the page. It
651+ * will be wrapping itself, filling width of the page (column), and will be
652+ * flickable */
653+ property var body: ""
654+
655+ /* set fullHeightBody to false if you want to have control over layout in
656+ * the code that uses TestPageBody. You might want for instance have one
657+ * item that dominates the page.
658+ * If left set as true the layout is split evenly between children. */
659+ property var fullHeightBody: true
660+
661+ spacing: units.gu(3)
662+ anchors {
663+ fill: parent
664+ topMargin: units.gu(3)
665+ bottomMargin: units.gu(3)
666+ leftMargin: units.gu(1)
667+ rightMargin: units.gu(1)
668+ }
669+
670+ Label {
671+ objectName: "headerLabel"
672+ fontSize: "large"
673+ Layout.fillWidth: true
674+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
675+ text: header
676+ font.bold: true
677+ }
678+
679+ Flickable {
680+ Layout.fillWidth: true
681+ Layout.fillHeight: fullHeightBody
682+ contentHeight: childrenRect.height
683+ flickableDirection: Flickable.VerticalFlick
684+ clip: true
685+ Label {
686+ fontSize: "medium"
687+ anchors.fill: parent
688+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
689+ text: body
690+ }
691+ }
692+}
693
694=== modified file 'checkbox-touch/components/TestVerificationPage.qml'
695--- checkbox-touch/components/TestVerificationPage.qml 2015-09-14 08:42:00 +0000
696+++ checkbox-touch/components/TestVerificationPage.qml 2015-09-15 12:54:51 +0000
697@@ -1,7 +1,7 @@
698 /*
699 * This file is part of Checkbox
700 *
701- * Copyright 2014 Canonical Ltd.
702+ * Copyright 2014, 2015 Canonical Ltd.
703 *
704 * Authors:
705 * - Maciej Kisielewski <maciej.kisielewski@canonical.com>
706@@ -29,7 +29,7 @@
707 import Ubuntu.Components 1.1
708 import QtQuick.Layouts 1.1
709 import Ubuntu.Components.Popups 0.1
710-import "ConfirmationLogic.js" as ConfirmationLogic
711+import "actions"
712
713 Page {
714 id: testVerification
715@@ -42,71 +42,14 @@
716
717 head {
718 actions: [
719- Action {
720- id: addCommentAction
721- iconName: "note-new"
722- text: i18n.tr("Add comment")
723- onTriggered: {
724- commentsDialog.commentDefaultText = test["comments"] || "";
725- commentsDialog.commentAdded.connect(function(comment) {
726- test["comments"] = comment;
727- });
728- PopupUtils.open(commentsDialog.dialogComponent);
729- }
730- },
731- Action {
732- objectName: "skip"
733- iconName: "media-seek-forward"
734- text: i18n.tr("Skip")
735- onTriggered: {
736- var confirmationOptions = {
737- question : i18n.tr("Do you really want to skip this test?"),
738- remember : true,
739- }
740- ConfirmationLogic.confirmRequest(testVerification,
741- confirmationOptions, function(res) {
742- if (res) {
743- test["outcome"] = "skip";
744- latchingTestDone();
745- }
746- });
747- }
748- }
749+ AddCommentAction {},
750+ SkipAction {}
751 ]
752 }
753
754- ColumnLayout {
755- id: descriptionContent
756- spacing: units.gu(3)
757- anchors {
758- fill: parent
759- topMargin: units.gu(3)
760- bottomMargin: units.gu(3)
761- leftMargin: units.gu(1)
762- rightMargin: units.gu(1)
763- }
764-
765- Label {
766- fontSize: "large"
767- Layout.fillWidth: true
768- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
769- text: test["name"]
770- font.bold: true
771- }
772-
773- Flickable {
774- Layout.fillWidth: true
775- Layout.fillHeight: true
776- contentHeight: childrenRect.height
777- flickableDirection: Flickable.VerticalFlick
778- clip: true
779- Label {
780- fontSize: "medium"
781- anchors.fill: parent
782- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
783- text: test["verificationDescription"]
784- }
785- }
786+ TestPageBody {
787+ header: test["name"]
788+ body: test["verificationDescription"]
789
790 Button {
791 id: showOutputButton
792
793=== modified file 'checkbox-touch/components/UserInteractSummaryPage.qml'
794--- checkbox-touch/components/UserInteractSummaryPage.qml 2015-09-11 13:28:35 +0000
795+++ checkbox-touch/components/UserInteractSummaryPage.qml 2015-09-15 12:54:51 +0000
796@@ -1,7 +1,7 @@
797 /*
798 * This file is part of Checkbox
799 *
800- * Copyright 2014 Canonical Ltd.
801+ * Copyright 2014, 2015 Canonical Ltd.
802 *
803 * Authors:
804 * - Maciej Kisielewski <maciej.kisielewski@canonical.com>
805@@ -29,7 +29,7 @@
806 import Ubuntu.Components 1.1
807 import Ubuntu.Components.Popups 0.1
808 import QtQuick.Layouts 1.1
809-import "ConfirmationLogic.js" as ConfirmationLogic
810+import "actions"
811
812 Page {
813 id: userInteractSummary
814@@ -42,55 +42,14 @@
815
816 head {
817 actions: [
818- Action {
819- id: addCommentAction
820- iconName: "note-new"
821- text: i18n.tr("Add comment")
822- onTriggered: {
823- commentsDialog.commentDefaultText = test["comments"] || "";
824- commentsDialog.commentAdded.connect(function(comment) {
825- test["comments"] = comment;
826- });
827- PopupUtils.open(commentsDialog.dialogComponent);
828- }
829- },
830- Action {
831- iconName: "media-seek-forward"
832- text: i18n.tr("Skip")
833- onTriggered: {
834- var confirmationOptions = {
835- question : i18n.tr("Do you really want to skip this test?"),
836- remember : true,
837- }
838- ConfirmationLogic.confirmRequest(userInteractSummary,
839- confirmationOptions, function(res) {
840- if (res) {
841- test["outcome"] = "skip";
842- testDone(test);
843- }
844- });
845- }
846- }
847+ AddCommentAction {},
848+ SkipAction {}
849 ]
850 }
851
852- ColumnLayout {
853- spacing: units.gu(3)
854- anchors {
855- fill: parent
856- topMargin: units.gu(3)
857- bottomMargin: units.gu(3)
858- leftMargin: units.gu(1)
859- rightMargin: units.gu(1)
860- }
861-
862- Label {
863- fontSize: "large"
864- Layout.fillWidth: true
865- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
866- text: test["name"]
867- font.bold: true
868- }
869+ TestPageBody {
870+ header: test["name"]
871+ fullHeightBody: false
872
873 Row {
874 Layout.fillWidth: true
875
876=== added directory 'checkbox-touch/components/actions'
877=== added file 'checkbox-touch/components/actions/AddCommentAction.qml'
878--- checkbox-touch/components/actions/AddCommentAction.qml 1970-01-01 00:00:00 +0000
879+++ checkbox-touch/components/actions/AddCommentAction.qml 2015-09-15 12:54:51 +0000
880@@ -0,0 +1,39 @@
881+/*
882+ * This file is part of Checkbox
883+ *
884+ * Copyright 2015 Canonical Ltd.
885+ *
886+ * Authors:
887+ * - Maciej Kisielewski <maciej.kisielewski@canonical.com>
888+ *
889+ * This program is free software; you can redistribute it and/or modify
890+ * it under the terms of the GNU General Public License as published by
891+ * the Free Software Foundation; version 3.
892+ *
893+ * This program is distributed in the hope that it will be useful,
894+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
895+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
896+ * GNU General Public License for more details.
897+ *
898+ * You should have received a copy of the GNU General Public License
899+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
900+ */
901+
902+/*! \brief Action component for adding a comment. */
903+
904+import QtQuick 2.0
905+import Ubuntu.Components 1.1
906+import Ubuntu.Components.Popups 0.1
907+
908+Action {
909+ id: addCommentAction
910+ iconName: "note-new"
911+ text: i18n.tr("Add comment")
912+ onTriggered: {
913+ commentsDialog.commentDefaultText = test["comments"] || "";
914+ commentsDialog.commentAdded.connect(function(comment) {
915+ test["comments"] = comment;
916+ });
917+ PopupUtils.open(commentsDialog.dialogComponent);
918+ }
919+}
920
921=== added file 'checkbox-touch/components/actions/SkipAction.qml'
922--- checkbox-touch/components/actions/SkipAction.qml 1970-01-01 00:00:00 +0000
923+++ checkbox-touch/components/actions/SkipAction.qml 2015-09-15 12:54:51 +0000
924@@ -0,0 +1,47 @@
925+/*
926+ * This file is part of Checkbox
927+ *
928+ * Copyright 2015 Canonical Ltd.
929+ *
930+ * Authors:
931+ * - Maciej Kisielewski <maciej.kisielewski@canonical.com>
932+ *
933+ * This program is free software; you can redistribute it and/or modify
934+ * it under the terms of the GNU General Public License as published by
935+ * the Free Software Foundation; version 3.
936+ *
937+ * This program is distributed in the hope that it will be useful,
938+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
939+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
940+ * GNU General Public License for more details.
941+ *
942+ * You should have received a copy of the GNU General Public License
943+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
944+ */
945+
946+/*! \brief Action component for skipping a test. */
947+
948+import QtQuick 2.0
949+import Ubuntu.Components 1.1
950+import Ubuntu.Components.Popups 0.1
951+import "../ConfirmationLogic.js" as ConfirmationLogic
952+
953+Action {
954+ id: skipAction
955+ objectName: "skip"
956+ iconName: "media-seek-forward"
957+ text: i18n.tr("Skip")
958+ onTriggered: {
959+ var confirmationOptions = {
960+ question : i18n.tr("Do you really want to skip this test?"),
961+ remember : true,
962+ }
963+ ConfirmationLogic.confirmRequest(mainView,
964+ confirmationOptions, function(res) {
965+ if (res) {
966+ test["outcome"] = "skip";
967+ testDone(test);
968+ }
969+ });
970+ }
971+}
972
973=== modified file 'checkbox-touch/tests/autopilot/checkbox_touch/test_checkbox_touch.py'
974--- checkbox-touch/tests/autopilot/checkbox_touch/test_checkbox_touch.py 2015-08-31 10:53:52 +0000
975+++ checkbox-touch/tests/autopilot/checkbox_touch/test_checkbox_touch.py 2015-09-15 12:54:51 +0000
976@@ -133,7 +133,7 @@
977 intro_page = self.app.wait_select_single(
978 objectName='userInteractVerifyIntroPage', visible=True)
979 test_name_label = intro_page.wait_select_single(
980- objectName='testNameLabel', visible=True)
981+ objectName='headerLabel', visible=True)
982 self.assertThat(test_name_label.text,
983 Eventually(Equals('autopilot/user-verify-1')))
984
985@@ -149,7 +149,7 @@
986 intro_page = self.app.wait_select_single(
987 objectName='userInteractVerifyIntroPage', visible=True)
988 test_name_label = intro_page.wait_select_single(
989- objectName='testNameLabel', visible=True)
990+ objectName='headerLabel', visible=True)
991 self.assertThat(test_name_label.text,
992 Eventually(Equals('autopilot/user-verify-2')))
993
994
995=== modified file 'checkbox-touch/tests/autopilot/run'
996--- checkbox-touch/tests/autopilot/run 2015-08-28 20:07:21 +0000
997+++ checkbox-touch/tests/autopilot/run 2015-09-15 12:54:51 +0000
998@@ -1,6 +1,6 @@
999 #!/bin/bash
1000
1001-if [[ -z `which autopilot` ]]; then
1002+if [[ -z `which autopilot3` ]]; then
1003 echo "Autopilot is not installed. Skip"
1004 exit 1
1005 fi

Subscribers

People subscribed via source and target branches