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

Proposed by Michael Zanetti
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 300
Merge reported by: Nicholas Skaggs
Merged at revision: not available
Proposed branch: lp:~mzanetti/reminders-app/qmltest2
Merge into: lp:reminders-app
Diff against target: 648 lines (+387/-22)
18 files modified
CMakeLists.txt (+3/-3)
debian/control (+13/-1)
src/app/CMakeLists.txt (+0/-1)
src/app/main.cpp (+1/-5)
src/app/qml/Reminders.qml (+0/-2)
src/app/qml/components/SortingDialog.qml (+3/-2)
src/app/qml/ui/EditNoteView.qml (+1/-1)
src/app/qml/ui/NotesPage.qml (+2/-0)
src/libqtevernote/notes.cpp (+18/-6)
src/libqtevernote/notesstore.cpp (+10/-0)
src/libqtevernote/notesstore.h (+2/-0)
src/plugin/CMakeLists.txt (+2/-0)
src/plugin/Evernote/CMakeLists.txt (+1/-1)
src/plugin/Evernote/evernoteplugin.cpp (+5/-0)
tests/CMakeLists.txt (+2/-0)
tests/qml/CMakeLists.txt (+48/-0)
tests/qml/tst_NotebooksDelegate.qml (+95/-0)
tests/qml/tst_NotesPage.qml (+181/-0)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/qmltest2
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Nicholas Skaggs (community) Needs Fixing
Leo Arias (community) Needs Fixing
Review via email: mp+253598@code.launchpad.net

Commit message

Add some qmltests

Description of the change

This uses elopio's branch for qmltests and adds some more.

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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
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
Leo Arias (elopio) wrote :

There is one test failing:

FAIL! : qmltestrunner::notebooksDelegateTestCase::test_createNoteFromBottomEdge() property count

Also, there are many warnings on the test output. It would be great to fix them, or silence the ones that are expected. This branch is already big, so that can be done separately.

173 + print("closing editview")

Is it right to print to console? Shouldn't this go to a log file?

576 + //wait(500)

That commented code can be removed.

581 + wait(500)
582 + //waitForRendering(mainView)

Can we use the waitForRendering instead of the hardcoded sleep?
If not, please remove the commented statement, and add a comment on the sleep so others reading the code understand why it was added.

596 + var x = mainView.width / 2;
[...]
601 + mouseRelease(mainView, x, startY + dY)

It would be nice to wrap this into a function with a nice name.

610 + // clear the textField
611 + mouseClick(titleTextField, titleTextField.width - units.gu(1), titleTextField.height / 2);
612 + compare(titleTextField.text, "");

If this is a normal textfield from the SDK, then clearing has already been tested. I would make the test shorter by just doing titleTextField.text = "".

639 + var x = delegate.width / 2
[...]
646 + mouseClick(delegate, units.gu(3), y)

It's hard to understand what this is doing. Please make a function for it too.

669 + // TODO: Is there a better way to click on toolbar actions?

They have an object name, don't they? That's how we click them in autopilot tests.

I love the three tests in NotesPage. Thank you very much. This looks great for me. I don't fully understand some of the cpp statements, but they look simple enough.

review: Needs Fixing
Revision history for this message
Michael Zanetti (mzanetti) wrote :

Thanks for the review, will fix the issues. It seems there's an issue with Jenkins though :/ Leo, can you help me out there? I found a bug which might be related to this: https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-snapshot/+bug/1389729

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
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :
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
Nicholas Skaggs (nskaggs) wrote :

Text conflict in CMakeLists.txt
Text conflict in src/app/qml/Reminders.qml
Text conflict in src/app/qml/ui/EditNoteView.qml
3 conflicts encountered.
bzr: ERROR: Conflicts from merge

review: Needs Fixing
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
Nicholas Skaggs (nskaggs) wrote :

This needs the vivid overlay ppa added to the job in order to pass. Working on it.

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
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Bah, this should work now, but:

Merging 'lp:reminders-app' in to 'build_dir'.
Text conflict in src/app/qml/components/NoteHeader.qml
Text conflict in src/app/qml/components/SortingDialog.qml

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> Bah, this should work now, but:
>
> Merging 'lp:reminders-app' in to 'build_dir'.
> Text conflict in src/app/qml/components/NoteHeader.qml
> Text conflict in src/app/qml/components/SortingDialog.qml

merged

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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Adding the dependency and rebuilding.

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Approving these :-)

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://91.189.93.70:8080/job/reminders-app-autolanding/469/
Executed test runs:
    FAILURE: http://91.189.93.70:8080/job/reminders-app-vivid-amd64-autolanding/191/console

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

FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
https://core-apps-jenkins.ubuntu.com/job/reminders-app-autolanding/4/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/110/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://91.189.93.70:8080/job/reminders-app-autolanding/470/
Executed test runs:
    FAILURE: http://91.189.93.70:8080/job/reminders-app-vivid-amd64-autolanding/192/console

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

FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
https://core-apps-jenkins.ubuntu.com/job/reminders-app-autolanding/6/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/112/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://91.189.93.70:8080/job/reminders-app-autolanding/471/
Executed test runs:
    FAILURE: http://91.189.93.70:8080/job/reminders-app-vivid-amd64-autolanding/193/console

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

FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
https://core-apps-jenkins.ubuntu.com/job/reminders-app-autolanding/8/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/114/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://91.189.93.70:8080/job/reminders-app-autolanding/472/
Executed test runs:
    FAILURE: http://91.189.93.70:8080/job/reminders-app-vivid-amd64-autolanding/194/console

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

FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
https://core-apps-jenkins.ubuntu.com/job/reminders-app-autolanding/12/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/118/console

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

Stupid old bot stopping the merge . .. grr...

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://91.189.93.70:8080/job/reminders-app-autolanding/473/
Executed test runs:
    FAILURE: http://91.189.93.70:8080/job/reminders-app-vivid-amd64-autolanding/195/console

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

FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
https://core-apps-jenkins.ubuntu.com/job/reminders-app-autolanding/15/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/121/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://91.189.93.70:8080/job/reminders-app-autolanding/474/
Executed test runs:
    FAILURE: http://91.189.93.70:8080/job/reminders-app-vivid-amd64-autolanding/196/console

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

FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
https://core-apps-jenkins.ubuntu.com/job/reminders-app-autolanding/19/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/126/console

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

FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
https://core-apps-jenkins.ubuntu.com/job/reminders-app-autolanding/19/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/127/console
    FAILURE: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/126/console

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

FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
https://core-apps-jenkins.ubuntu.com/job/reminders-app-autolanding/19/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/128/console
    FAILURE: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/127/console
    FAILURE: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/126/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://91.189.93.70:8080/job/reminders-app-autolanding/475/
Executed test runs:
    FAILURE: http://91.189.93.70:8080/job/reminders-app-vivid-amd64-autolanding/197/console

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

FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
https://core-apps-jenkins.ubuntu.com/job/reminders-app-autolanding/21/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/131/console

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

This is merged already...

DEBUG: Merging lp:~mzanetti/reminders-app/qmltest2 to lp:reminders-app
Traceback (most recent call last):
  File "/usr/bin/autoland", line 9, in <module>
    load_entry_point('jenkins-launchpad-plugin==0.1', 'console_scripts', 'autoland')()
  File "/usr/lib/python2.7/dist-packages/jlp/commands/autoland.py", line 262, in autoland
    ret = merge_and_commit(mp, args)
  File "/usr/lib/python2.7/dist-packages/jlp/commands/autoland.py", line 101, in merge_and_commit
    target.merge(source, str(mp.reviewed_revid))
  File "/usr/lib/python2.7/dist-packages/tarmac/branch.py", line 118, in merge
    branch.bzr_branch, to_revision=revid)
  File "<string>", line 4, in merge_from_branch_write_locked
  File "/usr/lib/python2.7/dist-packages/bzrlib/workingtree.py", line 807, in merge_from_branch
    raise errors.PointlessMerge
bzrlib.errors.PointlessMerge: Nothing to merge.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-09-08 18:10:48 +0000
3+++ CMakeLists.txt 2015-11-02 21:42:17 +0000
4@@ -12,6 +12,9 @@
5
6 option(INSTALL_TESTS "Install the tests on make install" on)
7 option(CLICK_MODE "Installs to a contained location" on)
8+option(USE_XVFB "Use XVFB to run qml tests" on)
9+
10+enable_testing()
11
12 set(APP_NAME reminders)
13 set(DESKTOP_FILE "${PROJECT_NAME}.desktop")
14@@ -112,9 +115,6 @@
15 configure_file(${APPLICATION_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_FILE})
16 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_FILE} DESTINATION ${APPLICATION_DIR})
17
18-# Tests
19-enable_testing()
20-
21 add_subdirectory(po)
22 add_subdirectory(tests)
23 add_subdirectory(3rdParty)
24
25=== modified file 'debian/control'
26--- debian/control 2015-03-20 11:16:35 +0000
27+++ debian/control 2015-11-02 21:42:17 +0000
28@@ -10,9 +10,20 @@
29 libssl-dev,
30 pkg-config,
31 python3-all,
32+ qml-module-qttest,
33+ qml-module-qt-labs-settings,
34+ qml-module-ubuntu-connectivity,
35 qt5-default,
36+ qtdeclarative5-accounts-plugin,
37 qtdeclarative5-dev,
38- qtpim5-dev
39+ qtdeclarative5-dev-tools,
40+ qtdeclarative5-online-accounts-client0.1 (>= 0.3+14.10.20140506),
41+ qtdeclarative5-quicklayouts-plugin,
42+ qtdeclarative5-ubuntu-content1,
43+ qtdeclarative5-ubuntu-push-plugin,
44+ qtdeclarative5-ubuntu-ui-toolkit-plugin,
45+ xvfb,
46+ qtpim5-dev,
47 Standards-Version: 3.9.5
48 Section: misc
49 Homepage: https://launchpad.net/reminders-app
50@@ -21,6 +32,7 @@
51 Package: reminders-app
52 Architecture: any
53 Depends: account-plugin-evernote,
54+ liboxideqt-qmlplugin,
55 qml-module-ubuntu-connectivity,
56 qtdeclarative5-accounts-plugin,
57 qtdeclarative5-evernote0.1,
58
59=== modified file 'src/app/CMakeLists.txt'
60--- src/app/CMakeLists.txt 2014-11-10 00:54:16 +0000
61+++ src/app/CMakeLists.txt 2015-11-02 21:42:17 +0000
62@@ -2,7 +2,6 @@
63
64 set(reminders_SRCS
65 main.cpp
66- formattinghelper.cpp
67 preferences.cpp
68 ${QML_SRCS}
69 )
70
71=== modified file 'src/app/main.cpp'
72--- src/app/main.cpp 2015-03-08 18:52:46 +0000
73+++ src/app/main.cpp 2015-11-02 21:42:17 +0000
74@@ -21,7 +21,6 @@
75 */
76
77 #include "preferences.h"
78-#include "formattinghelper.h"
79
80 #include <QtGui/QGuiApplication>
81 #include <QtQuick/QQuickView>
82@@ -156,11 +155,8 @@
83 Preferences preferences;
84 view.engine()->rootContext()->setContextProperty("preferences", &preferences);
85
86- // Register FormattingHelper
87- qmlRegisterType<FormattingHelper>("reminders", 1, 0, "FormattingHelper");
88-
89 QString qmlfile;
90- const QString filePath = QLatin1String("qml/reminders.qml");
91+ const QString filePath = QLatin1String("qml/Reminders.qml");
92 QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DataLocation);
93 paths.prepend(QDir::currentPath());
94 paths.prepend(QCoreApplication::applicationDirPath());
95
96=== renamed file 'src/app/qml/reminders.qml' => 'src/app/qml/Reminders.qml'
97--- src/app/qml/reminders.qml 2015-09-15 14:50:55 +0000
98+++ src/app/qml/Reminders.qml 2015-11-02 21:42:17 +0000
99@@ -190,8 +190,6 @@
100 if (pagestack.depth > 1) {
101 pagestack.pop();
102 }
103- var page = pagestack.push(Qt.resolvedUrl("ui/EditNotePage.qml"), {note: note});
104- page.exitEditMode.connect(function() {Qt.inputMethod.hide(); pagestack.pop()});
105 } else {
106 sideViewLoader.clear();
107 var view = sideViewLoader.embed(Qt.resolvedUrl("ui/EditNoteView.qml"))
108
109=== modified file 'src/app/qml/components/SortingDialog.qml'
110--- src/app/qml/components/SortingDialog.qml 2015-09-15 14:50:55 +0000
111+++ src/app/qml/components/SortingDialog.qml 2015-11-02 21:42:17 +0000
112@@ -33,7 +33,9 @@
113 i18n.tr("Title (ascending)"),
114 i18n.tr("Title (descending)")
115 ]
116-
117+ delegate: OptionSelectorDelegate {
118+ objectName: "sortingOption" + index
119+ }
120 onDelegateClicked: {
121 root.sortOrder = index
122 root.accepted();
123@@ -43,4 +45,3 @@
124 }
125 }
126 }
127-
128
129=== modified file 'src/app/qml/ui/EditNoteView.qml'
130--- src/app/qml/ui/EditNoteView.qml 2015-09-15 14:50:55 +0000
131+++ src/app/qml/ui/EditNoteView.qml 2015-11-02 21:42:17 +0000
132@@ -24,7 +24,6 @@
133 import Ubuntu.Content 0.1
134 import Ubuntu.Components.Themes.Ambiance 1.3
135 import Evernote 0.1
136-import reminders 1.0
137 import "../components"
138
139 Item {
140@@ -170,6 +169,7 @@
141
142 TextArea {
143 id: noteTextArea
144+ objectName: "noteTextArea"
145 width: flick.width
146 // height: Math.max(flick.height - header.height, paintedHeight + units.gu(2))
147 autoSize: true
148
149=== modified file 'src/app/qml/ui/NotesPage.qml'
150--- src/app/qml/ui/NotesPage.qml 2015-09-15 14:50:55 +0000
151+++ src/app/qml/ui/NotesPage.qml 2015-11-02 21:42:17 +0000
152@@ -27,6 +27,7 @@
153
154 PageWithBottomEdge {
155 id: root
156+ objectName: "notesPage"
157
158 property var selectedNote: null
159 property bool readOnly: false
160@@ -158,6 +159,7 @@
161 }
162
163 delegate: NotesDelegate {
164+ objectName: "notesDelegate" + index
165 title: model.title
166 date: notes.sortOrder == Notes.SortOrderUpdatedOldest || notes.sortOrder == Notes.SortOrderUpdatedNewest ?
167 model.updated : model.created
168
169=== modified file 'src/libqtevernote/notes.cpp'
170--- src/libqtevernote/notes.cpp 2015-03-15 20:00:21 +0000
171+++ src/libqtevernote/notes.cpp 2015-11-02 21:42:17 +0000
172@@ -229,12 +229,24 @@
173
174 bool Notes::lessThan(const QModelIndex &left, const QModelIndex &right) const
175 {
176- QVariant leftValue = sourceModel()->data(left, sortRole()).toString();
177- QVariant rightValue = sourceModel()->data(right, sortRole()).toString();
178+ QVariant leftValue = sourceModel()->data(left, sortRole());
179+ QVariant rightValue = sourceModel()->data(right, sortRole());
180
181- if (leftValue == rightValue) {
182- return sourceModel()->data(left, NotesStore::RoleTitle).toString() < sourceModel()->data(right, NotesStore::RoleTitle).toString();
183+ switch (m_sortOrder) {
184+ case SortOrderDateCreatedNewest:
185+ case SortOrderDateCreatedOldest:
186+ case SortOrderDateUpdatedNewest:
187+ case SortOrderDateUpdatedOldest:
188+ if (leftValue.toDateTime().toMSecsSinceEpoch() < rightValue.toDateTime().toMSecsSinceEpoch()) {
189+ return true;
190+ } else if (leftValue.toDateTime().toMSecsSinceEpoch() > rightValue.toDateTime().toMSecsSinceEpoch()) {
191+ return false;
192+ }
193+ break;
194+ case SortOrderTitleAscending:
195+ case SortOrderTitleDescending:
196+ // fall trough
197+ break;
198 }
199-
200- return leftValue < rightValue;
201+ return leftValue.toString() < rightValue.toString();
202 }
203
204=== modified file 'src/libqtevernote/notesstore.cpp'
205--- src/libqtevernote/notesstore.cpp 2015-07-05 19:25:39 +0000
206+++ src/libqtevernote/notesstore.cpp 2015-11-02 21:42:17 +0000
207@@ -258,6 +258,11 @@
208 return m_notes;
209 }
210
211+Note *NotesStore::note(int index) const
212+{
213+ return m_notes.at(index);
214+}
215+
216 Note *NotesStore::note(const QString &guid)
217 {
218 return m_notesHash.value(guid);
219@@ -268,6 +273,11 @@
220 return m_notebooks;
221 }
222
223+Notebook *NotesStore::notebook(int index) const
224+{
225+ return m_notebooks.at(index);
226+}
227+
228 Notebook *NotesStore::notebook(const QString &guid)
229 {
230 return m_notebooksHash.value(guid);
231
232=== modified file 'src/libqtevernote/notesstore.h'
233--- src/libqtevernote/notesstore.h 2015-06-21 16:28:58 +0000
234+++ src/libqtevernote/notesstore.h 2015-11-02 21:42:17 +0000
235@@ -119,6 +119,7 @@
236 QHash<int, QByteArray> roleNames() const;
237
238 QList<Note*> notes() const;
239+ Q_INVOKABLE Note* note(int index) const;
240
241 Q_INVOKABLE Note* note(const QString &guid);
242 Q_INVOKABLE Note* createNote(const QString &title, const QString &notebookGuid = QString(), const QString &richTextContent = QString());
243@@ -129,6 +130,7 @@
244 Q_INVOKABLE void clearSearchResults();
245
246 QList<Notebook*> notebooks() const;
247+ Q_INVOKABLE Notebook* notebook(int index) const;
248 Q_INVOKABLE Notebook* notebook(const QString &guid);
249 Q_INVOKABLE void createNotebook(const QString &name);
250 Q_INVOKABLE void saveNotebook(const QString &guid);
251
252=== modified file 'src/plugin/CMakeLists.txt'
253--- src/plugin/CMakeLists.txt 2014-10-23 21:27:46 +0000
254+++ src/plugin/CMakeLists.txt 2015-11-02 21:42:17 +0000
255@@ -1,1 +1,3 @@
256+project(plugin)
257+
258 add_subdirectory(Evernote)
259
260=== modified file 'src/plugin/Evernote/CMakeLists.txt'
261--- src/plugin/Evernote/CMakeLists.txt 2014-10-23 21:27:46 +0000
262+++ src/plugin/Evernote/CMakeLists.txt 2015-11-02 21:42:17 +0000
263@@ -9,6 +9,7 @@
264
265 set(evernoteplugin_SRCS
266 evernoteplugin.cpp
267+ formattinghelper.cpp
268 )
269
270 add_library(evernoteplugin MODULE
271@@ -30,4 +31,3 @@
272 # Install plugin file
273 install(TARGETS evernoteplugin DESTINATION ${QT_IMPORTS_DIR}/Evernote/)
274 install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/Evernote/)
275-
276
277=== modified file 'src/plugin/Evernote/evernoteplugin.cpp'
278--- src/plugin/Evernote/evernoteplugin.cpp 2015-03-06 00:42:42 +0000
279+++ src/plugin/Evernote/evernoteplugin.cpp 2015-11-02 21:42:17 +0000
280@@ -19,6 +19,7 @@
281 */
282
283 #include "evernoteplugin.h"
284+#include "formattinghelper.h"
285
286 #include "evernoteconnection.h"
287 #include "userstore.h"
288@@ -62,6 +63,10 @@
289 qmlRegisterUncreatableType<Notebook>(uri, 0, 1, "Notebook", "Cannot create Notes in QML. Use NotesStore.createNotebook() instead.");
290 qmlRegisterUncreatableType<Tag>(uri, 0, 1, "Tag", "Cannot create Tags in QML. Use NotesStore.createTag() instead.");
291 qmlRegisterUncreatableType<Resource>(uri, 0, 1, "Resource", "Cannot create Resources. Use Note.attachFile() instead.");
292+
293+ // Register FormattingHelper
294+ qmlRegisterType<FormattingHelper>(uri, 0, 1, "FormattingHelper");
295+
296 }
297
298 void EvernotePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
299
300=== renamed file 'src/app/formattinghelper.cpp' => 'src/plugin/Evernote/formattinghelper.cpp'
301=== renamed file 'src/app/formattinghelper.h' => 'src/plugin/Evernote/formattinghelper.h'
302=== modified file 'tests/CMakeLists.txt'
303--- tests/CMakeLists.txt 2014-01-19 13:59:12 +0000
304+++ tests/CMakeLists.txt 2015-11-02 21:42:17 +0000
305@@ -1,1 +1,3 @@
306+add_subdirectory(qml)
307+
308 add_subdirectory(autopilot)
309
310=== added directory 'tests/qml'
311=== added file 'tests/qml/CMakeLists.txt'
312--- tests/qml/CMakeLists.txt 1970-01-01 00:00:00 +0000
313+++ tests/qml/CMakeLists.txt 2015-11-02 21:42:17 +0000
314@@ -0,0 +1,48 @@
315+find_program(QMLTESTRUNNER_BIN
316+ NAMES qmltestrunner
317+ PATHS /usr/lib/*/qt5/bin
318+ NO_DEFAULT_PATH
319+)
320+
321+find_program(XVFB_RUN_BIN
322+ NAMES xvfb-run
323+)
324+
325+set(QML_TST_FILES "")
326+
327+macro(DECLARE_QML_TEST TST_NAME TST_QML_FILE)
328+ set(qmltest_command
329+ ${QMLTESTRUNNER_BIN} -import ${CMAKE_BINARY_DIR}/src/plugin -input ${CMAKE_CURRENT_SOURCE_DIR}/${TST_QML_FILE}
330+ )
331+
332+ if(USE_XVFB)
333+ set(COMMAND_PREFIX ${XVFB_RUN_BIN} -a -s "-screen 0 1024x768x24")
334+ add_custom_target(xvfbTest${TST_NAME} ${COMMAND_PREFIX} ${qmltest_command})
335+ else()
336+ set(COMMAND_PREFIX "")
337+ endif()
338+ add_custom_target(test${TST_NAME} ${qmltest_command})
339+
340+ add_test(NAME ${TST_NAME}
341+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
342+ COMMAND ${COMMAND_PREFIX} ${qmltest_command}
343+ )
344+
345+ set(QML_TST_FILES ${QML_TST_FILES} ${TST_QML_FILE})
346+endmacro()
347+
348+if(QMLTESTRUNNER_BIN AND XVFB_RUN_BIN)
349+
350+ # Add new tests here
351+ declare_qml_test("NotebooksDelegate" tst_NotebooksDelegate.qml)
352+ declare_qml_test("NotesPage" tst_NotesPage.qml)
353+
354+else()
355+ if (NOT QMLTESTRUNNER_BIN)
356+ message(WARNING "Qml tests disabled: qmltestrunner not found")
357+ else()
358+ message(WARNING "Qml tests disabled: xvfb-run not found")
359+ endif()
360+endif()
361+
362+add_custom_target(tst_QmlFiles ALL SOURCES ${QML_TST_FILES})
363
364=== added file 'tests/qml/tst_NotebooksDelegate.qml'
365--- tests/qml/tst_NotebooksDelegate.qml 1970-01-01 00:00:00 +0000
366+++ tests/qml/tst_NotebooksDelegate.qml 2015-11-02 21:42:17 +0000
367@@ -0,0 +1,95 @@
368+/*
369+ * Copyright: 2014 Canonical, Ltd
370+ *
371+ * This file is part of reminders
372+ *
373+ * reminders is free software: you can redistribute it and/or modify
374+ * it under the terms of the GNU General Public License as published by
375+ * the Free Software Foundation; version 3.
376+ *
377+ * reminders is distributed in the hope that it will be useful,
378+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
379+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
380+ * GNU General Public License for more details.
381+ *
382+ * You should have received a copy of the GNU General Public License
383+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
384+ */
385+
386+import QtQuick 2.2
387+import QtTest 1.0
388+import Ubuntu.Components 1.1
389+import Ubuntu.Test 0.1
390+
391+import '../../src/app/qml/components'
392+
393+Item {
394+ id: root
395+
396+ width: units.gu(40)
397+ height: units.gu(60)
398+
399+ ListModel {
400+ id: notebooks
401+
402+ ListElement {
403+ objectName: 'privateNote'
404+ guid: 'dummy'
405+ name: 'dummy'
406+ lastUpdatedString: 'dummy'
407+ published: false
408+ noteCount: 'dummy'
409+ }
410+
411+ ListElement {
412+ objectName: 'sharedNote'
413+ guid: 'dummy'
414+ name: 'dummy'
415+ lastUpdatedString: 'dummy'
416+ published: true
417+ noteCount: 'dummy'
418+ }
419+ }
420+
421+ ListView {
422+ id: notebooksListView
423+ anchors.fill: parent
424+
425+ model: notebooks
426+
427+ delegate: NotebooksDelegate {
428+ objectName: model.objectName
429+ }
430+ }
431+
432+ UbuntuTestCase {
433+ id: notebooksDelegateTestCase
434+ name: 'notebooksDelegateTestCase'
435+
436+ when: windowShown
437+
438+ function init() {
439+ }
440+
441+ function test_unpublishedNotebookMustDisplayPrivateLabel() {
442+ var privateNote = findChild(notebooksListView, 'privateNote')
443+ var publishedLabel = findChild(
444+ privateNote, 'notebookPublishedLabel')
445+
446+ compare(publishedLabel.text, 'Private')
447+ compare(publishedLabel.color, '#b3b3b3')
448+ compare(publishedLabel.font.bold, false)
449+ }
450+
451+ function test_publishedNotebookMustDisplaySharedLabel() {
452+ var privateNote = findChild(notebooksListView, 'sharedNote')
453+ var publishedLabel = findChild(
454+ privateNote, 'notebookPublishedLabel')
455+
456+ compare(publishedLabel.text, 'Shared')
457+ compare(publishedLabel.color, '#000000')
458+ compare(publishedLabel.font.bold, true)
459+ }
460+ }
461+
462+}
463
464=== added file 'tests/qml/tst_NotesPage.qml'
465--- tests/qml/tst_NotesPage.qml 1970-01-01 00:00:00 +0000
466+++ tests/qml/tst_NotesPage.qml 2015-11-02 21:42:17 +0000
467@@ -0,0 +1,181 @@
468+/*
469+ * Copyright: 2014 Canonical, Ltd
470+ *
471+ * This file is part of reminders
472+ *
473+ * reminders is free software: you can redistribute it and/or modify
474+ * it under the terms of the GNU General Public License as published by
475+ * the Free Software Foundation; version 3.
476+ *
477+ * reminders is distributed in the hope that it will be useful,
478+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
479+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
480+ * GNU General Public License for more details.
481+ *
482+ * You should have received a copy of the GNU General Public License
483+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
484+ */
485+
486+import QtQuick 2.2
487+import QtTest 1.0
488+import Ubuntu.Components 1.1
489+import Ubuntu.Test 0.1
490+import Evernote 0.1
491+
492+import '../../src/app/qml/components'
493+import '../../src/app/qml/'
494+
495+Item {
496+ id: root
497+
498+ width: units.gu(40)
499+ height: units.gu(60)
500+
501+ QtObject {
502+ id: preferences
503+
504+ property string accountName: "@local"
505+ property int sortOrder: 0
506+
507+ function colorForNotebook(notebookguid) {
508+ return "black";
509+ }
510+ }
511+
512+ Reminders {
513+ id: mainView
514+ anchors.fill: parent
515+
516+ applicationName: "com.ubuntu.reminders_test"
517+
518+ property bool useSandbox: false
519+ property bool tablet: false
520+ property bool phone: true
521+ }
522+
523+ UbuntuTestCase {
524+ id: notebooksDelegateTestCase
525+ name: 'notebooksDelegateTestCase'
526+ when: windowShown
527+
528+ function init() {
529+ tryCompare(NotesStore, "username", "@local")
530+ while (NotesStore.count > 0) {
531+ NotesStore.deleteNote(NotesStore.note(0).guid)
532+ }
533+ }
534+
535+ function cleanupTestCase() {
536+ while (NotesStore.count > 0) {
537+ NotesStore.deleteNote(NotesStore.note(0).guid)
538+ }
539+ //wait(500)
540+ waitForRendering(mainView)
541+ }
542+
543+ function initTestCase() {
544+ wait(500)
545+ //waitForRendering(mainView)
546+ }
547+
548+ function createNote(title) {
549+ var note = NotesStore.createNote(title);
550+ waitForRendering(mainView);
551+ var saveButton = findChild(mainView, "saveButton");
552+ mouseClick(saveButton, 1, 1);
553+ waitForRendering(mainView);
554+ return note;
555+ }
556+
557+ function test_createNoteFromBottomEdge() {
558+
559+ var x = mainView.width / 2;
560+ var startY = mainView.height - 1;
561+ var dY = -mainView.height * 3 / 4;
562+ mousePress(mainView, x, startY)
563+ mouseMoveSlowly(mainView, x, startY, 0, dY, 10, 10)
564+ mouseRelease(mainView, x, startY + dY)
565+
566+ tryCompare(NotesStore, "count", 1);
567+ waitForRendering(mainView);
568+
569+ var noteTextArea = findChild(mainView, "noteTextArea");
570+ var titleTextField = findChild(mainView, "titleTextField");
571+
572+ mouseClick(titleTextField, 1, 1);
573+ // clear the textField
574+ mouseClick(titleTextField, titleTextField.width - units.gu(1), titleTextField.height / 2);
575+ compare(titleTextField.text, "");
576+
577+ typeString("testnote1");
578+
579+ mouseClick(noteTextArea, 1, 1)
580+
581+ typeString("This is a note for testing");
582+
583+ var saveButton = findChild(mainView, "saveButton");
584+ mouseClick(saveButton, 1, 1);
585+
586+ // Wait for bottom edge to close
587+ var notesPage = findChild(mainView, "notesPage")
588+ tryCompare(notesPage, "bottomEdgeContentShown", false);
589+ waitForRendering(mainView)
590+
591+ var newNote = NotesStore.note(0);
592+ compare(newNote.title, "testnote1");
593+ compare(newNote.plaintextContent, "This is a note for testing");
594+ }
595+
596+ function test_deleteNoteFromListItemAction() {
597+ createNote("testNote1")
598+ waitForRendering(mainView);
599+
600+ var delegate = findChild(mainView, "notesDelegate0");
601+
602+ var x = delegate.width / 2
603+ var y = delegate.height / 2
604+ var dx = delegate.width / 2
605+ mousePress(delegate, 1, 1)
606+ mouseMoveSlowly(delegate, x, y, dx, 0, 10, 20)
607+ mouseRelease(delegate, x + dx, y)
608+ waitForRendering(mainView)
609+ mouseClick(delegate, units.gu(3), y)
610+ tryCompare(NotesStore, "count", 0);
611+ }
612+
613+ function test_sorting_data() {
614+ return [
615+ { tag: "Date created (newest first)", sortingOption: 0, sortOrder: [3, 2, 1] },
616+ { tag: "Date created (oldest first)", sortingOption: 1, sortOrder: [1, 2, 3] },
617+ { tag: "Date updated (newest first)", sortingOption: 2, sortOrder: [2, 3, 1] },
618+ { tag: "Date updated (oldest first)", sortingOption: 3, sortOrder: [1, 3, 2] },
619+ { tag: "Title (ascending)", sortingOption: 4, sortOrder: [1, 2, 3] },
620+ { tag: "Title (descending)", sortingOption: 5, sortOrder: [3, 2, 1] }
621+ ];
622+ }
623+
624+ function test_sorting(data) {
625+ var note1 = createNote("testNote1");
626+ var note2 = createNote("testNote2");
627+ var note3 = createNote("testNote3");
628+
629+ note2.reminder = true;
630+ NotesStore.saveNote(note2.guid);
631+
632+ // TODO: Is there a better way to click on toolbar actions?
633+ mouseClick(mainView, mainView.width - units.gu(10), units.gu(4))
634+
635+ waitForRendering(mainView);
636+
637+ var sortOption = findChild(root, "sortingOption" + data.sortingOption);
638+ mouseClick(sortOption, 1, 1);
639+
640+ waitForRendering(root);
641+
642+ for (var i = 0; i < data.sortOrder.length; i++) {
643+ var delegate = findChild(mainView, "notesDelegate" + i);
644+ compare(delegate.title, "testNote" + data.sortOrder[i]);
645+ }
646+ }
647+ }
648+}

Subscribers

People subscribed via source and target branches