Merge lp:~tiagosh/messaging-app/rtm-14.09-fix-1382623 into lp:messaging-app/rtm-14.09

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Bill Filler
Approved revision: 198
Merged at revision: 198
Proposed branch: lp:~tiagosh/messaging-app/rtm-14.09-fix-1382623
Merge into: lp:messaging-app/rtm-14.09
Diff against target: 187 lines (+48/-13)
6 files modified
src/messagingapplication.cpp (+11/-1)
src/qml/Messages.qml (+1/-0)
src/qml/messaging-app.qml (+2/-1)
tests/autopilot/messaging_app/emulators.py (+7/-2)
tests/autopilot/messaging_app/tests/__init__.py (+12/-9)
tests/autopilot/messaging_app/tests/test_messaging.py (+15/-0)
To merge this branch: bzr merge lp:~tiagosh/messaging-app/rtm-14.09-fix-1382623
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Needs Fixing
Review via email: mp+244819@code.launchpad.net

Commit message

Read text property from url-dispatcher.

Description of the change

Read text property from url-dispatcher.

To post a comment you must log in.
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

155 + parameter,
and
161 + parameter,

This extra parameter breaks autopilot test running on krillin:
TypeError: launch_upstart_application() takes from 2 to 3 positional arguments but 4 were given

review: Needs Fixing
197. By Tiago Salem Herrmann

launch_upstart_application() does not take more than one argument.

198. By Tiago Salem Herrmann

remove --test-contacts

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/messagingapplication.cpp'
2--- src/messagingapplication.cpp 2014-07-01 18:08:32 +0000
3+++ src/messagingapplication.cpp 2014-12-18 16:57:17 +0000
4@@ -20,6 +20,7 @@
5
6 #include <QDir>
7 #include <QUrl>
8+#include <QUrlQuery>
9 #include <QDebug>
10 #include <QStringList>
11 #include <QQuickItem>
12@@ -36,6 +37,7 @@
13 #include <QVersitReader>
14
15 using namespace QtVersit;
16+#define Pair QPair<QString,QString>
17
18 static void printUsage(const QStringList& arguments)
19 {
20@@ -184,10 +186,18 @@
21 return;
22 }
23
24+ QString text;
25 QUrl url(arg);
26 QString scheme = url.scheme();
27 // Remove the first "/"
28 QString value = url.path().right(url.path().length() -1);
29+ QUrlQuery query(url);
30+ Q_FOREACH(const Pair &item, query.queryItems()) {
31+ if (item.first == "text") {
32+ text = item.second;
33+ break;
34+ }
35+ }
36
37 QQuickItem *mainView = m_view->rootObject();
38 if (!mainView) {
39@@ -196,7 +206,7 @@
40
41 if (scheme == "message") {
42 if (!value.isEmpty()) {
43- QMetaObject::invokeMethod(mainView, "startChat", Q_ARG(QVariant, value));
44+ QMetaObject::invokeMethod(mainView, "startChat", Q_ARG(QVariant, value), Q_ARG(QVariant, text));
45 } else {
46 QMetaObject::invokeMethod(mainView, "startNewMessage");
47 }
48
49=== modified file 'src/qml/Messages.qml'
50--- src/qml/Messages.qml 2014-10-07 16:57:27 +0000
51+++ src/qml/Messages.qml 2014-12-18 16:57:17 +0000
52@@ -796,6 +796,7 @@
53
54 TextArea {
55 id: messageTextArea
56+ objectName: "messageTextArea"
57 anchors {
58 top: attachments.count == 0 ? textEntry.top : attachmentThumbnails.bottom
59 left: parent.left
60
61=== modified file 'src/qml/messaging-app.qml'
62--- src/qml/messaging-app.qml 2014-09-17 15:35:10 +0000
63+++ src/qml/messaging-app.qml 2014-12-18 16:57:17 +0000
64@@ -136,10 +136,11 @@
65 mainStack.currentPage.showBottomEdgePage(Qt.resolvedUrl("Messages.qml"))
66 }
67
68- function startChat(phoneNumber) {
69+ function startChat(phoneNumber, text) {
70 var properties = {}
71 var participants = [phoneNumber]
72 properties["participants"] = participants
73+ properties["text"] = text
74 emptyStack()
75 if (phoneNumber === "") {
76 return;
77
78=== modified file 'tests/autopilot/messaging_app/emulators.py'
79--- tests/autopilot/messaging_app/emulators.py 2014-09-10 18:14:43 +0000
80+++ tests/autopilot/messaging_app/emulators.py 2014-12-18 16:57:17 +0000
81@@ -117,8 +117,9 @@
82 def get_newmessage_textarea(self):
83 """Return TextArea with blank objectName"""
84
85- return self.get_messages_page().select_single('TextArea',
86- objectName='')
87+ return self.get_messages_page().select_single(
88+ 'TextArea',
89+ objectName='messageTextArea')
90
91 def get_send_button(self):
92 """Return Button with text Send"""
93@@ -481,6 +482,10 @@
94 messages.append((date, text))
95 return messages
96
97+ def get_text_area_text(self):
98+ return self.wait_select_single(
99+ 'TextArea', objectName='messageTextArea').text
100+
101
102 class ListItemWithActions(_common.UbuntuUIToolkitCustomProxyObjectBase):
103
104
105=== modified file 'tests/autopilot/messaging_app/tests/__init__.py'
106--- tests/autopilot/messaging_app/tests/__init__.py 2014-07-15 16:32:16 +0000
107+++ tests/autopilot/messaging_app/tests/__init__.py 2014-12-18 16:57:17 +0000
108@@ -37,7 +37,10 @@
109
110 # Don't use keyboard on desktop
111 if model() == 'Desktop':
112- subprocess.call(['/sbin/initctl', 'stop', 'maliit-server'])
113+ try:
114+ subprocess.call(['/sbin/initctl', 'stop', 'maliit-server'])
115+ except:
116+ pass
117
118 if model() == 'Desktop':
119 scenarios = [
120@@ -50,36 +53,36 @@
121
122 local_location = '../../src/messaging-app'
123
124- def setUp(self):
125+ def setUp(self, parameter=""):
126 self.pointing_device = Pointer(self.input_device_class.create())
127 super(MessagingAppTestCase, self).setUp()
128
129 subprocess.call(['pkill', 'messaging-app'])
130
131 if os.path.exists(self.local_location):
132- self.launch_test_local()
133+ self.launch_test_local(parameter)
134 else:
135- self.launch_test_installed()
136+ self.launch_test_installed(parameter)
137
138 self.assertThat(self.main_view.visible, Eventually(Equals(True)))
139
140- def launch_test_local(self):
141+ def launch_test_local(self, parameter):
142 self.app = self.launch_test_application(
143 self.local_location,
144- '--test-contacts',
145+ parameter,
146 app_type='qt',
147 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
148
149- def launch_test_installed(self):
150+ def launch_test_installed(self, parameter):
151 if model() == 'Desktop':
152 self.app = self.launch_test_application(
153 'messaging-app',
154- '--test-contacts',
155+ parameter,
156 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
157 else:
158 self.app = self.launch_upstart_application(
159 'messaging-app',
160- '--test-contacts',
161+ parameter,
162 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
163
164 @property
165
166=== modified file 'tests/autopilot/messaging_app/tests/test_messaging.py'
167--- tests/autopilot/messaging_app/tests/test_messaging.py 2014-09-19 21:50:28 +0000
168+++ tests/autopilot/messaging_app/tests/test_messaging.py 2014-12-18 16:57:17 +0000
169@@ -342,3 +342,18 @@
170 _, remaining_message_text = remaining_messages[0]
171 self.assertEqual(
172 remaining_message_text, self.messages[0])
173+
174+
175+class MessagingTestCaseWithArgument(MessagingAppTestCase):
176+
177+ def setUp(self):
178+ test_setup = fixture_setup.MessagingTestEnvironment()
179+ self.useFixture(test_setup)
180+
181+ super(MessagingTestCaseWithArgument, self).setUp(
182+ parameter="message:///5555559876?text=text%20message")
183+
184+ def test_launch_app_with_predefined_text(self):
185+ self.messages_view = self.main_view.select_single(
186+ emulators.Messages,
187+ text='text message')

Subscribers

People subscribed via source and target branches