Merge lp:~ken-vandine/content-hub/serialized_content_transfers into lp:content-hub

Proposed by Ken VanDine on 2015-04-13
Status: Merged
Approved by: Michael Sheldon on 2015-04-22
Approved revision: 205
Merged at revision: 200
Proposed branch: lp:~ken-vandine/content-hub/serialized_content_transfers
Merge into: lp:content-hub
Diff against target: 565 lines (+189/-28)
21 files modified
examples/exporter/exampleexporter.cpp (+5/-1)
examples/importer/exampleimporter.cpp (+6/-3)
examples/importer/importer.cpp (+1/-0)
import/Ubuntu/Content/contentitem.cpp (+20/-0)
import/Ubuntu/Content/contentitem.h (+5/-0)
import/Ubuntu/Content/contenttype.cpp (+6/-0)
import/Ubuntu/Content/contenttype.h (+2/-1)
include/com/ubuntu/content/item.h (+11/-1)
include/com/ubuntu/content/type.h (+1/-0)
src/com/ubuntu/content/detail/transfer.cpp (+12/-9)
src/com/ubuntu/content/item.cpp (+56/-6)
src/com/ubuntu/content/service/com.ubuntu.content.hub.gschema.xml (+12/-0)
src/com/ubuntu/content/service/hook.cpp (+1/-1)
src/com/ubuntu/content/type.cpp (+6/-0)
tests/acceptance-tests/app_hub_communication_transfer.cpp (+4/-2)
tests/peers/exporter/autoexporter.cpp (+6/-0)
tests/peers/importer/autoimporter.cpp (+6/-0)
tests/peers/importer/content-hub-test-importer.json (+2/-1)
tests/peers/sharer/autosharer.cpp (+6/-0)
tests/peers/sharer/content-hub-test-sharer.json (+2/-1)
tests/qml-tests/tst_ContentHub.qml (+19/-2)
To merge this branch: bzr merge lp:~ken-vandine/content-hub/serialized_content_transfers
Reviewer Review Type Date Requested Status
Michael Sheldon (community) 2015-04-13 Approve on 2015-04-22
PS Jenkins bot continuous-integration Approve on 2015-04-21
Review via email: mp+256035@code.launchpad.net

Commit Message

Added ContentType.Text as a well known type
Added ContentItem.text property for serialized content

Description of the Change

Added ContentType.Text as a well known type
Added ContentItem.text property for serialized content

This can be tested the following 2 clicks installed:
 * http://people.canonical.com/~kenvandine/hub-text-exporter.ken-vandine_0.1_all.click
 * http://people.canonical.com/~kenvandine/com.ubuntu.telegram_1.3.3.303_armhf.click

1. Launch the hub-text-exporter app, enter some text and click "Share with..."
2. Select "Telegram" from the peer picker
3. Choose a chat to insert the text in

Expected results: You should see the text entered posted to the chat.

To post a comment you must log in.
201. By Ken VanDine on 2015-04-14

Added more debug output to the test peers

202. By Ken VanDine on 2015-04-21

Don't force streamType to x-url when the url is set, this lets a link shared include text as well.

203. By Ken VanDine on 2015-04-21

ensure the ContentItem.text property gets set when copying/linking files

204. By Ken VanDine on 2015-04-21

Don't create a new Item to for the copied file, just change the url.

Ken VanDine (ken-vandine) wrote :

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

 * No

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?

 * Yes

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

 * Yes

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

 * No change

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

 * No change

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

 * No change

205. By Ken VanDine on 2015-04-21

merged trunk

Michael Sheldon (michael-sheldon) 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

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/exporter/exampleexporter.cpp'
2--- examples/exporter/exampleexporter.cpp 2014-03-07 19:28:54 +0000
3+++ examples/exporter/exampleexporter.cpp 2015-04-21 18:26:55 +0000
4@@ -46,7 +46,11 @@
5
6 QVector<cuc::Item> items;
7 items << cuc::Item(QUrl("file:///tmp/test1"));
8- items << cuc::Item(QUrl("file:///tmp/test2"));
9+ auto i = cuc::Item();
10+ i.setName("Test2");
11+ i.setText("Test Two");
12+ items << i;
13+
14 transfer->charge(items);
15 qDebug() << Q_FUNC_INFO << "Items:" << items.count();
16 }
17
18=== modified file 'examples/importer/exampleimporter.cpp'
19--- examples/importer/exampleimporter.cpp 2014-02-13 22:59:20 +0000
20+++ examples/importer/exampleimporter.cpp 2015-04-21 18:26:55 +0000
21@@ -25,14 +25,17 @@
22 hub->register_import_export_handler(this);
23 }
24
25-
26 void ExampleImporter::handle_import(cuc::Transfer *transfer)
27 {
28 qDebug() << Q_FUNC_INFO;
29 auto items = transfer->collect();
30 qDebug() << Q_FUNC_INFO << "Items:" << items.count();
31- Q_FOREACH(cuc::Item item, items)
32- qDebug() << Q_FUNC_INFO << "Item:" << item.url();
33+ Q_FOREACH(cuc::Item item, items) {
34+ qDebug() << Q_FUNC_INFO << "URL:" << item.url();
35+ qDebug() << Q_FUNC_INFO << "Name:" << item.name();
36+ qDebug() << Q_FUNC_INFO << "Text:" << item.text();
37+ qDebug() << Q_FUNC_INFO << "StreamType:" << item.streamType();
38+ }
39 transfer->finalize();
40 }
41
42
43=== modified file 'examples/importer/importer.cpp'
44--- examples/importer/importer.cpp 2014-02-13 22:59:20 +0000
45+++ examples/importer/importer.cpp 2015-04-21 18:26:55 +0000
46@@ -41,6 +41,7 @@
47 auto peer = cuc::Peer{peerName};
48 qDebug() << Q_FUNC_INFO << "PEER: " << peer.id();
49 auto transfer = hub->create_import_from_peer(peer);
50+ transfer->setSelectionType(cuc::Transfer::SelectionType::multiple);
51 transfer->start();
52 }
53
54
55=== modified file 'import/Ubuntu/Content/contentitem.cpp'
56--- import/Ubuntu/Content/contentitem.cpp 2014-10-07 16:52:48 +0000
57+++ import/Ubuntu/Content/contentitem.cpp 2015-04-21 18:26:55 +0000
58@@ -84,6 +84,26 @@
59 }
60
61 /*!
62+ * \qmlproperty string ContentItem::text
63+ * Content of the transfer
64+ */
65+QString ContentItem::text()
66+{
67+ TRACE() << Q_FUNC_INFO;
68+ return QString(m_item.text());
69+}
70+
71+void ContentItem::setText(const QString &text)
72+{
73+ TRACE() << Q_FUNC_INFO;
74+ if (text == QString(m_item.text()))
75+ return;
76+
77+ m_item.setText(text);
78+ Q_EMIT textChanged();
79+}
80+
81+/*!
82 * \brief ContentItem::item
83 * \internal
84 */
85
86=== modified file 'import/Ubuntu/Content/contentitem.h'
87--- import/Ubuntu/Content/contentitem.h 2014-07-14 12:32:27 +0000
88+++ import/Ubuntu/Content/contentitem.h 2015-04-21 18:26:55 +0000
89@@ -28,6 +28,7 @@
90 Q_OBJECT
91 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
92 Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
93+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
94
95 public:
96 ContentItem(QObject *parent = nullptr);
97@@ -38,6 +39,9 @@
98 const QUrl &url() const;
99 void setUrl(const QUrl &url);
100
101+ QString text();
102+ void setText(const QString &text);
103+
104 const com::ubuntu::content::Item &item() const;
105 void setItem(const com::ubuntu::content::Item &item);
106
107@@ -48,6 +52,7 @@
108 Q_SIGNALS:
109 void nameChanged();
110 void urlChanged();
111+ void textChanged();
112
113 private:
114 com::ubuntu::content::Item m_item;
115
116=== modified file 'import/Ubuntu/Content/contenttype.cpp'
117--- import/Ubuntu/Content/contenttype.cpp 2014-11-03 20:41:08 +0000
118+++ import/Ubuntu/Content/contenttype.cpp 2015-04-21 18:26:55 +0000
119@@ -55,6 +55,9 @@
120 \li ContentType.EBooks
121 \li EBooks
122 \row
123+ \li ContentType.Text
124+ \li Text
125+ \row
126 \li ContentType.All
127 \li Any of the above content types
128 \endtable
129@@ -97,6 +100,7 @@
130 case Videos: return cuc::Type::Known::videos();
131 case Links: return cuc::Type::Known::links();
132 case EBooks: return cuc::Type::Known::ebooks();
133+ case Text: return cuc::Type::Known::text();
134 default: return cuc::Type::unknown();
135 }
136 }
137@@ -122,6 +126,8 @@
138 return Links;
139 else if (type == cuc::Type::Known::ebooks().id())
140 return EBooks;
141+ else if (type == cuc::Type::Known::text().id())
142+ return Text;
143 else
144 return Unknown;
145 }
146
147=== modified file 'import/Ubuntu/Content/contenttype.h'
148--- import/Ubuntu/Content/contenttype.h 2014-11-03 20:41:08 +0000
149+++ import/Ubuntu/Content/contenttype.h 2015-04-21 18:26:55 +0000
150@@ -37,7 +37,8 @@
151 Contacts = 4,
152 Videos = 5,
153 Links = 6,
154- EBooks = 7
155+ EBooks = 7,
156+ Text = 8
157 };
158
159 ContentType(QObject *parent = nullptr);
160
161=== modified file 'include/com/ubuntu/content/item.h'
162--- include/com/ubuntu/content/item.h 2014-07-14 12:31:47 +0000
163+++ include/com/ubuntu/content/item.h 2015-04-21 18:26:55 +0000
164@@ -33,8 +33,11 @@
165 class Item : public QObject
166 {
167 Q_OBJECT
168- Q_PROPERTY(QUrl url READ url())
169+ Q_PROPERTY(QUrl url READ url() WRITE setUrl)
170 Q_PROPERTY(QString name READ name WRITE setName)
171+ Q_PROPERTY(QString text READ text WRITE setText)
172+ Q_PROPERTY(QByteArray stream READ stream WRITE setStream)
173+ Q_PROPERTY(QString streamType READ streamType WRITE setStreamType)
174
175 public:
176 Item(const QUrl& = QUrl(), QObject* = nullptr);
177@@ -45,8 +48,15 @@
178 bool operator==(const Item&) const;
179
180 Q_INVOKABLE const QUrl& url() const;
181+ Q_INVOKABLE void setUrl(const QUrl &url) const;
182 Q_INVOKABLE const QString& name() const;
183 Q_INVOKABLE void setName(const QString &name) const;
184+ Q_INVOKABLE const QString text() const;
185+ Q_INVOKABLE void setText(const QString &text) const;
186+ Q_INVOKABLE const QByteArray& stream() const;
187+ Q_INVOKABLE void setStream(const QByteArray &stream) const;
188+ Q_INVOKABLE const QString& streamType() const;
189+ Q_INVOKABLE void setStreamType(const QString &type) const;
190
191 private:
192 struct Private;
193
194=== modified file 'include/com/ubuntu/content/type.h'
195--- include/com/ubuntu/content/type.h 2014-11-03 20:41:08 +0000
196+++ include/com/ubuntu/content/type.h 2015-04-21 18:26:55 +0000
197@@ -49,6 +49,7 @@
198 static const Type& videos();
199 static const Type& links();
200 static const Type& ebooks();
201+ static const Type& text();
202 };
203
204 virtual ~Type();
205
206=== modified file 'src/com/ubuntu/content/detail/transfer.cpp'
207--- src/com/ubuntu/content/detail/transfer.cpp 2015-03-18 16:03:36 +0000
208+++ src/com/ubuntu/content/detail/transfer.cpp 2015-04-21 18:26:55 +0000
209@@ -168,16 +168,19 @@
210
211 QVariantList ret;
212 Q_FOREACH(QVariant iv, items) {
213- cuc::Item origItem = qdbus_cast<Item>(iv);
214- QString newItem = copy_to_store(origItem.url().toString(), d->store);
215- if (!newItem.isEmpty()) {
216- cuc::Item copiedItem = cuc::Item{QUrl(newItem)};
217- copiedItem.setName(origItem.name());
218- TRACE() << Q_FUNC_INFO << "Item:" << copiedItem.url();
219- ret.append(QVariant::fromValue(copiedItem));
220+ cuc::Item item = qdbus_cast<Item>(iv);
221+ if (item.url().isEmpty()) {
222+ ret.append(QVariant::fromValue(item));
223 } else {
224- ret.clear();
225- break;
226+ QString newUrl = copy_to_store(item.url().toString(), d->store);
227+ if (!newUrl.isEmpty()) {
228+ item.setUrl(QUrl(newUrl));
229+ TRACE() << Q_FUNC_INFO << "Item:" << item.url();
230+ ret.append(QVariant::fromValue(item));
231+ } else {
232+ ret.clear();
233+ break;
234+ }
235 }
236 }
237
238
239=== modified file 'src/com/ubuntu/content/item.cpp'
240--- src/com/ubuntu/content/item.cpp 2014-07-15 11:28:00 +0000
241+++ src/com/ubuntu/content/item.cpp 2015-04-21 18:26:55 +0000
242@@ -27,14 +27,16 @@
243 {
244 QUrl url;
245 QString name;
246+ QByteArray stream;
247+ QString streamType;
248
249 bool operator==(const Private& rhs) const
250 {
251- return url == rhs.url && name == rhs.name;
252+ return url == rhs.url && name == rhs.name && stream == rhs.stream && streamType == rhs.streamType;
253 }
254 };
255
256-cuc::Item::Item(const QUrl& url, QObject* parent) : QObject(parent), d{new cuc::Item::Private{url, QString()}}
257+cuc::Item::Item(const QUrl& url, QObject* parent) : QObject(parent), d{new cuc::Item::Private{url, QString(), QByteArray(), QString()}}
258 {
259 }
260
261@@ -65,6 +67,14 @@
262 return d->url;
263 }
264
265+void cuc::Item::setUrl(const QUrl& newUrl) const
266+{
267+ if (newUrl == d->url)
268+ return;
269+
270+ d->url = newUrl;
271+}
272+
273 const QString& cuc::Item::name() const
274 {
275 return d->name;
276@@ -76,10 +86,48 @@
277 d->name = newName;
278 }
279
280+const QString cuc::Item::text() const
281+{
282+ if (d->streamType == "plain/text")
283+ return QString(d->stream);
284+ return QString();
285+}
286+
287+void cuc::Item::setText(const QString& text) const
288+{
289+ if (text == QString(d->stream))
290+ return;
291+
292+ setStream(QByteArray::fromStdString(text.toStdString()));
293+ d->streamType = QString("plain/text");
294+}
295+
296+const QByteArray& cuc::Item::stream() const
297+{
298+ return d->stream;
299+}
300+
301+void cuc::Item::setStream(const QByteArray& newStream) const
302+{
303+ if (newStream != d->stream)
304+ d->stream = newStream;
305+}
306+
307+const QString& cuc::Item::streamType() const
308+{
309+ return d->streamType;
310+}
311+
312+void cuc::Item::setStreamType(const QString& newStreamType) const
313+{
314+ if (newStreamType != d->streamType)
315+ d->streamType = newStreamType;
316+}
317+
318 QDBusArgument &operator<<(QDBusArgument &argument, const cuc::Item& item)
319 {
320 argument.beginStructure();
321- argument << item.name() << item.url().toDisplayString();
322+ argument << item.streamType() << item.stream() << item.name() << item.url().toDisplayString();
323 argument.endStructure();
324 return argument;
325 }
326@@ -89,14 +137,16 @@
327 TRACE() << Q_FUNC_INFO;
328 QString name;
329 QString urlString;
330-
331+ QByteArray stream;
332+ QString streamType;
333
334 argument.beginStructure();
335- argument >> name >> urlString;
336+ argument >> streamType >> stream >> name >> urlString;
337 argument.endStructure();
338
339 item = cuc::Item{QUrl(urlString)};
340 item.setName(name);
341+ item.setStream(stream);
342+ item.setStreamType(streamType);
343 return argument;
344 }
345-
346
347=== modified file 'src/com/ubuntu/content/service/com.ubuntu.content.hub.gschema.xml'
348--- src/com/ubuntu/content/service/com.ubuntu.content.hub.gschema.xml 2014-11-03 20:41:08 +0000
349+++ src/com/ubuntu/content/service/com.ubuntu.content.hub.gschema.xml 2015-04-21 18:26:55 +0000
350@@ -22,6 +22,9 @@
351 <key name="ebooks" type="as">
352 <default>[]</default>
353 </key>
354+ <key name="text" type="as">
355+ <default>[]</default>
356+ </key>
357 </schema>
358 <schema id="com.ubuntu.content.hub.source" path="/com/ubuntu/content/hub/source/">
359 <key name="pictures" type="as">
360@@ -45,6 +48,9 @@
361 <key name="ebooks" type="as">
362 <default>[]</default>
363 </key>
364+ <key name="text" type="as">
365+ <default>[]</default>
366+ </key>
367 </schema>
368 <schema id="com.ubuntu.content.hub.destination" path="/com/ubuntu/content/hub/destination/">
369 <key name="pictures" type="as">
370@@ -68,6 +74,9 @@
371 <key name="ebooks" type="as">
372 <default>[]</default>
373 </key>
374+ <key name="text" type="as">
375+ <default>[]</default>
376+ </key>
377 </schema>
378 <schema id="com.ubuntu.content.hub.share" path="/com/ubuntu/content/hub/share/">
379 <key name="pictures" type="as">
380@@ -91,5 +100,8 @@
381 <key name="ebooks" type="as">
382 <default>[]</default>
383 </key>
384+ <key name="text" type="as">
385+ <default>[]</default>
386+ </key>
387 </schema>
388 </schemalist>
389
390=== modified file 'src/com/ubuntu/content/service/hook.cpp'
391--- src/com/ubuntu/content/service/hook.cpp 2014-11-03 20:41:08 +0000
392+++ src/com/ubuntu/content/service/hook.cpp 2015-04-21 18:26:55 +0000
393@@ -126,7 +126,7 @@
394 TRACE() << Q_FUNC_INFO << "Hook:" << result.filePath();
395
396 QStringList knownTypes;
397- knownTypes << "pictures" << "music" << "contacts" << "documents" << "videos" << "links" << "ebooks";
398+ knownTypes << "pictures" << "music" << "contacts" << "documents" << "videos" << "links" << "ebooks" << "text";
399 QString app_id = result.fileName();
400 auto peer = cuc::Peer(app_id);
401
402
403=== modified file 'src/com/ubuntu/content/type.cpp'
404--- src/com/ubuntu/content/type.cpp 2014-11-03 20:41:08 +0000
405+++ src/com/ubuntu/content/type.cpp 2015-04-21 18:26:55 +0000
406@@ -110,3 +110,9 @@
407 static cuc::Type t("ebooks", nullptr);
408 return t;
409 }
410+
411+const cuc::Type& cuc::Type::Known::text()
412+{
413+ static cuc::Type t("text", nullptr);
414+ return t;
415+}
416
417=== modified file 'tests/acceptance-tests/app_hub_communication_transfer.cpp'
418--- tests/acceptance-tests/app_hub_communication_transfer.cpp 2015-03-18 18:19:15 +0000
419+++ tests/acceptance-tests/app_hub_communication_transfer.cpp 2015-04-21 18:26:55 +0000
420@@ -133,16 +133,18 @@
421 source_items[0].setName("name1");
422 source_items << cuc::Item(QUrl::fromLocalFile(QFileInfo("file2").absoluteFilePath()));
423 source_items[1].setName("name2");
424- source_items << cuc::Item(QUrl::fromLocalFile(QFileInfo("file3").absoluteFilePath()));
425+ source_items << cuc::Item();
426 source_items[2].setName("name3");
427+ source_items[2].setText("data3");
428
429 QVector<cuc::Item> expected_items;
430 expected_items << cuc::Item(QUrl("file://" + store_dir.path() + "/file1"));
431 expected_items[0].setName("name1");
432 expected_items << cuc::Item(QUrl("file://" + store_dir.path() + "/file2"));
433 expected_items[1].setName("name2");
434- expected_items << cuc::Item(QUrl("file://" + store_dir.path() + "/file3"));
435+ expected_items << cuc::Item();
436 expected_items[2].setName("name3");
437+ expected_items[2].setText("data3");
438
439 /** [Importing pictures] */
440 auto hub = cuc::Hub::Client::instance();
441
442=== modified file 'tests/peers/exporter/autoexporter.cpp'
443--- tests/peers/exporter/autoexporter.cpp 2014-08-07 18:48:10 +0000
444+++ tests/peers/exporter/autoexporter.cpp 2015-04-21 18:26:55 +0000
445@@ -62,6 +62,12 @@
446 connect(transfer, SIGNAL(stateChanged()), this, SLOT(stateChanged()));
447
448 qDebug() << Q_FUNC_INFO << "Items:" << items.count();
449+ Q_FOREACH(cuc::Item item, items) {
450+ qDebug() << Q_FUNC_INFO << "URL:" << item.url();
451+ qDebug() << Q_FUNC_INFO << "Name:" << item.name();
452+ qDebug() << Q_FUNC_INFO << "Text:" << item.text();
453+ qDebug() << Q_FUNC_INFO << "StreamType:" << item.streamType();
454+ }
455 }
456
457 void AutoExporter::handle_share(cuc::Transfer *transfer)
458
459=== modified file 'tests/peers/importer/autoimporter.cpp'
460--- tests/peers/importer/autoimporter.cpp 2014-08-07 19:51:09 +0000
461+++ tests/peers/importer/autoimporter.cpp 2015-04-21 18:26:55 +0000
462@@ -38,6 +38,12 @@
463 QVector<cuc::Item> items;
464 items = transfer->collect();
465 qDebug() << Q_FUNC_INFO << "Items:" << items.count();
466+ Q_FOREACH(cuc::Item item, items) {
467+ qDebug() << Q_FUNC_INFO << "URL:" << item.url();
468+ qDebug() << Q_FUNC_INFO << "Name:" << item.name();
469+ qDebug() << Q_FUNC_INFO << "Text:" << item.text();
470+ qDebug() << Q_FUNC_INFO << "StreamType:" << item.streamType();
471+ }
472 }
473
474 void AutoImporter::handle_export(cuc::Transfer *transfer)
475
476=== modified file 'tests/peers/importer/content-hub-test-importer.json'
477--- tests/peers/importer/content-hub-test-importer.json 2014-11-25 14:18:13 +0000
478+++ tests/peers/importer/content-hub-test-importer.json 2015-04-21 18:26:55 +0000
479@@ -6,6 +6,7 @@
480 "music",
481 "contacts",
482 "links",
483- "ebooks"
484+ "ebooks",
485+ "text"
486 ]
487 }
488
489=== modified file 'tests/peers/sharer/autosharer.cpp'
490--- tests/peers/sharer/autosharer.cpp 2014-08-07 18:48:10 +0000
491+++ tests/peers/sharer/autosharer.cpp 2015-04-21 18:26:55 +0000
492@@ -50,6 +50,12 @@
493 QVector<cuc::Item> items;
494 items = transfer->collect();
495 qDebug() << Q_FUNC_INFO << "Items:" << items.count();
496+ Q_FOREACH(cuc::Item item, items) {
497+ qDebug() << Q_FUNC_INFO << "URL:" << item.url();
498+ qDebug() << Q_FUNC_INFO << "Name:" << item.name();
499+ qDebug() << Q_FUNC_INFO << "Text:" << item.text();
500+ qDebug() << Q_FUNC_INFO << "StreamType:" << item.streamType();
501+ }
502 }
503
504 void AutoSharer::stateChanged()
505
506=== modified file 'tests/peers/sharer/content-hub-test-sharer.json'
507--- tests/peers/sharer/content-hub-test-sharer.json 2014-11-25 14:18:13 +0000
508+++ tests/peers/sharer/content-hub-test-sharer.json 2015-04-21 18:26:55 +0000
509@@ -6,6 +6,7 @@
510 "music",
511 "contacts",
512 "links",
513- "ebooks"
514+ "ebooks",
515+ "text"
516 ]
517 }
518
519=== modified file 'tests/qml-tests/tst_ContentHub.qml'
520--- tests/qml-tests/tst_ContentHub.qml 2014-07-15 11:36:57 +0000
521+++ tests/qml-tests/tst_ContentHub.qml 2015-04-21 18:26:55 +0000
522@@ -31,7 +31,7 @@
523 verify(transfer !== null, "No transer Object returned")
524 }
525
526- function test_export_request() {
527+ function test_export_request_pictures() {
528 var filePath = "file:///foo/bar.png";
529 var transfer = destPeer.request();
530 transfer.items = [ resultComponent.createObject(test, {"url": filePath, "name": "test"}) ];
531@@ -39,16 +39,33 @@
532 // This shouldn't be necessary, but without it we compare the results to fast
533 ContentHub.exportRequested(transfer);
534 compare(test.exportTransfer, transfer, "Transfer object not correcty set");
535- compare(test.exportTransfer.items[0].url, filePath, "Transfer contents incorrect");
536+ compare(test.exportTransfer.items[0].url, filePath, "Transfer url incorrect");
537 compare(test.exportTransfer.items[0].name, "test", "Transfer name incorrect");
538 }
539
540+ function test_export_request_text() {
541+ var transfer = textPeer.request();
542+ transfer.items = [ resultComponent.createObject(test, {"url": "", "name": "test", "text": "some text"}) ];
543+ transfer.state = ContentTransfer.Charged;
544+ // This shouldn't be necessary, but without it we compare the results to fast
545+ ContentHub.exportRequested(transfer);
546+ compare(test.exportTransfer, transfer, "Transfer object not correcty set");
547+ compare(test.exportTransfer.items[0].text, "some text", "Transfer text incorrect");
548+ }
549+
550 Component {
551 id: resultComponent
552 ContentItem {}
553 }
554
555 ContentPeer {
556+ id: textPeer
557+ handler: ContentHandler.Destination
558+ contentType: ContentType.Text
559+ appId: "com.some.dest"
560+ }
561+
562+ ContentPeer {
563 id: sourcePeer
564 handler: ContentHandler.Source
565 contentType: ContentType.Pictures

Subscribers

People subscribed via source and target branches