Merge lp:~canonical-platform-qa/reminders-app/qmltest1 into lp:reminders-app

Proposed by Leo Arias
Status: Rejected
Rejected by: Michael Zanetti
Proposed branch: lp:~canonical-platform-qa/reminders-app/qmltest1
Merge into: lp:reminders-app
Diff against target: 212 lines (+145/-5)
7 files modified
CMakeLists.txt (+3/-3)
debian/control (+6/-1)
src/plugin/CMakeLists.txt (+2/-0)
src/plugin/Evernote/CMakeLists.txt (+0/-1)
tests/CMakeLists.txt (+2/-0)
tests/qml/CMakeLists.txt (+36/-0)
tests/qml/tst_notebooksDelegate.qml (+96/-0)
To merge this branch: bzr merge lp:~canonical-platform-qa/reminders-app/qmltest1
Reviewer Review Type Date Requested Status
David Planella Needs Information
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Review via email: mp+239466@code.launchpad.net

Commit message

Added an initial QML test.

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
Leo Arias (elopio) wrote :

There's something wrong on the build. Working on that...

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
David Planella (dpm) wrote :

Leo, would you mind adding to the description of the MP:
- What this test is supposed to be testing
- What the recommended way to add QML tests is, so that we can have some guidelines for future tests

Thanks!

review: Needs Information
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

Leo, you might consider adding a README file which explains to new contributors on how to run these qml tests. You can use clock app's readme at https://bazaar.launchpad.net/~ubuntu-clock-dev/ubuntu-clock-app/utopic-3.0/view/head:/README.unittest as reference if required.

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

one inline comment. looks good to me otherwise.

Revision history for this message
Leo Arias (elopio) wrote :

ACK. Back to work in progress. I'll try to assign some time for this next week. Thanks for the reviews.

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

Elopio, I took this and did some fixes and more tests on top of it. Mainly I wanted to set up an environment to test the full app in offline mode with qmltests. Seems to work quite nicely. If you have time, it'd be great to get a review.

https://code.launchpad.net/~mzanetti/reminders-app/qmltest2/+merge/253598

As the other branch contains this one, I'll remove this one from the queue.

Thanks

Revision history for this message
Leo Arias (elopio) wrote :

you rule.
I'll review it tomorrow. Thanks!

Unmerged revisions

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 2014-10-02 16:28:04 +0000
3+++ CMakeLists.txt 2014-10-28 22:49:19 +0000
4@@ -11,6 +11,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@@ -105,9 +108,6 @@
15
16 configure_file(${APPLICATION_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_FILE})
17 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_FILE} DESTINATION ${APPLICATION_DIR})
18-
19-# Tests
20-enable_testing()
21
22 add_subdirectory(po)
23 add_subdirectory(tests)
24
25=== modified file 'debian/control'
26--- debian/control 2014-10-02 16:28:04 +0000
27+++ debian/control 2014-10-28 22:49:19 +0000
28@@ -9,8 +9,13 @@
29 libboost-dev,
30 libssl-dev,
31 python3-all,
32+ qml-module-qttest,
33 qt5-default,
34- qtdeclarative5-dev
35+ qtdeclarative5-dev,
36+ qtdeclarative5-dev-tools,
37+ qtdeclarative5-quicklayouts-plugin,
38+ qtdeclarative5-ubuntu-ui-toolkit-plugin,
39+ xvfb,
40 Standards-Version: 3.9.5
41 Section: misc
42 Homepage: https://launchpad.net/reminders-app
43
44=== modified file 'src/plugin/CMakeLists.txt'
45--- src/plugin/CMakeLists.txt 2013-12-18 00:30:17 +0000
46+++ src/plugin/CMakeLists.txt 2014-10-28 22:49:19 +0000
47@@ -1,3 +1,5 @@
48+project(plugin)
49+
50 include(FindPkgConfig)
51 find_package(Qt5Core)
52 find_package(Qt5Qml)
53
54=== modified file 'src/plugin/Evernote/CMakeLists.txt'
55--- src/plugin/Evernote/CMakeLists.txt 2014-10-09 00:08:52 +0000
56+++ src/plugin/Evernote/CMakeLists.txt 2014-10-28 22:49:19 +0000
57@@ -59,4 +59,3 @@
58 # Install plugin file
59 install(TARGETS evernoteplugin DESTINATION ${QT_IMPORTS_DIR}/Evernote/)
60 install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/Evernote/)
61-
62
63=== modified file 'tests/CMakeLists.txt'
64--- tests/CMakeLists.txt 2014-01-19 13:59:12 +0000
65+++ tests/CMakeLists.txt 2014-10-28 22:49:19 +0000
66@@ -1,1 +1,3 @@
67+add_subdirectory(qml)
68+
69 add_subdirectory(autopilot)
70
71=== added directory 'tests/qml'
72=== added file 'tests/qml/CMakeLists.txt'
73--- tests/qml/CMakeLists.txt 1970-01-01 00:00:00 +0000
74+++ tests/qml/CMakeLists.txt 2014-10-28 22:49:19 +0000
75@@ -0,0 +1,36 @@
76+find_program(QMLTESTRUNNER_BIN
77+ NAMES qmltestrunner
78+ PATHS /usr/lib/*/qt5/bin
79+ NO_DEFAULT_PATH
80+)
81+
82+find_program(XVFB_RUN_BIN
83+ NAMES xvfb-run
84+)
85+
86+macro(DECLARE_QML_TEST TST_NAME TST_QML_FILE)
87+ if(USE_XVFB)
88+ set(COMMAND_PREFIX ${XVFB_RUN_BIN} -a -s "-screen 0 1024x768x24")
89+ else()
90+ set(COMMAND_PREFIX "")
91+ endif()
92+ add_test(NAME ${TST_NAME}
93+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
94+ COMMAND ${COMMAND_PREFIX} ${QMLTESTRUNNER_BIN} -import ${CMAKE_BINARY_DIR}/src/plugin -input ${CMAKE_CURRENT_SOURCE_DIR}/${TST_QML_FILE}
95+ )
96+endmacro()
97+
98+if(QMLTESTRUNNER_BIN AND XVFB_RUN_BIN)
99+ declare_qml_test("NotebooksDelegate" tst_notebooksDelegate.qml)
100+else()
101+ if (NOT QMLTESTRUNNER_BIN)
102+ message(WARNING "Qml tests disabled: qmltestrunner not found")
103+ else()
104+ message(WARNING "Qml tests disabled: xvfb-run not found")
105+ endif()
106+endif()
107+
108+set(QML_TST_FILES
109+ tst_notebooksDelegate.qml
110+)
111+add_custom_target(tst_QmlFiles ALL SOURCES ${QML_TST_FILES})
112
113=== added file 'tests/qml/tst_notebooksDelegate.qml'
114--- tests/qml/tst_notebooksDelegate.qml 1970-01-01 00:00:00 +0000
115+++ tests/qml/tst_notebooksDelegate.qml 2014-10-28 22:49:19 +0000
116@@ -0,0 +1,96 @@
117+/*
118+ * Copyright: 2014 Canonical, Ltd
119+ *
120+ * This file is part of reminders
121+ *
122+ * reminders is free software: you can redistribute it and/or modify
123+ * it under the terms of the GNU General Public License as published by
124+ * the Free Software Foundation; version 3.
125+ *
126+ * reminders is distributed in the hope that it will be useful,
127+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
128+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
129+ * GNU General Public License for more details.
130+ *
131+ * You should have received a copy of the GNU General Public License
132+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
133+ */
134+
135+import QtQuick 2.2
136+import QtTest 1.0
137+import Ubuntu.Components 1.1
138+import Ubuntu.Test 0.1
139+
140+import '../../src/app/qml/components'
141+
142+Item {
143+ id: root
144+
145+ width: units.gu(40)
146+ height: units.gu(60)
147+
148+ ListModel {
149+ id: notebooks
150+
151+ ListElement {
152+ objectName: 'privateNote'
153+ guid: 'dummy'
154+ name: 'dummy'
155+ lastUpdatedString: 'dummy'
156+ published: false
157+ noteCount: 'dummy'
158+ }
159+
160+ ListElement {
161+ objectName: 'sharedNote'
162+ guid: 'dummy'
163+ name: 'dummy'
164+ lastUpdatedString: 'dummy'
165+ published: true
166+ noteCount: 'dummy'
167+ }
168+ }
169+
170+ ListView {
171+ id: notebooksListView
172+ anchors.fill: parent
173+
174+ model: notebooks
175+
176+ delegate: NotebooksDelegate {
177+ objectName: model.objectName
178+ }
179+ }
180+
181+ UbuntuTestCase {
182+ id: notebooksDelegateTestCase
183+ name: 'notebooksDelegateTestCase'
184+
185+ when: windowShown
186+
187+ function init() {
188+ waitForRendering(notebooksListView)
189+ }
190+
191+ function test_unpublishedNotebookMustDisplayPrivateLabel() {
192+ var privateNote = findChild(notebooksListView, 'privateNote')
193+ var publishedLabel = findChild(
194+ privateNote, 'notebookPublishedLabel')
195+
196+ compare(publishedLabel.text, 'Private')
197+ compare(publishedLabel.color, '#b3b3b3')
198+ compare(publishedLabel.font.bold, false)
199+ }
200+
201+ function test_publishedNotebookMustDisplaySharedLabel() {
202+ var privateNote = findChild(notebooksListView, 'sharedNote')
203+ var publishedLabel = findChild(
204+ privateNote, 'notebookPublishedLabel')
205+
206+ compare(publishedLabel.text, 'Shared')
207+ compare(publishedLabel.color, '#000000')
208+ compare(publishedLabel.font.bold, true)
209+ }
210+ }
211+
212+}

Subscribers

People subscribed via source and target branches