Merge lp:~canonical-platform-qa/gallery-app/qmltests1 into lp:gallery-app

Proposed by Leo Arias
Status: Approved
Approved by: Arthur Mello
Approved revision: 1069
Proposed branch: lp:~canonical-platform-qa/gallery-app/qmltests1
Merge into: lp:gallery-app
Diff against target: 205 lines (+121/-1)
8 files modified
CMakeLists.txt (+1/-0)
debian/control (+4/-0)
debian/rules (+0/-1)
rc/CMakeLists.txt (+2/-0)
rc/qml/Components/EventCard.qml (+2/-0)
tests/CMakeLists.txt (+1/-0)
tests/qml/CMakeLists.txt (+36/-0)
tests/qml/Components/tst_EventCard.qml (+75/-0)
To merge this branch: bzr merge lp:~canonical-platform-qa/gallery-app/qmltests1
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Arthur Mello (community) Approve
Chris Gagnon (community) Approve
Sebastien Bacher the debian directory Approve
Review via email: mp+235390@code.launchpad.net

Commit message

Added the initial QML test suite.

Description of the change

Are there any related MPs required for this MP to build/function as expected? Please list.

No related MPs.

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)

It is now.

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?

No manual tests as I didn't change any functionality. But I ran the new suite many times in many different ways.

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/<package-name>) on device or emulator?

No manual tests needed.

If you changed the UI, was the change specified/approved by design?

No UI changes.

If you changed UI labels, did you update the pot file?

No labels changes.

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?

Yes, it was reviewed by seb.

To post a comment you must log in.
1063. By Leo Arias

Added deps.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1064. By Leo Arias

Override the dh_auto_test

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1065. By Leo Arias

Merged with trunk.

1066. By Leo Arias

Removed the auto_test oerride.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1067. By Leo Arias

Added the missing dependency.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1068. By Leo Arias

Removed the minimal platform.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

the packaging changes looks correct

review: Approve (the debian directory)
Revision history for this message
Sebastien Bacher (seb128) wrote :

(can you remove ubuntu-core-dev from the reviewer so it stops being in the Ubuntu sponsoring queue?)

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

Yes. Thanks Sebastien.

Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

The tests lgtm

review: Approve
Revision history for this message
Arthur Mello (artmello) wrote :

lgtm

review: Approve
1069. By Leo Arias

Merged with trunk.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1070. By Leo Arias

Merged with trunk.

Unmerged revisions

1070. By Leo Arias

Merged with trunk.

1069. By Leo Arias

Merged with trunk.

1068. By Leo Arias

Removed the minimal platform.

1067. By Leo Arias

Added the missing dependency.

1066. By Leo Arias

Removed the auto_test oerride.

1065. By Leo Arias

Merged with trunk.

1064. By Leo Arias

Override the dh_auto_test

1063. By Leo Arias

Added deps.

1062. By Leo Arias

Merged with trunk.

1061. By Leo Arias

Added the initial QML test suite.

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-09-17 17:38:03 +0000
3+++ CMakeLists.txt 2014-10-10 16:43:41 +0000
4@@ -53,6 +53,7 @@
5
6 option(INSTALL_TESTS "Install the tests on make install" off)
7 option(CLICK_MODE "Installs to a contained location" on)
8+option(USE_XVFB "Use XVFB to run qml tests" on)
9
10 set(GALLERY gallery-app)
11 set(DESKTOP_FILE ${GALLERY}.desktop)
12
13=== modified file 'debian/control'
14--- debian/control 2014-07-26 03:12:53 +0000
15+++ debian/control 2014-10-10 16:43:41 +0000
16@@ -12,12 +12,16 @@
17 libgles2-mesa-dev,
18 libmediainfo-dev,
19 libqt5opengl5-dev,
20+ qml-module-qttest,
21 qt5-default,
22 qtbase5-dev,
23 qtdeclarative5-dev,
24+ qtdeclarative5-dev-tools,
25+ qtdeclarative5-ubuntu-ui-toolkit-plugin,
26 python3-all,
27 # for static linking of exiv2 in click mode
28 libexpat1-dev,
29+ xvfb,
30 zlib1g-dev,
31 Standards-Version: 3.9.5
32 # If you don't have commit rights to lp:gallery-app but need to upload
33
34=== modified file 'debian/rules'
35--- debian/rules 2014-09-09 08:14:03 +0000
36+++ debian/rules 2014-10-10 16:43:41 +0000
37@@ -1,7 +1,6 @@
38 #!/usr/bin/make -f
39
40 export DPKG_GENSYMBOLS_CHECK_LEVEL = 4
41-export QT_QPA_PLATFORM = minimal
42
43 %:
44 dh $@ --parallel --with translations
45
46=== modified file 'rc/CMakeLists.txt'
47--- rc/CMakeLists.txt 2013-10-07 09:48:17 +0000
48+++ rc/CMakeLists.txt 2014-10-10 16:43:41 +0000
49@@ -1,3 +1,5 @@
50+project(rc)
51+
52 if(CLICK_MODE)
53 set(GALLERY_RC_DIR rc)
54 else(CLICK_MODE)
55
56=== modified file 'rc/qml/Components/EventCard.qml'
57--- rc/qml/Components/EventCard.qml 2013-09-03 21:06:17 +0000
58+++ rc/qml/Components/EventCard.qml 2014-10-10 16:43:41 +0000
59@@ -45,6 +45,7 @@
60
61 Label {
62 id: eventMonthYear
63+ objectName: "eventMonthYear"
64
65 y: units.gu(1.5)
66 width: parent.width
67@@ -60,6 +61,7 @@
68
69 Label {
70 id: eventDay
71+ objectName: "eventDay"
72
73 anchors.top: eventMonthYear.bottom
74 width: parent.width
75
76=== modified file 'tests/CMakeLists.txt'
77--- tests/CMakeLists.txt 2013-04-15 12:05:00 +0000
78+++ tests/CMakeLists.txt 2014-10-10 16:43:41 +0000
79@@ -1,2 +1,3 @@
80 add_subdirectory(autopilot)
81+add_subdirectory(qml)
82 add_subdirectory(unittests)
83
84=== added directory 'tests/qml'
85=== added file 'tests/qml/CMakeLists.txt'
86--- tests/qml/CMakeLists.txt 1970-01-01 00:00:00 +0000
87+++ tests/qml/CMakeLists.txt 2014-10-10 16:43:41 +0000
88@@ -0,0 +1,36 @@
89+find_program(QMLTESTRUNNER_BIN
90+ NAMES qmltestrunner
91+ PATHS /usr/lib/*/qt5/bin
92+ NO_DEFAULT_PATH
93+)
94+
95+find_program(XVFB_RUN_BIN
96+ NAMES xvfb-run
97+)
98+
99+macro(DECLARE_QML_TEST TST_NAME TST_QML_FILE)
100+ if(USE_XVFB)
101+ set(COMMAND_PREFIX ${XVFB_RUN_BIN} -a -s "-screen 0 1024x768x24")
102+ else()
103+ set(COMMAND_PREFIX "")
104+ endif()
105+ add_test(NAME ${TST_NAME}
106+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
107+ COMMAND ${COMMAND_PREFIX} ${QMLTESTRUNNER_BIN} -import ${rc_BINARY_DIR} -input ${CMAKE_CURRENT_SOURCE_DIR}/${TST_QML_FILE}
108+ )
109+endmacro()
110+
111+if(QMLTESTRUNNER_BIN AND XVFB_RUN_BIN)
112+ declare_qml_test("EventCard" Components/tst_EventCard.qml)
113+else()
114+ if (NOT QMLTESTRUNNER_BIN)
115+ message(WARNING "Qml tests disabled: qmltestrunner not found")
116+ else()
117+ message(WARNING "Qml tests disabled: xvfb-run not found")
118+ endif()
119+endif()
120+
121+set(QML_TST_FILES
122+ Components/tst_EventCard.qml
123+)
124+add_custom_target(tst_QmlFiles ALL SOURCES ${QML_TST_FILES})
125
126=== added directory 'tests/qml/Components'
127=== added file 'tests/qml/Components/tst_EventCard.qml'
128--- tests/qml/Components/tst_EventCard.qml 1970-01-01 00:00:00 +0000
129+++ tests/qml/Components/tst_EventCard.qml 2014-10-10 16:43:41 +0000
130@@ -0,0 +1,75 @@
131+/*
132+ * Copyright (C) 2014 Canonical Ltd
133+ *
134+ * This program is free software: you can redistribute it and/or modify
135+ * it under the terms of the GNU General Public License version 3 as
136+ * published by the Free Software Foundation.
137+ *
138+ * This program is distributed in the hope that it will be useful,
139+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
140+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
141+ * GNU General Public License for more details.
142+ *
143+ * You should have received a copy of the GNU General Public License
144+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
145+ */
146+
147+import QtQuick 2.2
148+import QtTest 1.0
149+import Ubuntu.Components 0.1
150+import Ubuntu.Test 0.1
151+
152+import '../../../rc/qml/Components'
153+
154+Item {
155+ id: root
156+
157+ width: units.gu(40)
158+ height: units.gu(60)
159+
160+ EventCard {
161+ id: eventCardWithoutEvent
162+
163+ height: parent.height / 2
164+ }
165+
166+ EventCard {
167+ id: eventCardWithEvent
168+
169+ height: parent.height / 2
170+ anchors.top: eventCardWithoutEvent.bottom
171+
172+ event: {'date': new Date(2014, 08, 20)}
173+ }
174+
175+ UbuntuTestCase {
176+ id: eventCardTestCase
177+ name: 'eventCardTestCase'
178+
179+ when: windowShown
180+
181+ function init() {
182+ waitForRendering(eventCardWithoutEvent);
183+ waitForRendering(eventCardWithEvent);
184+ }
185+
186+ function test_eventCardLabelsWithoutEventMustBeEmpty() {
187+ var eventMonthYear = findChild(
188+ eventCardWithoutEvent, 'eventMonthYear');
189+ compare(eventMonthYear.text, '');
190+ var eventDay = findChild(eventCardWithoutEvent, 'eventDay');
191+ compare(eventDay.text, '');
192+ }
193+
194+ function test_eventCardLabelsWithEventMustDisplayDate() {
195+ var eventMonthYear = findChild(
196+ eventCardWithEvent, 'eventMonthYear');
197+ compare(eventMonthYear.text, 'Sep 2014');
198+ var eventDay = findChild(eventCardWithEvent, 'eventDay');
199+ compare(eventDay.text, '20');
200+
201+ }
202+
203+ }
204+
205+}

Subscribers

People subscribed via source and target branches