Merge lp:~renatofilho/qtorganizer5-eds/fix-1426519 into lp:qtorganizer5-eds
- fix-1426519
- Merge into trunk
Proposed by
Renato Araujo Oliveira Filho
Status: | Merged |
---|---|
Approved by: | Charles Kerr |
Approved revision: | 76 |
Merged at revision: | 80 |
Proposed branch: | lp:~renatofilho/qtorganizer5-eds/fix-1426519 |
Merge into: | lp:qtorganizer5-eds |
Diff against target: |
331 lines (+124/-16) 8 files modified
CMakeLists.txt (+1/-0) organizer/qorganizer-eds-engine.cpp (+43/-7) organizer/qorganizer-eds-engine.h (+3/-1) organizer/qorganizer-eds-requestdata.cpp (+16/-4) organizer/qorganizer-eds-requestdata.h (+1/-1) tests/unittest/CMakeLists.txt (+0/-1) tests/unittest/event-test.cpp (+59/-1) tests/unittest/run-eds-test.sh (+1/-1) |
To merge this branch: | bzr merge lp:~renatofilho/qtorganizer5-eds/fix-1426519 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Charles Kerr (community) | Approve | ||
PS Jenkins bot | continuous-integration | Needs Fixing | |
Review via email: mp+253985@code.launchpad.net |
Commit message
Implemented support for extended details.
Now you can set extended details (X-*, properties) for calendar items.
Description of the change
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
Charles Kerr (charlesk) wrote : | # |
Looks good to me. Thanks for the fast work, Renato!
Revision history for this message
Charles Kerr (charlesk) : | # |
review:
Approve
- 77. By Renato Araujo Oliveira Filho
-
Fixed wait function to not block glib.
Fixed source creation process to avoid return unready sources.
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-22 13:18:51 +0000 | |||
3 | +++ CMakeLists.txt 2015-03-30 17:59:30 +0000 | |||
4 | @@ -9,6 +9,7 @@ | |||
5 | 9 | 9 | ||
6 | 10 | find_package(Qt5Core REQUIRED) | 10 | find_package(Qt5Core REQUIRED) |
7 | 11 | add_definitions(-DQT_NO_KEYWORDS) | 11 | add_definitions(-DQT_NO_KEYWORDS) |
8 | 12 | add_definitions(-std=c++11) | ||
9 | 12 | 13 | ||
10 | 13 | pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32) | 14 | pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32) |
11 | 14 | pkg_check_modules(GIO REQUIRED gio-2.0>=2.32) | 15 | pkg_check_modules(GIO REQUIRED gio-2.0>=2.32) |
12 | 15 | 16 | ||
13 | === modified file 'organizer/qorganizer-eds-engine.cpp' | |||
14 | --- organizer/qorganizer-eds-engine.cpp 2015-03-24 17:56:44 +0000 | |||
15 | +++ organizer/qorganizer-eds-engine.cpp 2015-03-30 17:59:30 +0000 | |||
16 | @@ -61,6 +61,7 @@ | |||
17 | 61 | #include <QtOrganizer/QOrganizerEventOccurrence> | 61 | #include <QtOrganizer/QOrganizerEventOccurrence> |
18 | 62 | #include <QtOrganizer/QOrganizerTodoOccurrence> | 62 | #include <QtOrganizer/QOrganizerTodoOccurrence> |
19 | 63 | #include <QtOrganizer/QOrganizerItemParent> | 63 | #include <QtOrganizer/QOrganizerItemParent> |
20 | 64 | #include <QtOrganizer/QOrganizerItemExtendedDetail> | ||
21 | 64 | 65 | ||
22 | 65 | #include <glib.h> | 66 | #include <glib.h> |
23 | 66 | #include <libecal/libecal.h> | 67 | #include <libecal/libecal.h> |
24 | @@ -863,7 +864,7 @@ | |||
25 | 863 | requestData); | 864 | requestData); |
26 | 864 | } else { | 865 | } else { |
27 | 865 | requestData->prepareToUpdate(); | 866 | requestData->prepareToUpdate(); |
29 | 866 | saveCollectionUpdateAsyncStart(requestData); | 867 | g_idle_add((GSourceFunc) saveCollectionUpdateAsyncStart, requestData); |
30 | 867 | } | 868 | } |
31 | 868 | } | 869 | } |
32 | 869 | 870 | ||
33 | @@ -884,16 +885,16 @@ | |||
34 | 884 | } else if (data->isLive()) { | 885 | } else if (data->isLive()) { |
35 | 885 | data->commitSourceCreated(); | 886 | data->commitSourceCreated(); |
36 | 886 | data->prepareToUpdate(); | 887 | data->prepareToUpdate(); |
38 | 887 | saveCollectionUpdateAsyncStart(data); | 888 | g_idle_add((GSourceFunc) saveCollectionUpdateAsyncStart, data); |
39 | 888 | } | 889 | } |
40 | 889 | } | 890 | } |
41 | 890 | 891 | ||
43 | 891 | void QOrganizerEDSEngine::saveCollectionUpdateAsyncStart(SaveCollectionRequestData *data) | 892 | gboolean QOrganizerEDSEngine::saveCollectionUpdateAsyncStart(SaveCollectionRequestData *data) |
44 | 892 | { | 893 | { |
45 | 893 | // check if request was destroyed by the caller | 894 | // check if request was destroyed by the caller |
46 | 894 | if (!data->isLive()) { | 895 | if (!data->isLive()) { |
47 | 895 | releaseRequestData(data); | 896 | releaseRequestData(data); |
49 | 896 | return; | 897 | return FALSE; |
50 | 897 | } | 898 | } |
51 | 898 | 899 | ||
52 | 899 | ESource *source = data->nextSourceToUpdate(); | 900 | ESource *source = data->nextSourceToUpdate(); |
53 | @@ -906,6 +907,7 @@ | |||
54 | 906 | data->finish(); | 907 | data->finish(); |
55 | 907 | releaseRequestData(data); | 908 | releaseRequestData(data); |
56 | 908 | } | 909 | } |
57 | 910 | return FALSE; | ||
58 | 909 | } | 911 | } |
59 | 910 | 912 | ||
60 | 911 | void QOrganizerEDSEngine::saveCollectionUpdateAsynCommited(ESource *source, | 913 | void QOrganizerEDSEngine::saveCollectionUpdateAsynCommited(ESource *source, |
61 | @@ -926,7 +928,7 @@ | |||
62 | 926 | } | 928 | } |
63 | 927 | 929 | ||
64 | 928 | if (data->isLive()) { | 930 | if (data->isLive()) { |
66 | 929 | saveCollectionUpdateAsyncStart(data); | 931 | g_idle_add((GSourceFunc) saveCollectionUpdateAsyncStart, data); |
67 | 930 | } else { | 932 | } else { |
68 | 931 | releaseRequestData(data); | 933 | releaseRequestData(data); |
69 | 932 | } | 934 | } |
70 | @@ -1081,11 +1083,10 @@ | |||
71 | 1081 | bool QOrganizerEDSEngine::waitForRequestFinished(QOrganizerAbstractRequest* req, int msecs) | 1083 | bool QOrganizerEDSEngine::waitForRequestFinished(QOrganizerAbstractRequest* req, int msecs) |
72 | 1082 | { | 1084 | { |
73 | 1083 | Q_ASSERT(req); | 1085 | Q_ASSERT(req); |
74 | 1084 | Q_UNUSED(msecs); | ||
75 | 1085 | 1086 | ||
76 | 1086 | RequestData *data = m_runningRequests.value(req); | 1087 | RequestData *data = m_runningRequests.value(req); |
77 | 1087 | if (data) { | 1088 | if (data) { |
79 | 1088 | data->wait(); | 1089 | data->wait(msecs); |
80 | 1089 | // We can delete the operation already finished | 1090 | // We can delete the operation already finished |
81 | 1090 | data->deleteLater(); | 1091 | data->deleteLater(); |
82 | 1091 | } | 1092 | } |
83 | @@ -1619,6 +1620,20 @@ | |||
84 | 1619 | e_cal_component_free_attendee_list(attendeeList); | 1620 | e_cal_component_free_attendee_list(attendeeList); |
85 | 1620 | } | 1621 | } |
86 | 1621 | 1622 | ||
87 | 1623 | void QOrganizerEDSEngine::parseExtendedDetails(ECalComponent *comp, QOrganizerItem *item) | ||
88 | 1624 | { | ||
89 | 1625 | icalcomponent *icalcomp = e_cal_component_get_icalcomponent(comp); | ||
90 | 1626 | for (icalproperty *prop = icalcomponent_get_first_property(icalcomp, ICAL_X_PROPERTY); | ||
91 | 1627 | prop != NULL; | ||
92 | 1628 | prop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) { | ||
93 | 1629 | |||
94 | 1630 | QOrganizerItemExtendedDetail ex; | ||
95 | 1631 | ex.setName(QString::fromUtf8(icalproperty_get_x_name(prop))); | ||
96 | 1632 | ex.setData(QByteArray(icalproperty_get_x(prop))); | ||
97 | 1633 | item->saveDetail(&ex); | ||
98 | 1634 | } | ||
99 | 1635 | } | ||
100 | 1636 | |||
101 | 1622 | QOrganizerItem *QOrganizerEDSEngine::parseEvent(ECalComponent *comp) | 1637 | QOrganizerItem *QOrganizerEDSEngine::parseEvent(ECalComponent *comp) |
102 | 1623 | { | 1638 | { |
103 | 1624 | QOrganizerItem *event; | 1639 | QOrganizerItem *event; |
104 | @@ -1841,6 +1856,7 @@ | |||
105 | 1841 | parseTags(comp, item); | 1856 | parseTags(comp, item); |
106 | 1842 | parseReminders(comp, item); | 1857 | parseReminders(comp, item); |
107 | 1843 | parseAttendeeList(comp, item); | 1858 | parseAttendeeList(comp, item); |
108 | 1859 | parseExtendedDetails(comp, item); | ||
109 | 1844 | 1860 | ||
110 | 1845 | items << *item; | 1861 | items << *item; |
111 | 1846 | delete item; | 1862 | delete item; |
112 | @@ -2160,6 +2176,25 @@ | |||
113 | 2160 | e_cal_component_free_attendee_list(attendeeList); | 2176 | e_cal_component_free_attendee_list(attendeeList); |
114 | 2161 | } | 2177 | } |
115 | 2162 | 2178 | ||
116 | 2179 | void QOrganizerEDSEngine::parseExtendedDetails(const QOrganizerItem &item, ECalComponent *comp) | ||
117 | 2180 | { | ||
118 | 2181 | icalcomponent *icalcomp = e_cal_component_get_icalcomponent(comp); | ||
119 | 2182 | Q_FOREACH(const QOrganizerItemExtendedDetail &ex, item.details(QOrganizerItemDetail::TypeExtendedDetail)) { | ||
120 | 2183 | // We only support QByteArray. | ||
121 | 2184 | // We could use QStream serialization but it will make it impossible to read it from glib side, for example indicators. | ||
122 | 2185 | QByteArray data = ex.data().toByteArray(); | ||
123 | 2186 | if (data.isEmpty()) { | ||
124 | 2187 | qWarning() << "Invalid value for property" << ex.name() | ||
125 | 2188 | <<". EDS only supports QByteArray values for extended properties"; | ||
126 | 2189 | continue; | ||
127 | 2190 | } | ||
128 | 2191 | |||
129 | 2192 | icalproperty *xProp = icalproperty_new_x(data.constData()); | ||
130 | 2193 | icalproperty_set_x_name(xProp, ex.name().toUtf8().constData()); | ||
131 | 2194 | icalcomponent_add_property(icalcomp, xProp); | ||
132 | 2195 | } | ||
133 | 2196 | } | ||
134 | 2197 | |||
135 | 2163 | bool QOrganizerEDSEngine::hasRecurrence(ECalComponent *comp) | 2198 | bool QOrganizerEDSEngine::hasRecurrence(ECalComponent *comp) |
136 | 2164 | { | 2199 | { |
137 | 2165 | char *rid = e_cal_component_get_recurid_as_string(comp); | 2200 | char *rid = e_cal_component_get_recurid_as_string(comp); |
138 | @@ -2433,6 +2468,7 @@ | |||
139 | 2433 | parseTags(item, comp); | 2468 | parseTags(item, comp); |
140 | 2434 | parseReminders(item, comp); | 2469 | parseReminders(item, comp); |
141 | 2435 | parseAttendeeList(item, comp); | 2470 | parseAttendeeList(item, comp); |
142 | 2471 | parseExtendedDetails(item, comp); | ||
143 | 2436 | 2472 | ||
144 | 2437 | if (!item.id().isNull()) { | 2473 | if (!item.id().isNull()) { |
145 | 2438 | e_cal_component_commit_sequence(comp); | 2474 | e_cal_component_commit_sequence(comp); |
146 | 2439 | 2475 | ||
147 | === modified file 'organizer/qorganizer-eds-engine.h' | |||
148 | --- organizer/qorganizer-eds-engine.h 2015-03-24 17:56:44 +0000 | |||
149 | +++ organizer/qorganizer-eds-engine.h 2015-03-30 17:59:30 +0000 | |||
150 | @@ -168,6 +168,7 @@ | |||
151 | 168 | static void parseProgress(const QtOrganizer::QOrganizerItem &item, ECalComponent *comp); | 168 | static void parseProgress(const QtOrganizer::QOrganizerItem &item, ECalComponent *comp); |
152 | 169 | static void parseStatus(const QtOrganizer::QOrganizerItem &item, ECalComponent *comp); | 169 | static void parseStatus(const QtOrganizer::QOrganizerItem &item, ECalComponent *comp); |
153 | 170 | static void parseAttendeeList(const QtOrganizer::QOrganizerItem &item, ECalComponent *comp); | 170 | static void parseAttendeeList(const QtOrganizer::QOrganizerItem &item, ECalComponent *comp); |
154 | 171 | static void parseExtendedDetails(const QtOrganizer::QOrganizerItem &item, ECalComponent *comp); | ||
155 | 171 | 172 | ||
156 | 172 | // ECalComponent -> QOrganizerItem | 173 | // ECalComponent -> QOrganizerItem |
157 | 173 | static bool hasRecurrence(ECalComponent *comp); | 174 | static bool hasRecurrence(ECalComponent *comp); |
158 | @@ -193,6 +194,7 @@ | |||
159 | 193 | static void parseProgress(ECalComponent *comp, QtOrganizer::QOrganizerItem *item); | 194 | static void parseProgress(ECalComponent *comp, QtOrganizer::QOrganizerItem *item); |
160 | 194 | static void parseStatus(ECalComponent *comp, QtOrganizer::QOrganizerItem *item); | 195 | static void parseStatus(ECalComponent *comp, QtOrganizer::QOrganizerItem *item); |
161 | 195 | static void parseAttendeeList(ECalComponent *comp, QtOrganizer::QOrganizerItem *item); | 196 | static void parseAttendeeList(ECalComponent *comp, QtOrganizer::QOrganizerItem *item); |
162 | 197 | static void parseExtendedDetails(ECalComponent *comp, QtOrganizer::QOrganizerItem *item); | ||
163 | 196 | 198 | ||
164 | 197 | static QDateTime fromIcalTime(struct icaltimetype value, const char *tzId); | 199 | static QDateTime fromIcalTime(struct icaltimetype value, const char *tzId); |
165 | 198 | static icaltimetype fromQDateTime(const QDateTime &dateTime, bool allDay, QByteArray *tzId); | 200 | static icaltimetype fromQDateTime(const QDateTime &dateTime, bool allDay, QByteArray *tzId); |
166 | @@ -234,7 +236,7 @@ | |||
167 | 234 | static void removeItemsAsyncStart(RemoveRequestData *data); | 236 | static void removeItemsAsyncStart(RemoveRequestData *data); |
168 | 235 | 237 | ||
169 | 236 | void saveCollectionAsync(QtOrganizer::QOrganizerCollectionSaveRequest *req); | 238 | void saveCollectionAsync(QtOrganizer::QOrganizerCollectionSaveRequest *req); |
171 | 237 | static void saveCollectionUpdateAsyncStart(SaveCollectionRequestData *data); | 239 | static gboolean saveCollectionUpdateAsyncStart(SaveCollectionRequestData *data); |
172 | 238 | static void saveCollectionAsyncCommited(ESourceRegistry *registry, GAsyncResult *res, SaveCollectionRequestData *data); | 240 | static void saveCollectionAsyncCommited(ESourceRegistry *registry, GAsyncResult *res, SaveCollectionRequestData *data); |
173 | 239 | static void saveCollectionUpdateAsynCommited(ESource *source, GAsyncResult *res, SaveCollectionRequestData *data); | 241 | static void saveCollectionUpdateAsynCommited(ESource *source, GAsyncResult *res, SaveCollectionRequestData *data); |
174 | 240 | 242 | ||
175 | 241 | 243 | ||
176 | === modified file 'organizer/qorganizer-eds-requestdata.cpp' | |||
177 | --- organizer/qorganizer-eds-requestdata.cpp 2015-03-06 22:47:19 +0000 | |||
178 | +++ organizer/qorganizer-eds-requestdata.cpp 2015-03-30 17:59:30 +0000 | |||
179 | @@ -19,7 +19,7 @@ | |||
180 | 19 | #include "qorganizer-eds-requestdata.h" | 19 | #include "qorganizer-eds-requestdata.h" |
181 | 20 | 20 | ||
182 | 21 | #include <QtCore/QDebug> | 21 | #include <QtCore/QDebug> |
184 | 22 | #include <QtCore/QCoreApplication> | 22 | #include <QtCore/QTimer> |
185 | 23 | 23 | ||
186 | 24 | #include <QtOrganizer/QOrganizerAbstractRequest> | 24 | #include <QtOrganizer/QOrganizerAbstractRequest> |
187 | 25 | #include <QtOrganizer/QOrganizerManagerEngine> | 25 | #include <QtOrganizer/QOrganizerManagerEngine> |
188 | @@ -81,12 +81,24 @@ | |||
189 | 81 | } | 81 | } |
190 | 82 | } | 82 | } |
191 | 83 | 83 | ||
193 | 84 | void RequestData::wait() | 84 | void RequestData::wait(int msec) |
194 | 85 | { | 85 | { |
195 | 86 | QMutexLocker locker(&m_waiting); | 86 | QMutexLocker locker(&m_waiting); |
198 | 87 | while(!m_finished) { | 87 | QEventLoop *loop = new QEventLoop; |
199 | 88 | QCoreApplication::processEvents(QEventLoop::AllEvents, 100); | 88 | QOrganizerAbstractRequest *req = m_req.data(); |
200 | 89 | QObject::connect(req, &QOrganizerAbstractRequest::stateChanged, [req, loop](QOrganizerAbstractRequest::State newState) { | ||
201 | 90 | if (newState != QOrganizerAbstractRequest::ActiveState) { | ||
202 | 91 | loop->quit(); | ||
203 | 92 | } | ||
204 | 93 | }); | ||
205 | 94 | QTimer timeout; | ||
206 | 95 | if (msec > 0) { | ||
207 | 96 | timeout.setInterval(msec); | ||
208 | 97 | timeout.setSingleShot(true); | ||
209 | 98 | timeout.start(); | ||
210 | 89 | } | 99 | } |
211 | 100 | loop->exec(QEventLoop::AllEvents|QEventLoop::WaitForMoreEvents); | ||
212 | 101 | delete loop; | ||
213 | 90 | } | 102 | } |
214 | 91 | 103 | ||
215 | 92 | bool RequestData::isWaiting() | 104 | bool RequestData::isWaiting() |
216 | 93 | 105 | ||
217 | === modified file 'organizer/qorganizer-eds-requestdata.h' | |||
218 | --- organizer/qorganizer-eds-requestdata.h 2015-03-06 22:47:19 +0000 | |||
219 | +++ organizer/qorganizer-eds-requestdata.h 2015-03-30 17:59:30 +0000 | |||
220 | @@ -42,7 +42,7 @@ | |||
221 | 42 | virtual void cancel(); | 42 | virtual void cancel(); |
222 | 43 | void deleteLater(); | 43 | void deleteLater(); |
223 | 44 | virtual void finish(QtOrganizer::QOrganizerManager::Error error, QtOrganizer::QOrganizerAbstractRequest::State state) = 0; | 44 | virtual void finish(QtOrganizer::QOrganizerManager::Error error, QtOrganizer::QOrganizerAbstractRequest::State state) = 0; |
225 | 45 | void wait(); | 45 | void wait(int msec = 0); |
226 | 46 | bool isWaiting(); | 46 | bool isWaiting(); |
227 | 47 | 47 | ||
228 | 48 | template<class T> | 48 | template<class T> |
229 | 49 | 49 | ||
230 | === modified file 'tests/unittest/CMakeLists.txt' | |||
231 | --- tests/unittest/CMakeLists.txt 2015-03-24 17:56:44 +0000 | |||
232 | +++ tests/unittest/CMakeLists.txt 2015-03-30 17:59:30 +0000 | |||
233 | @@ -38,7 +38,6 @@ | |||
234 | 38 | ) | 38 | ) |
235 | 39 | 39 | ||
236 | 40 | add_definitions(-DTEST_SUITE) | 40 | add_definitions(-DTEST_SUITE) |
237 | 41 | add_definitions(-std=c++11) | ||
238 | 42 | 41 | ||
239 | 43 | declare_test(itemid-test) | 42 | declare_test(itemid-test) |
240 | 44 | declare_test(parseecal-test) | 43 | declare_test(parseecal-test) |
241 | 45 | 44 | ||
242 | === modified file 'tests/unittest/event-test.cpp' | |||
243 | --- tests/unittest/event-test.cpp 2014-10-29 14:19:47 +0000 | |||
244 | +++ tests/unittest/event-test.cpp 2015-03-30 17:59:30 +0000 | |||
245 | @@ -806,7 +806,6 @@ | |||
246 | 806 | QList<QOrganizerItemId> ids; | 806 | QList<QOrganizerItemId> ids; |
247 | 807 | QOrganizerItemFetchHint hint; | 807 | QOrganizerItemFetchHint hint; |
248 | 808 | ids << items[0].id(); | 808 | ids << items[0].id(); |
249 | 809 | qDebug() << "Find for id" << ids; | ||
250 | 810 | QList<QOrganizerItem> newItems = m_engine->items(ids, hint, &errorMap, &error); | 809 | QList<QOrganizerItem> newItems = m_engine->items(ids, hint, &errorMap, &error); |
251 | 811 | QCOMPARE(newItems.size(), 1); | 810 | QCOMPARE(newItems.size(), 1); |
252 | 812 | 811 | ||
253 | @@ -819,6 +818,65 @@ | |||
254 | 819 | QCOMPARE(newAttendee.participationRole(), attendee.participationRole()); | 818 | QCOMPARE(newAttendee.participationRole(), attendee.participationRole()); |
255 | 820 | QCOMPARE(newAttendee.participationStatus(), attendee.participationStatus()); | 819 | QCOMPARE(newAttendee.participationStatus(), attendee.participationStatus()); |
256 | 821 | } | 820 | } |
257 | 821 | |||
258 | 822 | void testExtendedProperties() | ||
259 | 823 | { | ||
260 | 824 | static QString displayLabelValue = QStringLiteral("event with collection attendee"); | ||
261 | 825 | static QString descriptionValue = QStringLiteral("event without collection"); | ||
262 | 826 | QOrganizerItemId itemId; | ||
263 | 827 | QDateTime currentTime = QDateTime::currentDateTime(); | ||
264 | 828 | |||
265 | 829 | { | ||
266 | 830 | // create a item with X-URL | ||
267 | 831 | QOrganizerEvent event; | ||
268 | 832 | event.setStartDateTime(currentTime); | ||
269 | 833 | event.setEndDateTime(currentTime.addSecs(60 * 30)); | ||
270 | 834 | event.setDisplayLabel(displayLabelValue); | ||
271 | 835 | event.setDescription(descriptionValue); | ||
272 | 836 | |||
273 | 837 | QOrganizerItemExtendedDetail ex; | ||
274 | 838 | ex.setName(QStringLiteral("X-URL")); | ||
275 | 839 | ex.setData(QByteArray("http://canonical.com")); | ||
276 | 840 | event.saveDetail(&ex); | ||
277 | 841 | |||
278 | 842 | // save the new item | ||
279 | 843 | QtOrganizer::QOrganizerManager::Error error; | ||
280 | 844 | QMap<int, QtOrganizer::QOrganizerManager::Error> errorMap; | ||
281 | 845 | QList<QOrganizerItem> items; | ||
282 | 846 | QSignalSpy createdItem(m_engine, SIGNAL(itemsAdded(QList<QOrganizerItemId>))); | ||
283 | 847 | items << event; | ||
284 | 848 | bool saveResult = m_engine->saveItems(&items, | ||
285 | 849 | QList<QtOrganizer::QOrganizerItemDetail::DetailType>(), | ||
286 | 850 | &errorMap, | ||
287 | 851 | &error); | ||
288 | 852 | QTRY_COMPARE(createdItem.count(), 1); | ||
289 | 853 | QVERIFY(saveResult); | ||
290 | 854 | QCOMPARE(error, QOrganizerManager::NoError); | ||
291 | 855 | QCOMPARE(items.size(), 1); | ||
292 | 856 | QVERIFY(errorMap.isEmpty()); | ||
293 | 857 | QVERIFY(!items[0].id().isNull()); | ||
294 | 858 | QCOMPARE(items[0].details(QOrganizerItemDetail::TypeExtendedDetail).size(), 1); | ||
295 | 859 | itemId = items[0].id(); | ||
296 | 860 | } | ||
297 | 861 | |||
298 | 862 | // fetch for the item | ||
299 | 863 | { | ||
300 | 864 | QtOrganizer::QOrganizerManager::Error error; | ||
301 | 865 | QMap<int, QtOrganizer::QOrganizerManager::Error> errorMap; | ||
302 | 866 | QList<QOrganizerItemId> ids; | ||
303 | 867 | QOrganizerItemFetchHint hint; | ||
304 | 868 | ids << itemId; | ||
305 | 869 | QList<QOrganizerItem> items = m_engine->items(ids, hint, &errorMap, &error); | ||
306 | 870 | QCOMPARE(items.size(), 1); | ||
307 | 871 | |||
308 | 872 | QList<QOrganizerItemDetail> exs = items[0].details(QOrganizerItemDetail::TypeExtendedDetail); | ||
309 | 873 | QCOMPARE(exs.size(), 1); | ||
310 | 874 | QCOMPARE(exs[0].value(QOrganizerItemExtendedDetail::FieldName).toString(), | ||
311 | 875 | QStringLiteral("X-URL")); | ||
312 | 876 | QCOMPARE(exs[0].value(QOrganizerItemExtendedDetail::FieldData).toByteArray(), | ||
313 | 877 | QByteArray("http://canonical.com")); | ||
314 | 878 | } | ||
315 | 879 | } | ||
316 | 822 | }; | 880 | }; |
317 | 823 | 881 | ||
318 | 824 | const QString EventTest::collectionTypePropertyName = QStringLiteral("collection-type"); | 882 | const QString EventTest::collectionTypePropertyName = QStringLiteral("collection-type"); |
319 | 825 | 883 | ||
320 | === modified file 'tests/unittest/run-eds-test.sh' | |||
321 | --- tests/unittest/run-eds-test.sh 2014-10-28 20:54:11 +0000 | |||
322 | +++ tests/unittest/run-eds-test.sh 2015-03-30 17:59:30 +0000 | |||
323 | @@ -12,7 +12,7 @@ | |||
324 | 12 | export QT_QPA_PLATFORM=minimal | 12 | export QT_QPA_PLATFORM=minimal |
325 | 13 | export HOME=$TEST_TMP_DIR | 13 | export HOME=$TEST_TMP_DIR |
326 | 14 | export XDG_RUNTIME_DIR=$TEST_TMP_DIR | 14 | export XDG_RUNTIME_DIR=$TEST_TMP_DIR |
328 | 15 | export XDG_CACHE_HOME=$TEST_TMP_DIR}/.cache | 15 | export XDG_CACHE_HOME=$TEST_TMP_DIR/.cache |
329 | 16 | export XDG_CONFIG_HOME=$TEST_TMP_DIR/.config | 16 | export XDG_CONFIG_HOME=$TEST_TMP_DIR/.config |
330 | 17 | export XDG_DATA_HOME=$TEST_TMP_DIR/.local/share | 17 | export XDG_DATA_HOME=$TEST_TMP_DIR/.local/share |
331 | 18 | export XDG_DESKTOP_DIR=$TEST_TMP_DIR | 18 | export XDG_DESKTOP_DIR=$TEST_TMP_DIR |
FAILED: Continuous integration, rev:76 jenkins. qa.ubuntu. com/job/ qtorganizer5- eds-ci/ 197/ jenkins. qa.ubuntu. com/job/ qtorganizer5- eds-vivid- amd64-ci/ 4 jenkins. qa.ubuntu. com/job/ qtorganizer5- eds-vivid- armhf-ci/ 4 jenkins. qa.ubuntu. com/job/ qtorganizer5- eds-vivid- armhf-ci/ 4/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ qtorganizer5- eds-vivid- i386-ci/ 4/console
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/qtorganizer 5-eds-ci/ 197/rebuild
http://