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

Proposed by Leo Arias
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 162
Merged at revision: 169
Proposed branch: lp:~canonical-platform-qa/messaging-app/qmltests1
Merge into: lp:messaging-app
Diff against target: 185 lines (+144/-0)
5 files modified
debian/control (+4/-0)
src/qml/CMakeLists.txt (+2/-0)
tests/CMakeLists.txt (+2/-0)
tests/qml/CMakeLists.txt (+31/-0)
tests/qml/tst_MessageBubble.qml (+105/-0)
To merge this branch: bzr merge lp:~canonical-platform-qa/messaging-app/qmltests1
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Approve
Chris Gagnon (community) Approve
Ubuntu Core Development Team Pending
Review via email: mp+227661@code.launchpad.net

Commit message

Added a suite of simple QML tests.

Description of the change

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

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

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
More or less. I ran the new tests many times, in many 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?
Not changing any functionality, so no need to run the manual tests.

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

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

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

I confirmed that the test runs at build time.

LGTM

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

The error is not related to this branch and will be fixed in Iftikhar's branch.

160. By Leo Arias

Merged with trunk.

161. By Leo Arias

Remove the arqs.

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

why is that in the ubuntu sponsoring queue? that doesn't seem to be an Ubuntu targetted upload

162. By Leo Arias

Merged with trunk.

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

Sebastien, I added the core-devs as reviewers because that's part of the policy when we change the debian packaging. I'm not sure if that's what you are asking though.

Revision history for this message
Michał Karnicki (karni) wrote :

I changed the test to cause an expected failure (compare evaluates to false).
From tests/qml I ran:
$ cmake . && make
I see:
"Built target tst_QmlFiles" and no failures.

Revision history for this message
Michał Karnicki (karni) wrote :

From the root of the project, ran:
cmake .
make
make test

http://paste.ubuntu.com/7886872/

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Leo Arias (elopio) wrote :

karni was missing some dependencies. We confirmed that the tests fail if we change the expected result, and he could get them passing too.

bzr bd it's an easy way to confirm you have the dependencies and run the tests.

The only problem we have left is that it seems that the tests are slow. I'm not sure if that's the expected runtime of qmltests, or we can improve it somehow.

Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

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

Did CI run pass? If not, please explain why.
Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes

Code looks good and works as expected!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-07-08 13:30:42 +0000
3+++ debian/control 2014-07-28 17:05:10 +0000
4@@ -8,10 +8,14 @@
5 python-flake8,
6 pkg-config,
7 python3,
8+ qml-module-qttest,
9 qt5-default,
10 qtbase5-dev (>= 5.0),
11 qtdeclarative5-dev (>= 5.0),
12+ qtdeclarative5-dev-tools,
13+ qtdeclarative5-ubuntu-ui-toolkit-plugin,
14 qtpim5-dev,
15+ xvfb,
16 Standards-Version: 3.9.4
17 Homepage: https://launchpad.net/messaging-app
18 # If you aren't a member of ~phablet-team but need to upload packaging changes,
19
20=== modified file 'src/qml/CMakeLists.txt'
21--- src/qml/CMakeLists.txt 2014-05-05 16:56:56 +0000
22+++ src/qml/CMakeLists.txt 2014-07-28 17:05:10 +0000
23@@ -1,3 +1,5 @@
24+project(qml)
25+
26 file(GLOB QML_JS_FILES *.qml *.js)
27
28 set(QML_DIRS
29
30=== modified file 'tests/CMakeLists.txt'
31--- tests/CMakeLists.txt 2014-07-10 17:59:04 +0000
32+++ tests/CMakeLists.txt 2014-07-28 17:05:10 +0000
33@@ -1,3 +1,5 @@
34+add_subdirectory(qml)
35+
36 set(AUTOPILOT_DIR autopilot/messaging_app)
37
38 execute_process(COMMAND python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
39
40=== added directory 'tests/qml'
41=== added file 'tests/qml/CMakeLists.txt'
42--- tests/qml/CMakeLists.txt 1970-01-01 00:00:00 +0000
43+++ tests/qml/CMakeLists.txt 2014-07-28 17:05:10 +0000
44@@ -0,0 +1,31 @@
45+find_program(QMLTESTRUNNER_BIN
46+ NAMES qmltestrunner
47+ PATHS /usr/lib/*/qt5/bin
48+ NO_DEFAULT_PATH
49+)
50+
51+find_program(XVFB_RUN_BIN
52+ NAMES xvfb-run
53+)
54+
55+macro(DECLARE_QML_TEST TST_NAME TST_QML_FILE)
56+ add_test(NAME ${TST_NAME}
57+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
58+ COMMAND ${XVFB_RUN_BIN} -a -s "-screen 0 1024x768x24" ${QMLTESTRUNNER_BIN} -import ${qml_BINARY_DIR} -input ${CMAKE_CURRENT_SOURCE_DIR}/${TST_QML_FILE}
59+ )
60+endmacro()
61+
62+if(QMLTESTRUNNER_BIN AND XVFB_RUN_BIN)
63+ declare_qml_test("message_bubble" tst_MessageBubble.qml)
64+else()
65+ if (NOT QMLTESTRUNNER_BIN)
66+ message(WARNING "Qml tests disabled: qmltestrunner not found")
67+ else()
68+ message(WARNING "Qml tests disabled: xvfb-run not found")
69+ endif()
70+endif()
71+
72+set(QML_TST_FILES
73+ tst_MessageBubble.qml
74+)
75+add_custom_target(tst_QmlFiles ALL SOURCES ${QML_TST_FILES})
76
77=== added file 'tests/qml/tst_MessageBubble.qml'
78--- tests/qml/tst_MessageBubble.qml 1970-01-01 00:00:00 +0000
79+++ tests/qml/tst_MessageBubble.qml 2014-07-28 17:05:10 +0000
80@@ -0,0 +1,105 @@
81+/*
82+ * Copyright 2014 Canonical Ltd.
83+ *
84+ * This file is part of messaging-app.
85+ *
86+ * messaging-app is free software; you can redistribute it and/or modify
87+ * it under the terms of the GNU General Public License as published by
88+ * the Free Software Foundation; version 3.
89+ *
90+ * messaging-app is distributed in the hope that it will be useful,
91+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
92+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
93+ * GNU General Public License for more details.
94+ *
95+ * You should have received a copy of the GNU General Public License
96+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
97+ */
98+
99+import QtQuick 2.2
100+import QtTest 1.0
101+import Ubuntu.Test 0.1
102+
103+import '../../src/qml/'
104+
105+Item {
106+ id: root
107+
108+ width: units.gu(40)
109+ height: units.gu(40)
110+
111+ MessageBubble {
112+ id: incomingMessageBubble
113+ objectName: 'incomingMessageBubble'
114+
115+ height: parent.height / 3
116+
117+ incoming: true
118+ }
119+
120+ MessageBubble {
121+ id: outgoingMessageBubble
122+ objectName: 'outgoingMessageBubble'
123+
124+ anchors.top: incomingMessageBubble.bottom
125+ height: parent.height / 3
126+
127+ incoming: false
128+ }
129+
130+ MessageBubble {
131+ id: changeIncomingMessageBubble
132+ objectName: 'changeIncomingMessageBubble'
133+
134+ anchors.top: outgoingMessageBubble.bottom
135+ height: parent.height / 3
136+
137+ incoming: true
138+ }
139+
140+ UbuntuTestCase {
141+ id: messageBubbleTestCase
142+ name: 'messageBubbleTestCase'
143+
144+ when: windowShown
145+
146+ function init() {
147+ waitForRendering(incomingMessageBubble);
148+ waitForRendering(outgoingMessageBubble);
149+ waitForRendering(changeIncomingMessageBubble);
150+ }
151+
152+ function cleanup() {
153+ changeIncomingMessageBubble.incoming = true;
154+ }
155+
156+ function getFileName(filePath) {
157+ return String(filePath).split('/').reverse()[0];
158+ }
159+
160+ function test_incomingMessageBubbleMustUseIncomingSource() {
161+ var incomingMessageBubble = findChild(
162+ root, 'incomingMessageBubble');
163+ compare(
164+ getFileName(incomingMessageBubble.source),
165+ 'conversation_incoming.sci');
166+ }
167+
168+ function test_outgoingMessageBubbleMustUseOutgoingSource() {
169+ var outgoingMessageBubble = findChild(
170+ root, 'outgoingMessageBubble');
171+ compare(
172+ getFileName(outgoingMessageBubble.source),
173+ 'conversation_outgoing.sci');
174+ }
175+
176+ function test_changeIncomingMustUpdateSource() {
177+ var changeIncomingMessageBubble = findChild(
178+ root, 'changeIncomingMessageBubble');
179+ changeIncomingMessageBubble.incoming = false;
180+ compare(
181+ getFileName(changeIncomingMessageBubble.source),
182+ 'conversation_outgoing.sci');
183+ }
184+ }
185+}

Subscribers

People subscribed via source and target branches