Merge lp:~mzanetti/reminders-app/qmltest3 into lp:reminders-app

Proposed by Michael Zanetti
Status: Needs review
Proposed branch: lp:~mzanetti/reminders-app/qmltest3
Merge into: lp:reminders-app
Prerequisite: lp:~mzanetti/reminders-app/qmltest2
Diff against target: 325 lines (+156/-14)
8 files modified
src/app/qml/components/EditTagsDialog.qml (+4/-0)
src/app/qml/components/ListItemWithActions.qml (+2/-0)
src/app/qml/components/NotebooksDelegate.qml (+3/-2)
src/app/qml/components/NotesDelegate.qml (+2/-0)
src/app/qml/ui/SetReminderPage.qml (+1/-0)
src/app/qml/ui/SetReminderView.qml (+3/-0)
tests/qml/RemindersTestCase.qml (+53/-0)
tests/qml/tst_NotesPage.qml (+88/-12)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/qmltest3
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Needs Fixing
Nicholas Skaggs (community) Needs Fixing
Riccardo Padovani Needs Information
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Review via email: mp+253753@code.launchpad.net

Commit message

add more tests for the NotePage

* setting/unsetting a reminder
* tagging/untagging a note

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Thanks for working on this :-)

I left some comments inline - nothing wrong, but I'm not sure about some choices

review: Needs Information
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/reminders-app-autolanding/2/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/102/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Text conflict in debian/control
Text conflict in src/app/qml/components/EditTagsDialog.qml
Text conflict in src/app/qml/components/ListItemWithActions.qml

review: Needs Fixing
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/reminders-app-autolanding/259/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/378/console

review: Needs Fixing (continuous-integration)

Unmerged revisions

299. By Michael Zanetti

add more tests for the NotePage

* setting/unsetting a reminder
* tagging/untagging a note

298. By Michael Zanetti

more build-deps update

297. By Michael Zanetti

update build-deps

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/app/qml/components/EditTagsDialog.qml'
--- src/app/qml/components/EditTagsDialog.qml 2015-02-27 22:43:12 +0000
+++ src/app/qml/components/EditTagsDialog.qml 2015-03-21 04:19:08 +0000
@@ -41,6 +41,7 @@
4141
42 TextField {42 TextField {
43 id: textField43 id: textField
44 objectName: "newTagTextField"
44 Layout.fillWidth: true45 Layout.fillWidth: true
45 placeholderText: i18n.tr("Create a new tag")46 placeholderText: i18n.tr("Create a new tag")
4647
@@ -70,6 +71,7 @@
70 }71 }
7172
72 Button {73 Button {
74 objectName: "createTagButton"
73 text: i18n.tr("Create tag")75 text: i18n.tr("Create tag")
74 color: UbuntuColors.orange76 color: UbuntuColors.orange
75 enabled: textField.text.replace(/\s+/g, '') !== ''; // Not only whitespaces!77 enabled: textField.text.replace(/\s+/g, '') !== ''; // Not only whitespaces!
@@ -91,6 +93,7 @@
91 model: tags93 model: tags
9294
93 delegate: OptionSelectorDelegate {95 delegate: OptionSelectorDelegate {
96 objectName: "tagDelegate" + index
94 text: model.name97 text: model.name
95 selected: root.note ? root.note.tagGuids.indexOf(model.guid) !== -1 : false98 selected: root.note ? root.note.tagGuids.indexOf(model.guid) !== -1 : false
9699
@@ -112,6 +115,7 @@
112115
113 Button {116 Button {
114 id: closeButton117 id: closeButton
118 objectName: "tagsDialogCloseButton"
115 Layout.preferredWidth: parent.width - units.gu(2)119 Layout.preferredWidth: parent.width - units.gu(2)
116 Layout.alignment: Qt.AlignHCenter120 Layout.alignment: Qt.AlignHCenter
117121
118122
=== modified file 'src/app/qml/components/ListItemWithActions.qml'
--- src/app/qml/components/ListItemWithActions.qml 2015-02-13 01:02:58 +0000
+++ src/app/qml/components/ListItemWithActions.qml 2015-03-21 04:19:08 +0000
@@ -196,6 +196,7 @@
196 color: UbuntuColors.red196 color: UbuntuColors.red
197197
198 Icon {198 Icon {
199 objectName: "leftAction"
199 anchors {200 anchors {
200 centerIn: parent201 centerIn: parent
201 horizontalCenterOffset: actionThreshold / 2202 horizontalCenterOffset: actionThreshold / 2
@@ -233,6 +234,7 @@
233234
234 model: _showActions ? _visibleRightSideActions : []235 model: _showActions ? _visibleRightSideActions : []
235 Item {236 Item {
237 objectName: "rightAction" + index
236 property alias image: img238 property alias image: img
237239
238 height: rightActionsView.height240 height: rightActionsView.height
239241
=== modified file 'src/app/qml/components/NotebooksDelegate.qml'
--- src/app/qml/components/NotebooksDelegate.qml 2015-03-04 00:23:45 +0000
+++ src/app/qml/components/NotebooksDelegate.qml 2015-03-21 04:19:08 +0000
@@ -133,12 +133,13 @@
133 horizontalAlignment: Text.AlignRight133 horizontalAlignment: Text.AlignRight
134 }134 }
135 Icon {135 Icon {
136 anchors { left: parent.left; verticalCenter: parent.verticalCenter; right: parent.right }
137 height: width136 height: width
137 width: parent.width
138
138 name: "go-next"139 name: "go-next"
139 }140 }
140 Icon {141 Icon {
141 anchors { left: parent.left; bottom: parent.bottom; right: parent.right }142 width: parent.width
142 height: width143 height: width
143 name: model.loading ? "sync-updating" : model.syncError ? "sync-error" : model.synced ? "sync-idle" : "sync-offline"144 name: model.loading ? "sync-updating" : model.syncError ? "sync-error" : model.synced ? "sync-idle" : "sync-offline"
144 visible: NotesStore.username !== "@local" && (!model.synced || model.syncError || model.loading)145 visible: NotesStore.username !== "@local" && (!model.synced || model.syncError || model.loading)
145146
=== modified file 'src/app/qml/components/NotesDelegate.qml'
--- src/app/qml/components/NotesDelegate.qml 2015-02-23 18:44:26 +0000
+++ src/app/qml/components/NotesDelegate.qml 2015-03-21 04:19:08 +0000
@@ -129,6 +129,7 @@
129 }129 }
130130
131 Label {131 Label {
132 objectName: "tagsLabel"
132 Layout.fillWidth: true133 Layout.fillWidth: true
133 text: root.tags134 text: root.tags
134 wrapMode: Text.WordWrap135 wrapMode: Text.WordWrap
@@ -143,6 +144,7 @@
143 width: units.gu(2)144 width: units.gu(2)
144145
145 Icon {146 Icon {
147 objectName: "reminderIcon"
146 anchors { left: parent.left; top: parent.top; right: parent.right }148 anchors { left: parent.left; top: parent.top; right: parent.right }
147 height: width149 height: width
148 name: root.reminder ? "alarm-clock" : ""150 name: root.reminder ? "alarm-clock" : ""
149151
=== modified file 'src/app/qml/ui/SetReminderPage.qml'
--- src/app/qml/ui/SetReminderPage.qml 2014-09-23 12:39:27 +0000
+++ src/app/qml/ui/SetReminderPage.qml 2015-03-21 04:19:08 +0000
@@ -23,6 +23,7 @@
2323
24Page {24Page {
25 id: root25 id: root
26 objectName: "setReminderPage"
26 title: setReminderView.title27 title: setReminderView.title
27 property alias note: setReminderView.note28 property alias note: setReminderView.note
2829
2930
=== modified file 'src/app/qml/ui/SetReminderView.qml'
--- src/app/qml/ui/SetReminderView.qml 2014-12-08 10:25:48 +0000
+++ src/app/qml/ui/SetReminderView.qml 2015-03-21 04:19:08 +0000
@@ -25,6 +25,7 @@
2525
26Item {26Item {
27 id: root27 id: root
28 objectName: "setReminderView"
28 property string title: note.title29 property string title: note.title
29 property var note30 property var note
3031
@@ -72,6 +73,7 @@
72 RowLayout {73 RowLayout {
73 Layout.fillWidth: true74 Layout.fillWidth: true
74 Button {75 Button {
76 objectName: "deleteButton"
75 // TRANSLATORS: Button that deletes a reminder77 // TRANSLATORS: Button that deletes a reminder
76 text: i18n.tr("Delete")78 text: i18n.tr("Delete")
77 Layout.fillWidth: true79 Layout.fillWidth: true
@@ -83,6 +85,7 @@
83 }85 }
84 }86 }
85 Button {87 Button {
88 objectName: "saveButton"
86 Layout.fillWidth: true89 Layout.fillWidth: true
87 // TRANSLATORS: Button that saves a reminder90 // TRANSLATORS: Button that saves a reminder
88 text: i18n.tr("Save")91 text: i18n.tr("Save")
8992
=== added file 'tests/qml/RemindersTestCase.qml'
--- tests/qml/RemindersTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/qml/RemindersTestCase.qml 2015-03-21 04:19:08 +0000
@@ -0,0 +1,53 @@
1import QtQuick 2.2
2import QtTest 1.0
3import Ubuntu.Components 1.1
4import Ubuntu.Test 0.1
5import Evernote 0.1
6
7import '../../src/app/qml/'
8
9
10UbuntuTestCase {
11
12 // toIndex: 1, 2, 3 for rightActions, -1 for leftAction, defaults to 1
13 function dragListItemWithAction(delegate, actionIndex) {
14 if (actionIndex == undefined) {
15 actionIndex = 1;
16 }
17 tryCompare(delegate, "_showActions", false);
18 waitForRendering(delegate);
19
20 var x = delegate.width / 2;
21 var y = delegate.height / 2;
22 var dx = units.gu(30) * -actionIndex;
23 mousePress(delegate, 1, 1);
24 mouseMoveSlowly(delegate, x, y, dx, 0, 10, 20);
25 mouseRelease(delegate, x + dx, y);
26 waitForRendering(delegate);
27 tryCompare(delegate, "swipping", false);
28
29 var action;
30 if (actionIndex == -1) {
31 action = findChildWaiting(delegate, "leftAction");
32 } else {
33 print("FAIL searching for rightaction","rightAction" + (actionIndex - 1))
34 action = findChildWaiting(delegate, "rightAction" + (actionIndex - 1));
35 }
36 print("#### found action", action)
37 mouseClick(action, 1, 1)
38 if (actionIndex >= 0) {
39 tryCompare(delegate, "_showActions", false);
40 }
41 waitForRendering(delegate)
42 }
43
44 function findChildWaiting(root, objectName, timeout) {
45 if (timeout == undefined) {
46 timeout = 2000;
47 }
48
49 tryCompareFunction(function() {return findChild(root, objectName) != null}, true, timeout);
50 return findChild(root, objectName);
51 }
52}
53
054
=== modified file 'tests/qml/tst_NotesPage.qml'
--- tests/qml/tst_NotesPage.qml 2015-03-21 04:19:08 +0000
+++ tests/qml/tst_NotesPage.qml 2015-03-21 04:19:08 +0000
@@ -28,8 +28,25 @@
28Item {28Item {
29 id: root29 id: root
3030
31 width: units.gu(40)31 width: units.gu(46)
32 height: units.gu(60)32 height: units.gu(64)
33
34
35 Rectangle {
36 id: loading
37 anchors { left: parent.left; bottom: parent.bottom }
38 height: units.gu(1)
39 width: height
40 color: "black"
41 z: 2
42 NumberAnimation on rotation {
43 from: 0
44 to: 360
45 running: loading.visible == true
46 loops: Animation.Infinite
47 duration: 900
48 }
49 }
3350
34 QtObject {51 QtObject {
35 id: preferences52 id: preferences
@@ -53,8 +70,8 @@
53 property bool phone: true70 property bool phone: true
54 }71 }
5572
56 UbuntuTestCase {73 RemindersTestCase {
57 id: notebooksDelegateTestCase74 id: notesPageTestCase
58 name: 'notebooksDelegateTestCase'75 name: 'notebooksDelegateTestCase'
59 when: windowShown76 when: windowShown
6077
@@ -131,15 +148,8 @@
131 waitForRendering(mainView);148 waitForRendering(mainView);
132149
133 var delegate = findChild(mainView, "notesDelegate0");150 var delegate = findChild(mainView, "notesDelegate0");
151 dragListItemWithAction(delegate, -1);
134152
135 var x = delegate.width / 2
136 var y = delegate.height / 2
137 var dx = delegate.width / 2
138 mousePress(delegate, 1, 1)
139 mouseMoveSlowly(delegate, x, y, dx, 0, 10, 20)
140 mouseRelease(delegate, x + dx, y)
141 waitForRendering(mainView)
142 mouseClick(delegate, units.gu(3), y)
143 tryCompare(NotesStore, "count", 0);153 tryCompare(NotesStore, "count", 0);
144 }154 }
145155
@@ -177,5 +187,71 @@
177 compare(delegate.title, "testNote" + data.sortOrder[i]);187 compare(delegate.title, "testNote" + data.sortOrder[i]);
178 }188 }
179 }189 }
190
191 function test_setReminder() {
192 var note = createNote("testNote1");
193
194 var noteDelegate = findChild(mainView, "notesDelegate0");
195 var reminderIcon = findChild(noteDelegate, "reminderIcon");
196
197 // Make sure no reminder set yet.
198 tryCompare(reminderIcon, "visible", false);
199
200 dragListItemWithAction(noteDelegate, 1);
201
202 var setReminderView = findChildWaiting(root, "setReminderView");
203 var saveButton = findChild(setReminderView, "saveButton");
204
205 waitForRendering(setReminderView);
206 mouseClick(saveButton, 1, 1)
207
208 tryCompare(reminderIcon, "visible", true);
209
210 waitForRendering(mainView)
211 dragListItemWithAction(noteDelegate, 1);
212
213 setReminderView = findChildWaiting(root, "setReminderView");
214 var deleteButton = findChild(setReminderView, "deleteButton");
215
216 waitForRendering(setReminderView);
217 mouseClick(deleteButton, 1, 1);
218
219 tryCompare(reminderIcon, "visible", false)
220
221 }
222
223 function test_tag() {
224 var note = createNote("testNote1");
225 var noteDelegate = findChild(mainView, "notesDelegate0");
226
227 dragListItemWithAction(noteDelegate, 2)
228
229 var newTagTextField = findChildWaiting(root, "newTagTextField");
230 mouseClick(newTagTextField, 1, 1);
231
232 typeString("testTag1");
233
234 var createTagButton = findChild(root, "createTagButton");
235 mouseClick(createTagButton, 1, 1);
236
237 var closeButton = findChild(root, "tagsDialogCloseButton");
238 mouseClick(closeButton, 1, 1);
239
240 tryCompareFunction(function() {return findChild(root, "createTagButton") == null}, true);
241
242 var tagsLabel = findChild(noteDelegate, "tagsLabel");
243 tryCompare(tagsLabel, "text", "testTag1")
244
245 dragListItemWithAction(noteDelegate, 2);
246
247
248 var testTagDelegate = findChildWaiting(root, "tagDelegate0");
249 mouseClick(testTagDelegate, 1, 1);
250
251 closeButton = findChild(root, "tagsDialogCloseButton");
252 mouseClick(closeButton, 1, 1);
253
254 tryCompare(tagsLabel, "text", "")
255 }
180 }256 }
181}257}

Subscribers

People subscribed via source and target branches