Merge lp:~nskaggs/ubuntu-ui-toolkit/add-min-max-datepicker-tests into lp:ubuntu-ui-toolkit
- add-min-max-datepicker-tests
- Merge into trunk
Proposed by
Nicholas Skaggs
Status: | Superseded |
---|---|
Proposed branch: | lp:~nskaggs/ubuntu-ui-toolkit/add-min-max-datepicker-tests |
Merge into: | lp:ubuntu-ui-toolkit |
Diff against target: |
2338 lines (+726/-558) 39 files modified
debian/control (+0/-1) examples/ubuntu-ui-toolkit-gallery/Icons.qml (+3/-2) examples/ubuntu-ui-toolkit-gallery/TemplateRow.qml (+1/-1) examples/ubuntu-ui-toolkit-gallery/TextInputs.qml (+12/-0) modules/Ubuntu/Components/Icon10.qml (+15/-33) modules/Ubuntu/Components/ListItems/Empty.qml (+1/-1) modules/Ubuntu/Components/OrientationHelper.qml (+4/-1) modules/Ubuntu/Components/Popups/Dialog.qml (+40/-37) modules/Ubuntu/Components/TextArea.qml (+2/-0) modules/Ubuntu/Components/TextCursor.qml (+1/-0) modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml (+1/-0) modules/Ubuntu/Components/Themes/Ambiance/TextAreaStyle.qml (+1/-0) modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml (+1/-0) modules/Ubuntu/Components/ToolbarItems.qml (+1/-1) modules/Ubuntu/Components/plugin/adapters/alarmsadapter_organizer.cpp (+35/-50) modules/Ubuntu/Components/plugin/adapters/alarmsadapter_p.h (+2/-1) modules/Ubuntu/Components/plugin/alarmmanager_p.cpp (+5/-0) modules/Ubuntu/Components/plugin/alarmmanager_p.h (+20/-18) modules/Ubuntu/Components/plugin/alarmmanager_p_p.h (+2/-0) modules/Ubuntu/Components/plugin/plugin.cpp (+0/-7) modules/Ubuntu/Components/plugin/plugin.pro (+1/-3) modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp (+0/-87) modules/Ubuntu/Components/plugin/thumbnailgenerator.h (+0/-36) modules/Ubuntu/Components/plugin/ucactioncontext.h (+1/-0) modules/Ubuntu/Components/plugin/ucactionmanager.h (+1/-0) modules/Ubuntu/Components/plugin/ucscalingimageprovider.cpp (+1/-1) modules/Ubuntu/PerformanceMetrics/plugin/rendertimer.cpp (+123/-66) modules/Ubuntu/PerformanceMetrics/plugin/rendertimer.h (+4/-37) modules/Ubuntu/Test/UbuntuTestCase.qml (+23/-22) tests/autopilot/ubuntuuitoolkit/tests/components/test_popover.py (+51/-0) tests/autopilot/ubuntuuitoolkit/tests/components/test_popover.qml (+70/-0) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py (+68/-20) tests/qmlapicheck.py (+3/-1) tests/qmlapicheck.sh (+14/-5) tests/uitk_test_plan.sh (+153/-88) tests/unit/add_qmlmakecheck.pri (+1/-1) tests/unit/tst_alarms/tst_alarms.cpp (+54/-37) tests/unit/tst_i18n/src/LocalizedApp.qml (+1/-1) tests/unit_x11/tst_components/tst_textarea.qml (+10/-0) |
To merge this branch: | bzr merge lp:~nskaggs/ubuntu-ui-toolkit/add-min-max-datepicker-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Leo Arias | Pending | ||
Ubuntu SDK team | Pending | ||
Review via email: mp+238625@code.launchpad.net |
This proposal has been superseded by a proposal from 2014-10-16.
Commit message
Restore datepicker tests and include tests that contain the min/max properties as well (originally used to workaround bug 1328600)
Description of the change
Restore datepicker tests and include tests that contain the min/max properties as well (originally used to workaround bug 1328600)
To post a comment you must log in.
- 1300. By Nicholas Skaggs
-
for now, comment out the dupes
Unmerged revisions
- 1300. By Nicholas Skaggs
-
for now, comment out the dupes
- 1299. By Nicholas Skaggs
-
lazy imnplement tests with and without min/max dates in qml
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-10-01 07:35:42 +0000 |
3 | +++ debian/control 2014-10-16 21:17:25 +0000 |
4 | @@ -35,7 +35,6 @@ |
5 | libqt5organizer5, |
6 | qtpim5-dev, |
7 | language-pack-en-base, |
8 | - libthumbnailer-dev, |
9 | libdbus-1-dev, |
10 | libnih-dbus-dev, |
11 | xvfb, |
12 | |
13 | === modified file 'examples/ubuntu-ui-toolkit-gallery/Icons.qml' |
14 | --- examples/ubuntu-ui-toolkit-gallery/Icons.qml 2014-07-31 14:14:56 +0000 |
15 | +++ examples/ubuntu-ui-toolkit-gallery/Icons.qml 2014-10-16 21:17:25 +0000 |
16 | @@ -79,10 +79,11 @@ |
17 | TemplateRow { |
18 | title: i18n.tr("Theme") |
19 | spacing: units.gu(2) |
20 | - |
21 | + height: iconFlow.height |
22 | |
23 | Flow { |
24 | - anchors.fill: parent |
25 | + id: iconFlow |
26 | + width: parent.width |
27 | spacing: units.gu(2) |
28 | |
29 | Repeater { |
30 | |
31 | === modified file 'examples/ubuntu-ui-toolkit-gallery/TemplateRow.qml' |
32 | --- examples/ubuntu-ui-toolkit-gallery/TemplateRow.qml 2014-08-07 10:28:01 +0000 |
33 | +++ examples/ubuntu-ui-toolkit-gallery/TemplateRow.qml 2014-10-16 21:17:25 +0000 |
34 | @@ -33,7 +33,7 @@ |
35 | text: templateRow.title |
36 | width: templateRow.titleWidth |
37 | anchors.left: parent.left |
38 | - anchors.verticalCenter: contentRow.verticalCenter |
39 | + anchors.top: contentRow.top |
40 | elide: Text.ElideRight |
41 | font.weight: Font.Light |
42 | } |
43 | |
44 | === modified file 'examples/ubuntu-ui-toolkit-gallery/TextInputs.qml' |
45 | --- examples/ubuntu-ui-toolkit-gallery/TextInputs.qml 2014-09-17 15:11:08 +0000 |
46 | +++ examples/ubuntu-ui-toolkit-gallery/TextInputs.qml 2014-10-16 21:17:25 +0000 |
47 | @@ -74,10 +74,22 @@ |
48 | } |
49 | |
50 | TemplateRow { |
51 | + title: i18n.tr("Read-only") |
52 | + |
53 | + TextField { |
54 | + objectName: "textfield_read_only" |
55 | + text: i18n.tr("Nobody type here") |
56 | + readOnly: true |
57 | + width: parent.width |
58 | + } |
59 | + } |
60 | + |
61 | + TemplateRow { |
62 | title: i18n.tr("Disabled") |
63 | |
64 | TextField { |
65 | objectName: "textfield_disabled" |
66 | + text: i18n.tr("No interaction allowed") |
67 | enabled: false |
68 | width: parent.width |
69 | } |
70 | |
71 | === modified file 'modules/Ubuntu/Components/Icon10.qml' |
72 | --- modules/Ubuntu/Components/Icon10.qml 2014-09-19 13:22:18 +0000 |
73 | +++ modules/Ubuntu/Components/Icon10.qml 2014-10-16 21:17:25 +0000 |
74 | @@ -31,45 +31,27 @@ |
75 | */ |
76 | property alias keyColor: colorizedImage.keyColorIn |
77 | |
78 | + implicitWidth: image.implicitWidth |
79 | + implicitHeight: image.implicitHeight |
80 | + |
81 | Image { |
82 | id: image |
83 | objectName: "image" |
84 | anchors.fill: parent |
85 | + fillMode: Image.PreserveAspectFit |
86 | |
87 | - /* Necessary so that icons are not loaded before a size is set. */ |
88 | - source: "" |
89 | sourceSize { |
90 | - width: 0 |
91 | - height: 0 |
92 | - } |
93 | - |
94 | - Component.onCompleted: update() |
95 | - onWidthChanged: update() |
96 | - onHeightChanged: update() |
97 | - Connections { |
98 | - target: icon |
99 | - ignoreUnknownSignals: true |
100 | - onNameChanged: image.update() |
101 | - onSourceChanged: image.update() |
102 | - } |
103 | - |
104 | - function update() { |
105 | - // only set sourceSize.width, sourceSize.height and source when |
106 | - // icon dimensions are valid, see bug #1349769. |
107 | - if (width > 0 && height > 0 |
108 | - && (icon.name || (icon.hasOwnProperty("source") && icon.source))) { |
109 | - sourceSize.width = width; |
110 | - sourceSize.height = height; |
111 | - if (icon.hasOwnProperty("source")) { |
112 | - source = icon.source; |
113 | - } else { |
114 | - source = "image://theme/%1".arg(icon.name); |
115 | - } |
116 | - } else { |
117 | - source = ""; |
118 | - sourceSize.width = 0; |
119 | - sourceSize.height = 0; |
120 | - } |
121 | + width: icon.width |
122 | + height: icon.height |
123 | + } |
124 | + |
125 | + source: { |
126 | + if (icon.hasOwnProperty("source")) |
127 | + return icon.source; |
128 | + else if (icon.name) |
129 | + return "image://theme/%1".arg(icon.name); |
130 | + else |
131 | + return ""; |
132 | } |
133 | |
134 | cache: true |
135 | |
136 | === modified file 'modules/Ubuntu/Components/ListItems/Empty.qml' |
137 | --- modules/Ubuntu/Components/ListItems/Empty.qml 2014-09-09 16:03:39 +0000 |
138 | +++ modules/Ubuntu/Components/ListItems/Empty.qml 2014-10-16 21:17:25 +0000 |
139 | @@ -410,7 +410,7 @@ |
140 | width: units.gu(5) |
141 | } |
142 | Label { |
143 | - text: i18n.dtr('ubuntu-ui-toolkit', 'Delete') |
144 | + text: i18n.dtr('ubuntu-ui-toolkit', "Delete") |
145 | verticalAlignment: Text.AlignVCenter |
146 | anchors { |
147 | verticalCenter: parent.verticalCenter |
148 | |
149 | === modified file 'modules/Ubuntu/Components/OrientationHelper.qml' |
150 | --- modules/Ubuntu/Components/OrientationHelper.qml 2014-07-10 11:50:13 +0000 |
151 | +++ modules/Ubuntu/Components/OrientationHelper.qml 2014-10-16 21:17:25 +0000 |
152 | @@ -134,7 +134,10 @@ |
153 | window.contentOrientation = Screen.orientation |
154 | } |
155 | |
156 | - onWindowActiveChanged: applyOrientation() |
157 | + onWindowActiveChanged: { |
158 | + if (automaticOrientation) |
159 | + applyOrientation(); |
160 | + } |
161 | |
162 | state: orientationAngle.toString() |
163 | |
164 | |
165 | === modified file 'modules/Ubuntu/Components/Popups/Dialog.qml' |
166 | --- modules/Ubuntu/Components/Popups/Dialog.qml 2014-10-01 10:21:28 +0000 |
167 | +++ modules/Ubuntu/Components/Popups/Dialog.qml 2014-10-16 21:17:25 +0000 |
168 | @@ -173,43 +173,46 @@ |
169 | |
170 | height: Math.min(contentsColumn.height + foreground.margins, dialog.height) |
171 | |
172 | - Column { |
173 | - id: contentsColumn |
174 | - anchors { |
175 | - top: parent.top |
176 | - left: parent.left |
177 | - right: parent.right |
178 | - margins: foreground.margins |
179 | - } |
180 | - spacing: foreground.itemSpacing |
181 | - height: childrenRect.height + foreground.margins |
182 | - onWidthChanged: updateChildrenWidths(); |
183 | - |
184 | - Label { |
185 | - horizontalAlignment: Text.AlignHCenter |
186 | - text: dialog.title |
187 | - wrapMode: Text.Wrap |
188 | - maximumLineCount: 2 |
189 | - elide: Text.ElideRight |
190 | - fontSize: "large" |
191 | - color: UbuntuColors.darkGrey |
192 | - visible: (text !== "") |
193 | - } |
194 | - |
195 | - Label { |
196 | - horizontalAlignment: Text.AlignHCenter |
197 | - text: dialog.text |
198 | - fontSize: "medium" |
199 | - color: UbuntuColors.darkGrey |
200 | - wrapMode: Text.Wrap |
201 | - visible: (text !== "") |
202 | - } |
203 | - |
204 | - onChildrenChanged: updateChildrenWidths() |
205 | - |
206 | - function updateChildrenWidths() { |
207 | - for (var i = 0; i < children.length; i++) { |
208 | - children[i].width = contentsColumn.width; |
209 | + Flickable { |
210 | + anchors.fill: parent |
211 | + anchors.margins: foreground.margins |
212 | + contentWidth: contentsColumn.width |
213 | + contentHeight: contentsColumn.height - foreground.margins |
214 | + boundsBehavior: Flickable.StopAtBounds |
215 | + |
216 | + Column { |
217 | + id: contentsColumn |
218 | + spacing: foreground.itemSpacing |
219 | + width: foreground.width - foreground.margins * 2 - foreground.itemSpacing |
220 | + height: childrenRect.height + foreground.margins |
221 | + onWidthChanged: updateChildrenWidths(); |
222 | + |
223 | + Label { |
224 | + horizontalAlignment: Text.AlignHCenter |
225 | + text: dialog.title |
226 | + wrapMode: Text.Wrap |
227 | + maximumLineCount: 2 |
228 | + elide: Text.ElideRight |
229 | + fontSize: "large" |
230 | + color: UbuntuColors.darkGrey |
231 | + visible: (text !== "") |
232 | + } |
233 | + |
234 | + Label { |
235 | + horizontalAlignment: Text.AlignHCenter |
236 | + text: dialog.text |
237 | + fontSize: "medium" |
238 | + color: UbuntuColors.darkGrey |
239 | + wrapMode: Text.Wrap |
240 | + visible: (text !== "") |
241 | + } |
242 | + |
243 | + onChildrenChanged: updateChildrenWidths() |
244 | + |
245 | + function updateChildrenWidths() { |
246 | + for (var i = 0; i < children.length; i++) { |
247 | + children[i].width = contentsColumn.width; |
248 | + } |
249 | } |
250 | } |
251 | } |
252 | |
253 | === modified file 'modules/Ubuntu/Components/TextArea.qml' |
254 | --- modules/Ubuntu/Components/TextArea.qml 2014-07-11 15:11:02 +0000 |
255 | +++ modules/Ubuntu/Components/TextArea.qml 2014-10-16 21:17:25 +0000 |
256 | @@ -776,6 +776,8 @@ |
257 | // grab Enter/Return keys which may be stolen from parent components of TextArea |
258 | // due to forwarded keys from TextEdit |
259 | Keys.onPressed: { |
260 | + if (readOnly) |
261 | + return; |
262 | if ((event.key === Qt.Key_Enter) || (event.key === Qt.Key_Return)) { |
263 | if (editor.textFormat === TextEdit.RichText) { |
264 | // FIXME: use control.paste("<br />") instead when paste() gets sich text support |
265 | |
266 | === modified file 'modules/Ubuntu/Components/TextCursor.qml' |
267 | --- modules/Ubuntu/Components/TextCursor.qml 2014-09-19 09:07:48 +0000 |
268 | +++ modules/Ubuntu/Components/TextCursor.qml 2014-10-16 21:17:25 +0000 |
269 | @@ -129,6 +129,7 @@ |
270 | } |
271 | property bool typing: false |
272 | property bool contextMenuVisible: false |
273 | + property bool readOnly: handler.main.readOnly |
274 | function contextMenuHidden(p) { |
275 | contextMenuVisible = false |
276 | } |
277 | |
278 | === modified file 'modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml' |
279 | --- modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-10-14 14:33:50 +0000 |
280 | +++ modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-10-16 21:17:25 +0000 |
281 | @@ -540,6 +540,7 @@ |
282 | verticalCenterOffset: units.dp(-1) |
283 | left: actionIcon.right |
284 | leftMargin: units.gu(2) |
285 | + right: parent.right |
286 | } |
287 | fontSize: "small" |
288 | elide: Text.ElideRight |
289 | |
290 | === modified file 'modules/Ubuntu/Components/Themes/Ambiance/TextAreaStyle.qml' |
291 | --- modules/Ubuntu/Components/Themes/Ambiance/TextAreaStyle.qml 2014-09-18 15:42:37 +0000 |
292 | +++ modules/Ubuntu/Components/Themes/Ambiance/TextAreaStyle.qml 2014-10-16 21:17:25 +0000 |
293 | @@ -61,6 +61,7 @@ |
294 | onErrorChanged: (error) ? visuals.errorColor : visuals.backgroundColor; |
295 | color: visuals.backgroundColor; |
296 | anchors.fill: parent |
297 | + visible: !styledItem.readOnly |
298 | } |
299 | |
300 | Loader { |
301 | |
302 | === modified file 'modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml' |
303 | --- modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml 2014-09-22 07:19:56 +0000 |
304 | +++ modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml 2014-10-16 21:17:25 +0000 |
305 | @@ -63,6 +63,7 @@ |
306 | running: (cursorStyle.cursorVisibleTimeout > 0) && |
307 | (cursorStyle.cursorHiddenTimeout > 0) && |
308 | styledItem.visible && |
309 | + !styledItem.readOnly && |
310 | !styledItem.contextMenuVisible && |
311 | styledItem.positionProperty === "cursorPosition" |
312 | repeat: true |
313 | |
314 | === modified file 'modules/Ubuntu/Components/ToolbarItems.qml' |
315 | --- modules/Ubuntu/Components/ToolbarItems.qml 2014-05-23 09:27:57 +0000 |
316 | +++ modules/Ubuntu/Components/ToolbarItems.qml 2014-10-16 21:17:25 +0000 |
317 | @@ -139,7 +139,7 @@ |
318 | property Item back: ToolbarButton { |
319 | objectName: "back_toolbar_button" |
320 | iconSource: Qt.resolvedUrl("artwork/back.png") |
321 | - text: i18n.dtr('ubuntu-ui-toolkit', 'Back') |
322 | + text: i18n.dtr('ubuntu-ui-toolkit', "Back") |
323 | visible: toolbarItems.pageStack && toolbarItems.pageStack.depth > 1 |
324 | /*! |
325 | If there is a \l PageStack of sufficient depth, triggering the back button |
326 | |
327 | === modified file 'modules/Ubuntu/Components/plugin/adapters/alarmsadapter_organizer.cpp' |
328 | --- modules/Ubuntu/Components/plugin/adapters/alarmsadapter_organizer.cpp 2014-09-25 08:19:55 +0000 |
329 | +++ modules/Ubuntu/Components/plugin/adapters/alarmsadapter_organizer.cpp 2014-10-16 21:17:25 +0000 |
330 | @@ -25,6 +25,7 @@ |
331 | |
332 | #include <QtCore/QFile> |
333 | #include <QtCore/QDir> |
334 | +#include <QtCore/QTimeZone> |
335 | #include <QtCore/QStandardPaths> |
336 | #include <QtCore/QJsonDocument> |
337 | #include <QtCore/QJsonObject> |
338 | @@ -127,7 +128,7 @@ |
339 | |
340 | AlarmData alarm; |
341 | alarm.message = object["message"].toString(); |
342 | - alarm.originalDate = alarm.date = AlarmData::transcodeDate(QDateTime::fromString(object["date"].toString()), Qt::LocalTime); |
343 | + alarm.originalDate = alarm.date = QDateTime::fromString(object["date"].toString()); |
344 | alarm.sound = object["sound"].toString(); |
345 | alarm.type = static_cast<UCAlarm::AlarmType>(object["type"].toInt()); |
346 | alarm.days = static_cast<UCAlarm::DaysOfWeek>(object["days"].toInt()); |
347 | @@ -158,7 +159,7 @@ |
348 | Q_FOREACH(const AlarmData &alarm, alarmList) { |
349 | QJsonObject object; |
350 | object["message"] = alarm.message; |
351 | - object["date"] = AlarmData::transcodeDate(alarm.originalDate, Qt::UTC).toString(); |
352 | + object["date"] = alarm.originalDate.toString(); |
353 | object["sound"] = alarm.sound.toString(); |
354 | object["type"] = QJsonValue(alarm.type); |
355 | object["days"] = QJsonValue(alarm.days); |
356 | @@ -181,7 +182,12 @@ |
357 | event.setCollectionId(collection.id()); |
358 | event.setAllDay(false); |
359 | if (alarm.changes & AlarmData::Date) { |
360 | - event.setStartDateTime(AlarmData::transcodeDate(alarm.date, Qt::UTC)); |
361 | + QDateTime dt = AlarmData::normalizeDate(alarm.date); |
362 | + // use invalid timezone to sinalize floating time, this is valid only for EDS backend |
363 | + if (manager->managerName() == ALARM_MANAGER) { |
364 | + dt = QDateTime(dt.date(), dt.time(), QTimeZone()); |
365 | + } |
366 | + event.setStartDateTime(dt); |
367 | } |
368 | if (alarm.changes & AlarmData::Message) { |
369 | event.setDisplayLabel(alarm.message); |
370 | @@ -195,7 +201,11 @@ |
371 | event.saveDetail(&visual); |
372 | } |
373 | QOrganizerItemAudibleReminder audible = event.detail(QOrganizerItemDetail::TypeAudibleReminder); |
374 | - if (audible.isEmpty()) { |
375 | + if (audible.dataUrl() != alarm.sound) { |
376 | + if (!audible.isEmpty()) { |
377 | + // remove previous attachment |
378 | + event.removeDetail(&audible); |
379 | + } |
380 | audible.setSecondsBeforeStart(0); |
381 | audible.setDataUrl(alarm.sound); |
382 | event.saveDetail(&audible); |
383 | @@ -213,20 +223,6 @@ |
384 | } |
385 | } |
386 | |
387 | - // save the sound as description as the audible reminder may be off |
388 | - if (alarm.changes && AlarmData::Sound) { |
389 | - event.setDescription(alarm.sound.toString()); |
390 | - // update audible reminder as well if alarm is enabled |
391 | - if (alarm.enabled) { |
392 | - QOrganizerItemAudibleReminder audible = event.detail(QOrganizerItemDetail::TypeAudibleReminder); |
393 | - // remove the previous data, otherwise we will have two melodies |
394 | - event.removeDetail(&audible); |
395 | - // update sound and save |
396 | - audible.setDataUrl(alarm.sound); |
397 | - event.saveDetail(&audible); |
398 | - } |
399 | - } |
400 | - |
401 | // set repeating, reset recurrence no matter if we had it or not |
402 | if (((alarm.changes & AlarmData::Type) == AlarmData::Type) |
403 | || ((alarm.changes & AlarmData::Days) == AlarmData::Days)) { |
404 | @@ -261,8 +257,9 @@ |
405 | |
406 | alarm.cookie = QVariant::fromValue<QOrganizerItemId>(event.id()); |
407 | alarm.message = event.displayLabel(); |
408 | - alarm.date = AlarmData::transcodeDate(event.startDateTime().toUTC(), Qt::LocalTime); |
409 | - alarm.sound = QUrl(event.description()); |
410 | + alarm.date = AlarmData::transcodeDate(event.startDateTime(), Qt::LocalTime); |
411 | + QOrganizerItemAudibleReminder audible = event.detail(QOrganizerItemDetail::TypeAudibleReminder); |
412 | + alarm.sound = audible.dataUrl(); |
413 | alarm.originalDate = alarm.date; |
414 | |
415 | // check if the alarm is enabled or not |
416 | @@ -341,13 +338,6 @@ |
417 | if (value.toBool()) { |
418 | return !todo.tags().contains(tagDisabledAlarm) && todo.tags().contains(tagAlarmService); |
419 | } else { |
420 | - // check if we have the attachments still |
421 | - QOrganizerItemVisualReminder visual = todo.detail(QOrganizerItemDetail::TypeVisualReminder); |
422 | - QOrganizerItemAudibleReminder audible = todo.detail(QOrganizerItemDetail::TypeAudibleReminder); |
423 | - if (visual.isEmpty() || audible.isEmpty()) { |
424 | - // we don't, return failure |
425 | - return false; |
426 | - } |
427 | return todo.tags().contains(tagDisabledAlarm) && todo.tags().contains(tagAlarmService); |
428 | } |
429 | } |
430 | @@ -361,14 +351,9 @@ |
431 | } |
432 | case AlarmData::Sound: |
433 | { |
434 | - // it is enough to check teh audible presence, as they are added/removed in pair with visual reminder |
435 | + // it is enough to check the audible presence, as they are added/removed in pair with visual reminder |
436 | QOrganizerItemAudibleReminder audible = todo.detail(QOrganizerItemDetail::TypeAudibleReminder); |
437 | - bool result = todo.description() == value.toString(); |
438 | - if (result && !audible.isEmpty()) { |
439 | - // check whether the reminder has the same sound |
440 | - result = audible.dataUrl().toString() == value.toString(); |
441 | - } |
442 | - return result; |
443 | + return audible.dataUrl().toString() == value.toString(); |
444 | } |
445 | case AlarmData::Type: |
446 | { |
447 | @@ -415,7 +400,14 @@ |
448 | return adapter->fetch(); |
449 | } |
450 | |
451 | -void AlarmsAdapter::updateAlarms(QList<QOrganizerItemId> list) |
452 | +bool AlarmsAdapter::compareCookies(const QVariant &cookie1, const QVariant &cookie2) |
453 | +{ |
454 | + QOrganizerItemId id1 = cookie1.value<QOrganizerItemId>(); |
455 | + QOrganizerItemId id2 = cookie2.value<QOrganizerItemId>(); |
456 | + return id1 == id2; |
457 | +} |
458 | + |
459 | +void AlarmsAdapter::updateAlarms(const QList<QOrganizerItemId> &list) |
460 | { |
461 | if (list.size() < 0) { |
462 | return; |
463 | @@ -443,7 +435,8 @@ |
464 | QVariant cookie = QVariant::fromValue<QOrganizerItemId>(event.id()); |
465 | int index = alarmList.indexOfAlarm(cookie); |
466 | if (index < 0) { |
467 | - qFatal("The Alarm data has been updated with an unregistered item!"); |
468 | + qCritical("The Alarm data has been updated with an unregistered item, skipping!"); |
469 | + continue; |
470 | } |
471 | AlarmData data = alarmList[index]; |
472 | if (alarmDataFromOrganizerEvent(event, data) == UCAlarm::NoError) { |
473 | @@ -512,10 +505,6 @@ |
474 | endDate = startDate.addDays(8); |
475 | } |
476 | |
477 | - // transcode both dates |
478 | - startDate = AlarmData::transcodeDate(startDate, Qt::UTC); |
479 | - endDate = AlarmData::transcodeDate(endDate, Qt::UTC); |
480 | - |
481 | QList<QOrganizerItem> occurrences = manager->itemOccurrences(event, startDate, endDate, 10); |
482 | // get the first occurrence and use the date from it |
483 | if ((occurrences.length() > 0) && (occurrences[0].type() == QOrganizerItemType::TypeTodoOccurrence)) { |
484 | @@ -525,7 +514,7 @@ |
485 | // check if the date is after the current datetime |
486 | // the first occurrence is the one closest to the currentDate, therefore we can safely |
487 | // set that startDate to the alarm |
488 | - alarm.date = AlarmData::transcodeDate(occurrence.startDateTime().toUTC(), Qt::LocalTime); |
489 | + alarm.date = AlarmData::transcodeDate(occurrence.startDateTime(), Qt::LocalTime); |
490 | if (alarm.date > currentDate) { |
491 | // we have the proper date set, leave |
492 | break; |
493 | @@ -587,13 +576,9 @@ |
494 | return false; |
495 | } |
496 | |
497 | - QOrganizerTodo event; |
498 | - AlarmsAdapter::get()->organizerEventFromAlarmData(alarm, event); |
499 | - event.setId(alarm.cookie.value<QOrganizerItemId>()); |
500 | - |
501 | - QOrganizerItemRemoveRequest *operation = new QOrganizerItemRemoveRequest(q_ptr); |
502 | + QOrganizerItemRemoveByIdRequest *operation = new QOrganizerItemRemoveByIdRequest(q_ptr); |
503 | operation->setManager(AlarmsAdapter::get()->manager); |
504 | - operation->setItem(event); |
505 | + operation->setItemId(alarm.cookie.value<QOrganizerItemId>()); |
506 | AlarmsAdapter::get()->listDirty = true; |
507 | return start(operation); |
508 | } |
509 | @@ -644,7 +629,7 @@ |
510 | completed = false; |
511 | // make sure we are in progress state |
512 | setStatus(requestTypeToOperation(), AlarmRequest::InProgress); |
513 | - QObject::connect(m_request, SIGNAL(resultsAvailable()), q_ptr, SLOT(_q_updateProgress())); |
514 | + QObject::connect(m_request, SIGNAL(stateChanged(QOrganizerAbstractRequest::State)), q_ptr, SLOT(_q_updateProgress())); |
515 | if (m_request->start()) { |
516 | // check if the request got completed without having the slot called (some engines may do that) |
517 | if (!completed && m_request->state() >= QOrganizerAbstractRequest::CanceledState) { |
518 | @@ -661,11 +646,11 @@ |
519 | void AlarmRequestAdapter::_q_updateProgress() |
520 | { |
521 | completed = true; |
522 | - |
523 | QOrganizerAbstractRequest::State state = m_request->state(); |
524 | AlarmRequest::Operation opCode = requestTypeToOperation(); |
525 | switch (state) { |
526 | case QOrganizerAbstractRequest::InactiveState: { |
527 | + completed = false; |
528 | setStatus(opCode, AlarmRequest::Ready); |
529 | break; |
530 | } |
531 | @@ -730,7 +715,7 @@ |
532 | case QOrganizerAbstractRequest::ItemSaveRequest: { |
533 | return AlarmRequest::Saving; |
534 | } |
535 | - case QOrganizerAbstractRequest::ItemRemoveRequest: { |
536 | + case QOrganizerAbstractRequest::ItemRemoveByIdRequest: { |
537 | return AlarmRequest::Canceling; |
538 | } |
539 | case QOrganizerAbstractRequest::ItemFetchRequest: { |
540 | |
541 | === modified file 'modules/Ubuntu/Components/plugin/adapters/alarmsadapter_p.h' |
542 | --- modules/Ubuntu/Components/plugin/adapters/alarmsadapter_p.h 2014-09-04 13:47:03 +0000 |
543 | +++ modules/Ubuntu/Components/plugin/adapters/alarmsadapter_p.h 2014-10-16 21:17:25 +0000 |
544 | @@ -90,10 +90,11 @@ |
545 | void daysFromSet(AlarmData &alarm, QSet<Qt::DayOfWeek> set); |
546 | |
547 | bool verifyChange(const QVariant &cookie, AlarmData::Change change, const QVariant &value); |
548 | + bool compareCookies(const QVariant &cookie1, const QVariant &cookie2); |
549 | |
550 | public Q_SLOTS: |
551 | bool fetchAlarms(); |
552 | - void updateAlarms(QList<QOrganizerItemId> list); |
553 | + void updateAlarms(const QList<QOrganizerItemId> &list); |
554 | |
555 | protected: |
556 | AlarmRequest *fetchRequest; |
557 | |
558 | === modified file 'modules/Ubuntu/Components/plugin/alarmmanager_p.cpp' |
559 | --- modules/Ubuntu/Components/plugin/alarmmanager_p.cpp 2014-09-04 13:47:03 +0000 |
560 | +++ modules/Ubuntu/Components/plugin/alarmmanager_p.cpp 2014-10-16 21:17:25 +0000 |
561 | @@ -66,5 +66,10 @@ |
562 | return d->verifyChange(pAlarm->rawData.cookie, change, newData); |
563 | } |
564 | |
565 | +bool AlarmManager::compareCookies(const QVariant &cookie1, const QVariant &cookie2) |
566 | +{ |
567 | + Q_D(AlarmManager); |
568 | + return d->compareCookies(cookie1, cookie2); |
569 | +} |
570 | |
571 | #include "moc_alarmmanager_p.cpp" |
572 | |
573 | === modified file 'modules/Ubuntu/Components/plugin/alarmmanager_p.h' |
574 | --- modules/Ubuntu/Components/plugin/alarmmanager_p.h 2014-09-04 13:47:03 +0000 |
575 | +++ modules/Ubuntu/Components/plugin/alarmmanager_p.h 2014-10-16 21:17:25 +0000 |
576 | @@ -123,26 +123,9 @@ |
577 | bool enabled; |
578 | }; |
579 | |
580 | -// list of alarms |
581 | -class AlarmList: public QList<AlarmData> |
582 | -{ |
583 | -public: |
584 | - AlarmList(){} |
585 | - |
586 | - // returns the index of the alarm matching a cookie, -1 on error |
587 | - inline int indexOfAlarm(const QVariant &cookie) |
588 | - { |
589 | - for (int i = 0; i < size(); i++) { |
590 | - if (at(i).cookie == cookie) { |
591 | - return i; |
592 | - } |
593 | - } |
594 | - return -1; |
595 | - } |
596 | -}; |
597 | - |
598 | class AlarmRequest; |
599 | class AlarmManagerPrivate; |
600 | +class AlarmList; |
601 | class AlarmManager : public QObject |
602 | { |
603 | Q_OBJECT |
604 | @@ -160,6 +143,7 @@ |
605 | AlarmList alarms() const; |
606 | |
607 | bool verifyChange(UCAlarm *alarm, AlarmData::Change change, const QVariant &newData); |
608 | + bool compareCookies(const QVariant &cookie1, const QVariant &cookie2); |
609 | |
610 | Q_SIGNALS: |
611 | void alarmsChanged(); |
612 | @@ -172,4 +156,22 @@ |
613 | QScopedPointer<AlarmManagerPrivate> d_ptr; |
614 | }; |
615 | |
616 | +// list of alarms |
617 | +class AlarmList: public QList<AlarmData> |
618 | +{ |
619 | +public: |
620 | + AlarmList(){} |
621 | + |
622 | + // returns the index of the alarm matching a cookie, -1 on error |
623 | + inline int indexOfAlarm(const QVariant &cookie) |
624 | + { |
625 | + for (int i = 0; i < size(); i++) { |
626 | + if (AlarmManager::instance().compareCookies(at(i).cookie, cookie)) { |
627 | + return i; |
628 | + } |
629 | + } |
630 | + return -1; |
631 | + } |
632 | +}; |
633 | + |
634 | #endif // ALARMMANAGER_H |
635 | |
636 | === modified file 'modules/Ubuntu/Components/plugin/alarmmanager_p_p.h' |
637 | --- modules/Ubuntu/Components/plugin/alarmmanager_p_p.h 2014-09-04 13:47:03 +0000 |
638 | +++ modules/Ubuntu/Components/plugin/alarmmanager_p_p.h 2014-10-16 21:17:25 +0000 |
639 | @@ -44,6 +44,8 @@ |
640 | |
641 | virtual bool fetchAlarms() = 0; |
642 | |
643 | + virtual bool compareCookies(const QVariant &cookie1, const QVariant &cookie2) = 0; |
644 | + |
645 | // function to verify whether the given alarm property has a given value set |
646 | // used for testing purposes |
647 | virtual bool verifyChange(const QVariant &cookie, AlarmData::Change change, const QVariant &value) = 0; |
648 | |
649 | === modified file 'modules/Ubuntu/Components/plugin/plugin.cpp' |
650 | --- modules/Ubuntu/Components/plugin/plugin.cpp 2014-09-07 16:42:47 +0000 |
651 | +++ modules/Ubuntu/Components/plugin/plugin.cpp 2014-10-16 21:17:25 +0000 |
652 | @@ -35,7 +35,6 @@ |
653 | #include "inversemouseareatype.h" |
654 | #include "qquickclipboard.h" |
655 | #include "qquickmimedata.h" |
656 | -#include "thumbnailgenerator.h" |
657 | #include "ucubuntuanimation.h" |
658 | #include "ucfontutils.h" |
659 | #include "ucarguments.h" |
660 | @@ -214,12 +213,6 @@ |
661 | // register icon provider |
662 | engine->addImageProvider(QLatin1String("theme"), new UnityThemeIconProvider); |
663 | |
664 | - try { |
665 | - engine->addImageProvider(QLatin1String("thumbnailer"), new ThumbnailGenerator); |
666 | - } catch(std::runtime_error &e) { |
667 | - qDebug() << "Could not create thumbnailer: " << e.what(); |
668 | - } |
669 | - |
670 | // Necessary for Screen.orientation (from import QtQuick.Window 2.0) to work |
671 | QGuiApplication::primaryScreen()->setOrientationUpdateMask( |
672 | Qt::PortraitOrientation | |
673 | |
674 | === modified file 'modules/Ubuntu/Components/plugin/plugin.pro' |
675 | --- modules/Ubuntu/Components/plugin/plugin.pro 2014-09-07 16:42:47 +0000 |
676 | +++ modules/Ubuntu/Components/plugin/plugin.pro 2014-10-16 21:17:25 +0000 |
677 | @@ -1,6 +1,6 @@ |
678 | unix { |
679 | CONFIG += link_pkgconfig |
680 | - PKGCONFIG += gio-2.0 thumbnailer dbus-1 libnih-dbus |
681 | + PKGCONFIG += gio-2.0 dbus-1 libnih-dbus |
682 | } |
683 | |
684 | TEMPLATE = lib |
685 | @@ -50,7 +50,6 @@ |
686 | alarmmanager_p.h \ |
687 | ucalarmmodel.h \ |
688 | unitythemeiconprovider.h \ |
689 | - thumbnailgenerator.h \ |
690 | alarmrequest_p.h \ |
691 | alarmrequest_p_p.h \ |
692 | adapters/alarmsadapter_p.h \ |
693 | @@ -93,7 +92,6 @@ |
694 | alarmmanager_p.cpp \ |
695 | ucalarmmodel.cpp \ |
696 | unitythemeiconprovider.cpp \ |
697 | - thumbnailgenerator.cpp \ |
698 | alarmrequest_p.cpp \ |
699 | ucstatesaver.cpp \ |
700 | sortbehavior.cpp \ |
701 | |
702 | === removed file 'modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp' |
703 | --- modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp 2014-05-27 14:07:00 +0000 |
704 | +++ modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp 1970-01-01 00:00:00 +0000 |
705 | @@ -1,87 +0,0 @@ |
706 | -/* |
707 | - * Copyright 2013 Canonical Ltd. |
708 | - * |
709 | - * This program is free software; you can redistribute it and/or modify |
710 | - * it under the terms of the GNU Lesser General Public License as published by |
711 | - * the Free Software Foundation; version 3. |
712 | - * |
713 | - * This program is distributed in the hope that it will be useful, |
714 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
715 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
716 | - * GNU Lesser General Public License for more details. |
717 | - * |
718 | - * You should have received a copy of the GNU Lesser General Public License |
719 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
720 | - * |
721 | - * Authors: Jussi Pakkanen <jussi.pakkanen@canonical.com> |
722 | -*/ |
723 | - |
724 | -#include "thumbnailgenerator.h" |
725 | -#include <stdexcept> |
726 | -#include <QDebug> |
727 | -#include <QMimeDatabase> |
728 | -#include <QUrl> |
729 | - |
730 | -const char *DEFAULT_VIDEO_ART = "/usr/share/unity/icons/video_missing.png"; |
731 | -const char *DEFAULT_ALBUM_ART = "/usr/share/unity/icons/album_missing.png"; |
732 | - |
733 | -ThumbnailGenerator::ThumbnailGenerator() : QQuickImageProvider(QQuickImageProvider::Image, |
734 | - QQmlImageProviderBase::ForceAsynchronousImageLoading) { |
735 | - |
736 | -} |
737 | - |
738 | -QImage ThumbnailGenerator::requestImage(const QString &id, QSize *realSize, |
739 | - const QSize &requestedSize) { |
740 | - /* Allow appending a query string (e.g. ?something=timestamp) |
741 | - * to the id and then ignore it. |
742 | - * This is workaround to force reloading a thumbnail when it has |
743 | - * the same file name on disk but we know the content has changed. |
744 | - * It is necessary because in such a situation the QML image cache |
745 | - * will kick in and this ImageProvider will never get called. |
746 | - * The only "solution" is setting Image.cache = false, but in some |
747 | - * cases we don't want to do that for performance reasons, so this |
748 | - * is the only way around the issue for now. */ |
749 | - std::string src_path(QUrl(id).path().toUtf8().data()); |
750 | - std::string tgt_path; |
751 | - const int xlarge_cutoff = 512; |
752 | - const int large_cutoff = 256; |
753 | - const int small_cutoff = 128; |
754 | - try { |
755 | - ThumbnailSize desiredSize; |
756 | - if(requestedSize.width() > xlarge_cutoff || requestedSize.height() > xlarge_cutoff) { |
757 | - desiredSize = TN_SIZE_ORIGINAL; |
758 | - } else if(requestedSize.width() > large_cutoff || requestedSize.height() > large_cutoff) { |
759 | - desiredSize = TN_SIZE_XLARGE; |
760 | - } else if(requestedSize.width() > small_cutoff || requestedSize.height() > small_cutoff) { |
761 | - desiredSize = TN_SIZE_LARGE; |
762 | - } else { |
763 | - desiredSize = TN_SIZE_SMALL; |
764 | - } |
765 | - tgt_path = tn.get_thumbnail(src_path, desiredSize); |
766 | - if(!tgt_path.empty()) { |
767 | - QString tgt(tgt_path.c_str()); |
768 | - QImage image; |
769 | - image.load(tgt); |
770 | - *realSize = image.size(); |
771 | - return image; |
772 | - } |
773 | - } catch(std::runtime_error &e) { |
774 | - qDebug() << "Thumbnail generator failed: " << e.what(); |
775 | - } |
776 | - return getFallbackImage(id, realSize, requestedSize); |
777 | -} |
778 | - |
779 | -QImage ThumbnailGenerator::getFallbackImage(const QString &id, QSize *size, |
780 | - const QSize &requestedSize) { |
781 | - Q_UNUSED(requestedSize); |
782 | - QMimeDatabase db; |
783 | - QMimeType mime = db.mimeTypeForFile(id); |
784 | - QImage result; |
785 | - if(mime.name().contains("audio")) { |
786 | - result.load(DEFAULT_ALBUM_ART); |
787 | - } else if(mime.name().contains("video")) { |
788 | - result.load(DEFAULT_VIDEO_ART); |
789 | - } |
790 | - *size = result.size(); |
791 | - return result; |
792 | -} |
793 | |
794 | === removed file 'modules/Ubuntu/Components/plugin/thumbnailgenerator.h' |
795 | --- modules/Ubuntu/Components/plugin/thumbnailgenerator.h 2013-10-10 10:56:22 +0000 |
796 | +++ modules/Ubuntu/Components/plugin/thumbnailgenerator.h 1970-01-01 00:00:00 +0000 |
797 | @@ -1,36 +0,0 @@ |
798 | -/* |
799 | - * Copyright 2013 Canonical Ltd. |
800 | - * |
801 | - * This program is free software; you can redistribute it and/or modify |
802 | - * it under the terms of the GNU Lesser General Public License as published by |
803 | - * the Free Software Foundation; version 3. |
804 | - * |
805 | - * This program is distributed in the hope that it will be useful, |
806 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
807 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
808 | - * GNU Lesser General Public License for more details. |
809 | - * |
810 | - * You should have received a copy of the GNU Lesser General Public License |
811 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
812 | - * |
813 | - * Authors: Jussi Pakkanen <jussi.pakkanen@canonical.com> |
814 | -*/ |
815 | - |
816 | -#ifndef THUMBNAIL_GENERATOR_H |
817 | -#define THUMBNAIL_GENERATOR_H |
818 | - |
819 | -#include <QQuickImageProvider> |
820 | -#include <thumbnailer.h> |
821 | - |
822 | -class ThumbnailGenerator: public QQuickImageProvider |
823 | -{ |
824 | -private: |
825 | - Thumbnailer tn; |
826 | - |
827 | -public: |
828 | - ThumbnailGenerator(); |
829 | - QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize); |
830 | - QImage getFallbackImage(const QString &id, QSize *size, const QSize &requestedSize); |
831 | -}; |
832 | - |
833 | -#endif |
834 | |
835 | === modified file 'modules/Ubuntu/Components/plugin/ucactioncontext.h' |
836 | --- modules/Ubuntu/Components/plugin/ucactioncontext.h 2014-09-16 07:49:07 +0000 |
837 | +++ modules/Ubuntu/Components/plugin/ucactioncontext.h 2014-10-16 21:17:25 +0000 |
838 | @@ -27,6 +27,7 @@ |
839 | class UCActionContext : public QObject, public QQmlParserStatus |
840 | { |
841 | Q_OBJECT |
842 | + Q_INTERFACES(QQmlParserStatus) |
843 | Q_PROPERTY(QQmlListProperty<QObject> actions READ actions) |
844 | Q_PROPERTY(bool active MEMBER m_active WRITE setActive NOTIFY activeChanged) |
845 | Q_CLASSINFO("DefaultProperty", "actions") |
846 | |
847 | === modified file 'modules/Ubuntu/Components/plugin/ucactionmanager.h' |
848 | --- modules/Ubuntu/Components/plugin/ucactionmanager.h 2014-09-16 07:49:07 +0000 |
849 | +++ modules/Ubuntu/Components/plugin/ucactionmanager.h 2014-10-16 21:17:25 +0000 |
850 | @@ -26,6 +26,7 @@ |
851 | class UCActionManager : public QObject, public QQmlParserStatus |
852 | { |
853 | Q_OBJECT |
854 | + Q_INTERFACES(QQmlParserStatus) |
855 | Q_PROPERTY(QQmlListProperty<QObject> actions READ actions) |
856 | Q_PROPERTY(QQmlListProperty<QObject> localContexts READ localContexts) |
857 | Q_PROPERTY(UCActionContext *globalContext READ globalContext CONSTANT) |
858 | |
859 | === modified file 'modules/Ubuntu/Components/plugin/ucscalingimageprovider.cpp' |
860 | --- modules/Ubuntu/Components/plugin/ucscalingimageprovider.cpp 2014-09-18 09:29:49 +0000 |
861 | +++ modules/Ubuntu/Components/plugin/ucscalingimageprovider.cpp 2014-10-16 21:17:25 +0000 |
862 | @@ -65,7 +65,7 @@ |
863 | } |
864 | } |
865 | |
866 | - if (constrainedSize.isValid()) { |
867 | + if (!constrainedSize.isEmpty()) { |
868 | imageReader.setScaledSize(constrainedSize); |
869 | } else if (scaledSize != realSize) { |
870 | imageReader.setScaledSize(scaledSize); |
871 | |
872 | === modified file 'modules/Ubuntu/PerformanceMetrics/plugin/rendertimer.cpp' |
873 | --- modules/Ubuntu/PerformanceMetrics/plugin/rendertimer.cpp 2014-02-11 17:40:02 +0000 |
874 | +++ modules/Ubuntu/PerformanceMetrics/plugin/rendertimer.cpp 2014-10-16 21:17:25 +0000 |
875 | @@ -20,14 +20,67 @@ |
876 | #include <QtGui/QOpenGLContext> |
877 | #include "rendertimer.h" |
878 | |
879 | +#if defined(QT_OPENGL_ES) |
880 | +#include <EGL/egl.h> |
881 | +#include <EGL/eglext.h> |
882 | +#endif |
883 | + |
884 | #if !defined(GL_TIME_ELAPSED) |
885 | #define GL_TIME_ELAPSED 0x88BF |
886 | #endif |
887 | |
888 | +class RenderTimerPrivate |
889 | +{ |
890 | +public: |
891 | + |
892 | + RenderTimerPrivate() : |
893 | + m_type(RenderTimer::Trivial) |
894 | + { } |
895 | + |
896 | + RenderTimer::TimerType m_type; |
897 | + QElapsedTimer m_trivialTimer; |
898 | + |
899 | +#if defined(QT_OPENGL_ES) |
900 | + struct { |
901 | + void (QOPENGLF_APIENTRYP genFencesNV)(GLsizei n, GLuint* fences); |
902 | + void (QOPENGLF_APIENTRYP deleteFencesNV)(GLsizei n, const GLuint* fences); |
903 | + void (QOPENGLF_APIENTRYP setFenceNV)(GLuint fence, GLenum condition); |
904 | + void (QOPENGLF_APIENTRYP finishFenceNV)(GLuint fence); |
905 | + } m_fenceNV; |
906 | + GLuint m_fence[2]; |
907 | + |
908 | + struct { |
909 | + EGLSyncKHR (QOPENGLF_APIENTRYP createSyncKHR)(EGLDisplay dpy, EGLenum type, |
910 | + const EGLint* attrib_list); |
911 | + EGLBoolean (QOPENGLF_APIENTRYP destroySyncKHR)(EGLDisplay dpy, EGLSyncKHR sync); |
912 | + EGLint (QOPENGLF_APIENTRYP clientWaitSyncKHR)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, |
913 | + EGLTimeKHR timeout); |
914 | + } m_fenceSyncKHR; |
915 | + EGLSyncKHR m_beforeSync; |
916 | +#else |
917 | + struct { |
918 | + void (QOPENGLF_APIENTRYP genQueries)(GLsizei n, GLuint* ids); |
919 | + void (QOPENGLF_APIENTRYP deleteQueries)(GLsizei n, const GLuint* ids); |
920 | + void (QOPENGLF_APIENTRYP beginQuery)(GLenum target, GLuint id); |
921 | + void (QOPENGLF_APIENTRYP endQuery)(GLenum target); |
922 | + void (QOPENGLF_APIENTRYP getQueryObjectui64v)(GLuint id, GLenum pname, GLuint64* params); |
923 | + void (QOPENGLF_APIENTRYP getQueryObjectui64vExt)(GLuint id, GLenum pname, GLuint64EXT* params); |
924 | + void (QOPENGLF_APIENTRYP queryCounter)(GLuint id, GLenum target); |
925 | + } m_timerQuery; |
926 | + enum { TimerQueryUnavailable, TimerQueryCore, TimerQueryExt } m_timerQueryVersion; |
927 | + GLuint m_timer[2]; |
928 | +#endif |
929 | +}; |
930 | + |
931 | RenderTimer::RenderTimer(QObject* parent) : |
932 | - QObject(parent), |
933 | - m_type(RenderTimer::Trivial) |
934 | -{ |
935 | + QObject(parent) |
936 | +{ |
937 | + d_ptr = new RenderTimerPrivate; |
938 | +} |
939 | + |
940 | +RenderTimer::~RenderTimer() |
941 | +{ |
942 | + delete d_ptr; |
943 | } |
944 | |
945 | bool RenderTimer::isAvailable(TimerType type) |
946 | @@ -89,132 +142,136 @@ |
947 | |
948 | void RenderTimer::setup(TimerType type) |
949 | { |
950 | + Q_D(RenderTimer); |
951 | if (type == RenderTimer::Automatic) { |
952 | type = RenderTimer::optimalTimerType(); |
953 | } |
954 | |
955 | - m_type = type; |
956 | + d->m_type = type; |
957 | |
958 | - if (m_type == RenderTimer::Trivial) { |
959 | + if (d->m_type == RenderTimer::Trivial) { |
960 | #if defined(QT_OPENGL_ES) |
961 | - } else if (m_type == RenderTimer::KHRFence) { |
962 | - m_fenceSyncKHR.createSyncKHR = reinterpret_cast< |
963 | + } else if (d->m_type == RenderTimer::KHRFence) { |
964 | + d->m_fenceSyncKHR.createSyncKHR = reinterpret_cast< |
965 | EGLSyncKHR (QOPENGLF_APIENTRYP)(EGLDisplay, EGLenum, const EGLint*)>( |
966 | eglGetProcAddress("eglCreateSyncKHR")); |
967 | - m_fenceSyncKHR.destroySyncKHR = reinterpret_cast< |
968 | + d->m_fenceSyncKHR.destroySyncKHR = reinterpret_cast< |
969 | EGLBoolean (QOPENGLF_APIENTRYP)(EGLDisplay, EGLSyncKHR)>( |
970 | eglGetProcAddress("eglDestroySyncKHR")); |
971 | - m_fenceSyncKHR.clientWaitSyncKHR = reinterpret_cast< |
972 | + d->m_fenceSyncKHR.clientWaitSyncKHR = reinterpret_cast< |
973 | EGLint (QOPENGLF_APIENTRYP)(EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR)>( |
974 | eglGetProcAddress("eglClientWaitSyncKHR")); |
975 | |
976 | - } else if (m_type == RenderTimer::NVFence) { |
977 | - m_fenceNV.genFencesNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, GLuint*)>( |
978 | + } else if (d->m_type == RenderTimer::NVFence) { |
979 | + d->m_fenceNV.genFencesNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, GLuint*)>( |
980 | eglGetProcAddress("glGenFencesNV")); |
981 | - m_fenceNV.deleteFencesNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, const GLuint*)>( |
982 | + d->m_fenceNV.deleteFencesNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, const GLuint*)>( |
983 | eglGetProcAddress("glDeleteFencesNV")); |
984 | - m_fenceNV.setFenceNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint, GLenum)>( |
985 | + d->m_fenceNV.setFenceNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint, GLenum)>( |
986 | eglGetProcAddress("glSetFenceNV")); |
987 | - m_fenceNV.finishFenceNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint)>( |
988 | + d->m_fenceNV.finishFenceNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint)>( |
989 | eglGetProcAddress("glFinishFenceNV")); |
990 | - m_fenceNV.genFencesNV(2, m_fence); |
991 | + d->m_fenceNV.genFencesNV(2, d->m_fence); |
992 | #else |
993 | - } else if (m_type == RenderTimer::ARBTimerQuery) { |
994 | + } else if (d->m_type == RenderTimer::ARBTimerQuery) { |
995 | QOpenGLContext* context = QOpenGLContext::currentContext(); |
996 | - m_timerQuery.genQueries = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, GLuint*)>( |
997 | + d->m_timerQuery.genQueries = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, GLuint*)>( |
998 | context->getProcAddress("glGenQueries")); |
999 | - m_timerQuery.deleteQueries = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, const GLuint*)>( |
1000 | + d->m_timerQuery.deleteQueries = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, const GLuint*)>( |
1001 | context->getProcAddress("glDeleteQueries")); |
1002 | - m_timerQuery.getQueryObjectui64v = |
1003 | + d->m_timerQuery.getQueryObjectui64v = |
1004 | reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint, GLenum, GLuint64*)>( |
1005 | context->getProcAddress("glGetQueryObjectui64v")); |
1006 | - m_timerQuery.queryCounter = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint, GLenum)>( |
1007 | + d->m_timerQuery.queryCounter = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint, GLenum)>( |
1008 | context->getProcAddress("glQueryCounter")); |
1009 | - m_timerQueryVersion = TimerQueryCore; |
1010 | - m_timerQuery.genQueries(2, m_timer); |
1011 | + d->m_timerQueryVersion = RenderTimerPrivate::TimerQueryCore; |
1012 | + d->m_timerQuery.genQueries(2, d->m_timer); |
1013 | |
1014 | - } else if (m_type == RenderTimer::EXTTimerQuery) { |
1015 | + } else if (d->m_type == RenderTimer::EXTTimerQuery) { |
1016 | QOpenGLContext* context = QOpenGLContext::currentContext(); |
1017 | - m_timerQuery.genQueries = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, GLuint*)>( |
1018 | + d->m_timerQuery.genQueries = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, GLuint*)>( |
1019 | context->getProcAddress("glGenQueries")); |
1020 | - m_timerQuery.deleteQueries = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, const GLuint*)>( |
1021 | + d->m_timerQuery.deleteQueries = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, const GLuint*)>( |
1022 | context->getProcAddress("glDeleteQueries")); |
1023 | - m_timerQuery.beginQuery = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLuint)>( |
1024 | + d->m_timerQuery.beginQuery = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLuint)>( |
1025 | context->getProcAddress("glBeginQuery")); |
1026 | - m_timerQuery.endQuery = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum)>( |
1027 | + d->m_timerQuery.endQuery = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum)>( |
1028 | context->getProcAddress("glEndQuery")); |
1029 | - m_timerQuery.getQueryObjectui64vExt = |
1030 | + d->m_timerQuery.getQueryObjectui64vExt = |
1031 | reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint, GLenum, GLuint64EXT*)>( |
1032 | context->getProcAddress("glGetQueryObjectui64vEXT")); |
1033 | - m_timerQueryVersion = TimerQueryExt; |
1034 | - m_timerQuery.genQueries(1, m_timer); |
1035 | + d->m_timerQueryVersion = RenderTimerPrivate::TimerQueryExt; |
1036 | + d->m_timerQuery.genQueries(1, d->m_timer); |
1037 | #endif |
1038 | } |
1039 | } |
1040 | |
1041 | void RenderTimer::teardown() |
1042 | { |
1043 | - teardown(m_type); |
1044 | + teardown(d_ptr->m_type); |
1045 | } |
1046 | |
1047 | void RenderTimer::teardown(TimerType type) |
1048 | { |
1049 | + Q_D(RenderTimer); |
1050 | if (type == RenderTimer::Trivial) { |
1051 | #if defined(QT_OPENGL_ES) |
1052 | } else if (type == RenderTimer::KHRFence) { |
1053 | - if (m_beforeSync != EGL_NO_SYNC_KHR) { |
1054 | - m_fenceSyncKHR.destroySyncKHR(eglGetCurrentDisplay(), m_beforeSync); |
1055 | + if (d->m_beforeSync != EGL_NO_SYNC_KHR) { |
1056 | + d->m_fenceSyncKHR.destroySyncKHR(eglGetCurrentDisplay(), d->m_beforeSync); |
1057 | } |
1058 | |
1059 | } else if (type == RenderTimer::NVFence) { |
1060 | - m_fenceNV.deleteFencesNV(2, m_fence); |
1061 | + d->m_fenceNV.deleteFencesNV(2, d->m_fence); |
1062 | #else |
1063 | } else if (type == RenderTimer::ARBTimerQuery) { |
1064 | - m_timerQuery.deleteQueries(2, m_timer); |
1065 | + d->m_timerQuery.deleteQueries(2, d->m_timer); |
1066 | |
1067 | } else if (type == RenderTimer::EXTTimerQuery) { |
1068 | - m_timerQuery.deleteQueries(1, m_timer); |
1069 | + d->m_timerQuery.deleteQueries(1, d->m_timer); |
1070 | #endif |
1071 | } |
1072 | } |
1073 | |
1074 | void RenderTimer::start() |
1075 | { |
1076 | - if (m_type == RenderTimer::Trivial) { |
1077 | - m_trivialTimer.start(); |
1078 | + Q_D(RenderTimer); |
1079 | + if (d->m_type == RenderTimer::Trivial) { |
1080 | + d-> m_trivialTimer.start(); |
1081 | #if defined(QT_OPENGL_ES) |
1082 | - } else if (m_type == RenderTimer::KHRFence) { |
1083 | - m_beforeSync = m_fenceSyncKHR.createSyncKHR(eglGetCurrentDisplay(), EGL_SYNC_FENCE_KHR, NULL); |
1084 | + } else if (d->m_type == RenderTimer::KHRFence) { |
1085 | + d->m_beforeSync = d->m_fenceSyncKHR.createSyncKHR(eglGetCurrentDisplay(), EGL_SYNC_FENCE_KHR, NULL); |
1086 | |
1087 | - } else if (m_type == RenderTimer::NVFence) { |
1088 | - m_fenceNV.setFenceNV(m_fence[0], GL_ALL_COMPLETED_NV); |
1089 | + } else if (d->m_type == RenderTimer::NVFence) { |
1090 | + d->m_fenceNV.setFenceNV(d->m_fence[0], GL_ALL_COMPLETED_NV); |
1091 | #else |
1092 | - } else if (m_type == RenderTimer::ARBTimerQuery) { |
1093 | - m_timerQuery.queryCounter(m_timer[0], GL_TIMESTAMP); |
1094 | + } else if (d->m_type == RenderTimer::ARBTimerQuery) { |
1095 | + d->m_timerQuery.queryCounter(d->m_timer[0], GL_TIMESTAMP); |
1096 | |
1097 | - } else if (m_type == RenderTimer::EXTTimerQuery) { |
1098 | - m_timerQuery.beginQuery(GL_TIME_ELAPSED, m_timer[0]); |
1099 | + } else if (d->m_type == RenderTimer::EXTTimerQuery) { |
1100 | + d->m_timerQuery.beginQuery(GL_TIME_ELAPSED, d->m_timer[0]); |
1101 | #endif |
1102 | } |
1103 | } |
1104 | |
1105 | qint64 RenderTimer::stop() |
1106 | { |
1107 | - if (m_type == RenderTimer::Trivial) { |
1108 | + Q_D(RenderTimer); |
1109 | + if (d->m_type == RenderTimer::Trivial) { |
1110 | glFinish(); |
1111 | - return m_trivialTimer.nsecsElapsed(); |
1112 | + return d-> m_trivialTimer.nsecsElapsed(); |
1113 | #if defined(QT_OPENGL_ES) |
1114 | - } else if (m_type == RenderTimer::KHRFence) { |
1115 | + } else if (d->m_type == RenderTimer::KHRFence) { |
1116 | QElapsedTimer timer; |
1117 | EGLDisplay dpy = eglGetCurrentDisplay(); |
1118 | - EGLSyncKHR afterSync = m_fenceSyncKHR.createSyncKHR(dpy, EGL_SYNC_FENCE_KHR, NULL); |
1119 | - EGLint beforeSyncValue = m_fenceSyncKHR.clientWaitSyncKHR(dpy, m_beforeSync, 0, EGL_FOREVER_KHR); |
1120 | + EGLSyncKHR afterSync = d->m_fenceSyncKHR.createSyncKHR(dpy, EGL_SYNC_FENCE_KHR, NULL); |
1121 | + EGLint beforeSyncValue = d->m_fenceSyncKHR.clientWaitSyncKHR(dpy, d->m_beforeSync, 0, EGL_FOREVER_KHR); |
1122 | qint64 beforeTime = timer.nsecsElapsed(); |
1123 | - EGLint afterSyncValue = m_fenceSyncKHR.clientWaitSyncKHR(dpy, afterSync, 0, EGL_FOREVER_KHR); |
1124 | + EGLint afterSyncValue = d->m_fenceSyncKHR.clientWaitSyncKHR(dpy, afterSync, 0, EGL_FOREVER_KHR); |
1125 | qint64 afterTime = timer.nsecsElapsed(); |
1126 | - m_fenceSyncKHR.destroySyncKHR(dpy, afterSync); |
1127 | - m_fenceSyncKHR.destroySyncKHR(dpy, m_beforeSync); |
1128 | - m_beforeSync = EGL_NO_SYNC_KHR; |
1129 | + d->m_fenceSyncKHR.destroySyncKHR(dpy, afterSync); |
1130 | + d->m_fenceSyncKHR.destroySyncKHR(dpy, d->m_beforeSync); |
1131 | + d->m_beforeSync = EGL_NO_SYNC_KHR; |
1132 | if (beforeSyncValue == EGL_CONDITION_SATISFIED_KHR |
1133 | && afterSyncValue == EGL_CONDITION_SATISFIED_KHR) { |
1134 | return afterTime - beforeTime; |
1135 | @@ -222,30 +279,30 @@ |
1136 | return -1; |
1137 | } |
1138 | |
1139 | - } else if (m_type == RenderTimer::NVFence) { |
1140 | + } else if (d->m_type == RenderTimer::NVFence) { |
1141 | QElapsedTimer timer; |
1142 | - m_fenceNV.setFenceNV(m_fence[1], GL_ALL_COMPLETED_NV); |
1143 | - m_fenceNV.finishFenceNV(m_fence[0]); |
1144 | + d->m_fenceNV.setFenceNV(d->m_fence[1], GL_ALL_COMPLETED_NV); |
1145 | + d->m_fenceNV.finishFenceNV(d->m_fence[0]); |
1146 | qint64 beforeTime = timer.nsecsElapsed(); |
1147 | - m_fenceNV.finishFenceNV(m_fence[1]); |
1148 | + d->m_fenceNV.finishFenceNV(d->m_fence[1]); |
1149 | qint64 afterTime = timer.nsecsElapsed(); |
1150 | return afterTime - beforeTime; |
1151 | #else |
1152 | - } else if (m_type == RenderTimer::ARBTimerQuery) { |
1153 | + } else if (d->m_type == RenderTimer::ARBTimerQuery) { |
1154 | GLuint64 time[2] = { 0, 0 }; |
1155 | - m_timerQuery.queryCounter(m_timer[1], GL_TIMESTAMP); |
1156 | - m_timerQuery.getQueryObjectui64v(m_timer[0], GL_QUERY_RESULT, &time[0]); |
1157 | - m_timerQuery.getQueryObjectui64v(m_timer[1], GL_QUERY_RESULT, &time[1]); |
1158 | + d->m_timerQuery.queryCounter(d->m_timer[1], GL_TIMESTAMP); |
1159 | + d->m_timerQuery.getQueryObjectui64v(d->m_timer[0], GL_QUERY_RESULT, &time[0]); |
1160 | + d->m_timerQuery.getQueryObjectui64v(d->m_timer[1], GL_QUERY_RESULT, &time[1]); |
1161 | if (time[0] != 0 && time[1] != 0) { |
1162 | return time[1] - time[0]; |
1163 | } else { |
1164 | return -1; |
1165 | } |
1166 | |
1167 | - } else if (m_type == RenderTimer::EXTTimerQuery) { |
1168 | + } else if (d->m_type == RenderTimer::EXTTimerQuery) { |
1169 | GLuint64EXT time; |
1170 | - m_timerQuery.endQuery(GL_TIME_ELAPSED); |
1171 | - m_timerQuery.getQueryObjectui64vExt(m_timer[0], GL_QUERY_RESULT, &time); |
1172 | + d->m_timerQuery.endQuery(GL_TIME_ELAPSED); |
1173 | + d->m_timerQuery.getQueryObjectui64vExt(d->m_timer[0], GL_QUERY_RESULT, &time); |
1174 | return static_cast<qint64>(time); |
1175 | #endif |
1176 | } |
1177 | |
1178 | === modified file 'modules/Ubuntu/PerformanceMetrics/plugin/rendertimer.h' |
1179 | --- modules/Ubuntu/PerformanceMetrics/plugin/rendertimer.h 2014-02-11 17:40:02 +0000 |
1180 | +++ modules/Ubuntu/PerformanceMetrics/plugin/rendertimer.h 2014-10-16 21:17:25 +0000 |
1181 | @@ -24,10 +24,7 @@ |
1182 | #include <QtCore/QElapsedTimer> |
1183 | #include <QtGui/qopenglfunctions.h> |
1184 | |
1185 | -#if defined(QT_OPENGL_ES) |
1186 | -#include <EGL/egl.h> |
1187 | -#include <EGL/eglext.h> |
1188 | -#endif |
1189 | +class RenderTimerPrivate; |
1190 | |
1191 | class RenderTimer : public QObject |
1192 | { |
1193 | @@ -49,6 +46,7 @@ |
1194 | }; |
1195 | |
1196 | explicit RenderTimer(QObject* parent = 0); |
1197 | + virtual ~RenderTimer(); |
1198 | |
1199 | static bool isAvailable(TimerType type); |
1200 | static TimerType optimalTimerType(); |
1201 | @@ -61,39 +59,8 @@ |
1202 | void teardown(TimerType type); |
1203 | |
1204 | private: |
1205 | - TimerType m_type; |
1206 | - QElapsedTimer m_trivialTimer; |
1207 | - |
1208 | -#if defined(QT_OPENGL_ES) |
1209 | - struct { |
1210 | - void (QOPENGLF_APIENTRYP genFencesNV)(GLsizei n, GLuint* fences); |
1211 | - void (QOPENGLF_APIENTRYP deleteFencesNV)(GLsizei n, const GLuint* fences); |
1212 | - void (QOPENGLF_APIENTRYP setFenceNV)(GLuint fence, GLenum condition); |
1213 | - void (QOPENGLF_APIENTRYP finishFenceNV)(GLuint fence); |
1214 | - } m_fenceNV; |
1215 | - GLuint m_fence[2]; |
1216 | - |
1217 | - struct { |
1218 | - EGLSyncKHR (QOPENGLF_APIENTRYP createSyncKHR)(EGLDisplay dpy, EGLenum type, |
1219 | - const EGLint* attrib_list); |
1220 | - EGLBoolean (QOPENGLF_APIENTRYP destroySyncKHR)(EGLDisplay dpy, EGLSyncKHR sync); |
1221 | - EGLint (QOPENGLF_APIENTRYP clientWaitSyncKHR)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, |
1222 | - EGLTimeKHR timeout); |
1223 | - } m_fenceSyncKHR; |
1224 | - EGLSyncKHR m_beforeSync; |
1225 | -#else |
1226 | - struct { |
1227 | - void (QOPENGLF_APIENTRYP genQueries)(GLsizei n, GLuint* ids); |
1228 | - void (QOPENGLF_APIENTRYP deleteQueries)(GLsizei n, const GLuint* ids); |
1229 | - void (QOPENGLF_APIENTRYP beginQuery)(GLenum target, GLuint id); |
1230 | - void (QOPENGLF_APIENTRYP endQuery)(GLenum target); |
1231 | - void (QOPENGLF_APIENTRYP getQueryObjectui64v)(GLuint id, GLenum pname, GLuint64* params); |
1232 | - void (QOPENGLF_APIENTRYP getQueryObjectui64vExt)(GLuint id, GLenum pname, GLuint64EXT* params); |
1233 | - void (QOPENGLF_APIENTRYP queryCounter)(GLuint id, GLenum target); |
1234 | - } m_timerQuery; |
1235 | - enum { TimerQueryUnavailable, TimerQueryCore, TimerQueryExt } m_timerQueryVersion; |
1236 | - GLuint m_timer[2]; |
1237 | -#endif |
1238 | + Q_DECLARE_PRIVATE(RenderTimer) |
1239 | + RenderTimerPrivate *d_ptr; |
1240 | }; |
1241 | |
1242 | #endif // RENDERTIMER_H |
1243 | |
1244 | === modified file 'modules/Ubuntu/Test/UbuntuTestCase.qml' |
1245 | --- modules/Ubuntu/Test/UbuntuTestCase.qml 2014-07-15 11:40:02 +0000 |
1246 | +++ modules/Ubuntu/Test/UbuntuTestCase.qml 2014-10-16 21:17:25 +0000 |
1247 | @@ -101,28 +101,29 @@ |
1248 | return center; |
1249 | } |
1250 | |
1251 | - |
1252 | - |
1253 | - /*! |
1254 | - Move Mouse from x,y to distance of dx, dy divided to steps with a stepdelay (ms). |
1255 | - */ |
1256 | - function mouseMoveSlowly(item,x,y,dx,dy,steps,stepdelay) { |
1257 | - mouseMove(item,x,y); |
1258 | - var step_dx = dx/steps; |
1259 | - var step_dy = dy/steps; |
1260 | - |
1261 | - var ix = 0; |
1262 | - var iy = 0; |
1263 | - for (var step=0; step<steps; step++) { |
1264 | - if (ix<dx) { |
1265 | - ix += step_dx; |
1266 | - } |
1267 | - if (iy<dx) { |
1268 | - iy += step_dy; |
1269 | - } |
1270 | - mouseMove(item,x + ix,y + iy,stepdelay); |
1271 | - } |
1272 | - } |
1273 | + /*! |
1274 | + Move Mouse from x,y to distance of dx, dy divided to steps with a stepdelay (ms). |
1275 | + */ |
1276 | + function mouseMoveSlowly(item,x,y,dx,dy,steps,stepdelay) { |
1277 | + mouseMove(item, x, y); |
1278 | + var abs_dx = Math.abs(dx) |
1279 | + var abs_dy = Math.abs(dy) |
1280 | + var step_dx = dx / steps; |
1281 | + var step_dy = dy /steps; |
1282 | + |
1283 | + var ix = 0; |
1284 | + var iy = 0; |
1285 | + |
1286 | + for (var step=0; step < steps; step++) { |
1287 | + if (ix < abs_dx) { |
1288 | + ix += step_dx; |
1289 | + } |
1290 | + if (iy < abs_dy) { |
1291 | + iy += step_dy; |
1292 | + } |
1293 | + mouseMove(item, x + ix, y + iy, stepdelay); |
1294 | + } |
1295 | + } |
1296 | |
1297 | /*! |
1298 | \qmlmethod UbuntuTestCase::flick(item, x, y, dx, dy, pressTimeout = -1, steps = -1, button = Qt.LeftButton, modifiers = Qt.NoModifiers, delay = -1) |
1299 | |
1300 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_popover.py' |
1301 | --- tests/autopilot/ubuntuuitoolkit/tests/components/test_popover.py 1970-01-01 00:00:00 +0000 |
1302 | +++ tests/autopilot/ubuntuuitoolkit/tests/components/test_popover.py 2014-10-16 21:17:25 +0000 |
1303 | @@ -0,0 +1,51 @@ |
1304 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1305 | +# |
1306 | +# Copyright (C) 2014 Canonical Ltd. |
1307 | +# |
1308 | +# This program is free software; you can redistribute it and/or modify |
1309 | +# it under the terms of the GNU Lesser General Public License as published by |
1310 | +# the Free Software Foundation; version 3. |
1311 | +# |
1312 | +# This program is distributed in the hope that it will be useful, |
1313 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1314 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1315 | +# GNU Lesser General Public License for more details. |
1316 | +# |
1317 | +# You should have received a copy of the GNU Lesser General Public License |
1318 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1319 | + |
1320 | +"""Tests for the Ubuntu UI Toolkit Header component.""" |
1321 | + |
1322 | +import os |
1323 | + |
1324 | +from ubuntuuitoolkit import tests |
1325 | + |
1326 | + |
1327 | +class DialogScrollTestCase(tests.QMLFileAppTestCase): |
1328 | + |
1329 | + path = os.path.abspath(__file__) |
1330 | + dir_path = os.path.dirname(path) |
1331 | + test_qml_file_path = os.path.join( |
1332 | + dir_path, 'test_popover.qml') |
1333 | + |
1334 | + def setUp(self): |
1335 | + super(DialogScrollTestCase, self).setUp() |
1336 | + |
1337 | + def test_dialog_small(self): |
1338 | + button = self.main_view.select_single(objectName='button_small') |
1339 | + self.pointing_device.click_object(button) |
1340 | + dialog = self.main_view.select_single(objectName='dialog_small') |
1341 | + flickable = dialog.select_single('QQuickFlickable') |
1342 | + # There's nothing to reveal |
1343 | + self.assertTrue(flickable.atYEnd) |
1344 | + |
1345 | + def test_dialog_scrollable(self): |
1346 | + button = self.main_view.select_single(objectName='button_huge') |
1347 | + self.pointing_device.click_object(button) |
1348 | + dialog = self.main_view.select_single(objectName='dialog_huge') |
1349 | + flickable = dialog.select_single('QQuickFlickable') |
1350 | + buttlet = dialog.select_single(objectName='buttlet49') |
1351 | + # We can scroll |
1352 | + self.assertFalse(flickable.atYEnd) |
1353 | + flickable.swipe_child_into_view(buttlet) |
1354 | + self.assertEqual(flickable.is_child_visible(buttlet), True) |
1355 | |
1356 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_popover.qml' |
1357 | --- tests/autopilot/ubuntuuitoolkit/tests/components/test_popover.qml 1970-01-01 00:00:00 +0000 |
1358 | +++ tests/autopilot/ubuntuuitoolkit/tests/components/test_popover.qml 2014-10-16 21:17:25 +0000 |
1359 | @@ -0,0 +1,70 @@ |
1360 | +/* |
1361 | + * Copyright 2014 Canonical Ltd. |
1362 | + * |
1363 | + * This program is free software; you can redistribute it and/or modify |
1364 | + * it under the terms of the GNU Lesser General Public License as published by |
1365 | + * the Free Software Foundation; version 3. |
1366 | + * |
1367 | + * This program is distributed in the hope that it will be useful, |
1368 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1369 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1370 | + * GNU Lesser General Public License for more details. |
1371 | + * |
1372 | + * You should have received a copy of the GNU Lesser General Public License |
1373 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1374 | + */ |
1375 | + |
1376 | +import QtQuick 2.0 |
1377 | +import Ubuntu.Components 1.1 |
1378 | +import Ubuntu.Components.Popups 1.0 |
1379 | + |
1380 | +MainView { |
1381 | + width: units.gu(48) |
1382 | + height: units.gu(60) |
1383 | + |
1384 | + Page { |
1385 | + title: "Popover" |
1386 | + |
1387 | + Column { |
1388 | + Button { |
1389 | + objectName: "button_small" |
1390 | + text: "Small" |
1391 | + onClicked: PopupUtils.open(smallDialogComponent) |
1392 | + } |
1393 | + Button { |
1394 | + objectName: "button_huge" |
1395 | + text: "Huge" |
1396 | + onClicked: PopupUtils.open(hugeDialogComponent) |
1397 | + } |
1398 | + } |
1399 | + |
1400 | + Component { |
1401 | + id: smallDialogComponent |
1402 | + Dialog { |
1403 | + objectName: "dialog_small" |
1404 | + Column { |
1405 | + Button { |
1406 | + text: "Just a button" |
1407 | + } |
1408 | + } |
1409 | + } |
1410 | + } |
1411 | + |
1412 | + Component { |
1413 | + id: hugeDialogComponent |
1414 | + Dialog { |
1415 | + objectName: "dialog_huge" |
1416 | + Column { |
1417 | + Repeater { |
1418 | + model: 50 |
1419 | + |
1420 | + Button { |
1421 | + objectName: "buttlet%1".arg(index) |
1422 | + text: "Button %1".arg(index) |
1423 | + } |
1424 | + } |
1425 | + } |
1426 | + } |
1427 | + } |
1428 | + } |
1429 | +} |
1430 | |
1431 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py' |
1432 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py 2014-07-18 20:09:22 +0000 |
1433 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py 2014-10-16 21:17:25 +0000 |
1434 | @@ -36,16 +36,6 @@ |
1435 | id: datePicker |
1436 | objectName: 'datePicker' |
1437 | mode: 'Years|Months|Days' |
1438 | - maximum: { |
1439 | - var d = new Date() |
1440 | - d.setFullYear('2030') |
1441 | - return d |
1442 | - } |
1443 | - minimum: { |
1444 | - var d = new Date() |
1445 | - d.setFullYear('1990') |
1446 | - return d |
1447 | - } |
1448 | date: { |
1449 | var d = new Date() |
1450 | d.setFullYear('2010') |
1451 | @@ -58,16 +48,6 @@ |
1452 | id: timePicker |
1453 | objectName: 'timePicker' |
1454 | mode: 'Hours|Minutes|Seconds' |
1455 | - maximum: { |
1456 | - var d = new Date() |
1457 | - d.setFullYear('2030') |
1458 | - return d |
1459 | - } |
1460 | - minimum: { |
1461 | - var d = new Date() |
1462 | - d.setFullYear('1990') |
1463 | - return d |
1464 | - } |
1465 | date: { |
1466 | var d = new Date() |
1467 | d.setHours(12) |
1468 | @@ -87,6 +67,65 @@ |
1469 | self.time_picker = self.main_view.select_single( |
1470 | pickers.DatePicker, objectName='timePicker') |
1471 | |
1472 | +class DatePickerBaseTestCaseWithMinMax(DatePickerBaseTestCase): |
1473 | + |
1474 | + test_qml = (""" |
1475 | +import QtQuick 2.0 |
1476 | +import Ubuntu.Components 1.1 |
1477 | +import Ubuntu.Components.Pickers 1.0 |
1478 | + |
1479 | +MainView { |
1480 | + width: units.gu(48) |
1481 | + height: units.gu(60) |
1482 | + |
1483 | + Column { |
1484 | + DatePicker { |
1485 | + id: datePicker |
1486 | + objectName: 'datePicker' |
1487 | + mode: 'Years|Months|Days' |
1488 | + maximum: { |
1489 | + var d = new Date() |
1490 | + d.setFullYear('2030') |
1491 | + return d |
1492 | + } |
1493 | + minimum: { |
1494 | + var d = new Date() |
1495 | + d.setFullYear('1990') |
1496 | + return d |
1497 | + } |
1498 | + date: { |
1499 | + var d = new Date() |
1500 | + d.setFullYear('2010') |
1501 | + d.setMonth('5') |
1502 | + d.setDate('15') |
1503 | + return d |
1504 | + } |
1505 | + } |
1506 | + DatePicker { |
1507 | + id: timePicker |
1508 | + objectName: 'timePicker' |
1509 | + mode: 'Hours|Minutes|Seconds' |
1510 | + maximum: { |
1511 | + var d = new Date() |
1512 | + d.setFullYear('2030') |
1513 | + return d |
1514 | + } |
1515 | + minimum: { |
1516 | + var d = new Date() |
1517 | + d.setFullYear('1990') |
1518 | + return d |
1519 | + } |
1520 | + date: { |
1521 | + var d = new Date() |
1522 | + d.setHours(12) |
1523 | + d.setMinutes('30') |
1524 | + d.setSeconds('30') |
1525 | + return d |
1526 | + } |
1527 | + } |
1528 | + } |
1529 | +} |
1530 | +""") |
1531 | |
1532 | class DatePickerTestCase(DatePickerBaseTestCase): |
1533 | |
1534 | @@ -217,3 +256,12 @@ |
1535 | def test_pick_time(self): |
1536 | self.time_picker.pick_time(self.time_to_pick) |
1537 | self.assertEqual(self.time_picker.get_time(), self.time_to_pick) |
1538 | + |
1539 | +class DatePickerTestCaseWithMinMax(DatePickerTestCase): |
1540 | + """Repeat tests with min/max qml""" |
1541 | + |
1542 | +class PickDateFromDatePickerTestCaseWithMinMax(PickDateFromDatePickerTestCase): |
1543 | + """Repeat tests with min/max qml""" |
1544 | + |
1545 | +class PickTimeFromDatePickerTestCaseWithMinMax(PickTimeFromDatePickerTestCase): |
1546 | + """Repeat tests with min/max qml""" |
1547 | |
1548 | === modified file 'tests/qmlapicheck.py' |
1549 | --- tests/qmlapicheck.py 2014-09-03 10:24:54 +0000 |
1550 | +++ tests/qmlapicheck.py 2014-10-16 21:17:25 +0000 |
1551 | @@ -84,6 +84,8 @@ |
1552 | def skipversion(filename): |
1553 | for v in ['10', '11']: |
1554 | filename = filename.replace(v + '/', '') |
1555 | + if filename[-8:] == 'qmltypes': |
1556 | + filename = os.path.basename(filename) |
1557 | return filename |
1558 | inputfiles.sort(key=skipversion) |
1559 | |
1560 | @@ -110,7 +112,7 @@ |
1561 | if fileinput.filename() in classes: |
1562 | classname = ' '.join(classes[fileinput.filename()]) |
1563 | else: |
1564 | - classname = fileinput.filename() |
1565 | + classname = os.path.basename(fileinput.filename()) |
1566 | print(classname) |
1567 | |
1568 | line = line.split('//')[0] |
1569 | |
1570 | === modified file 'tests/qmlapicheck.sh' |
1571 | --- tests/qmlapicheck.sh 2014-09-05 05:49:46 +0000 |
1572 | +++ tests/qmlapicheck.sh 2014-10-16 21:17:25 +0000 |
1573 | @@ -1,4 +1,4 @@ |
1574 | -#!/usr/bin/env sh |
1575 | +#!/usr/bin/env bash |
1576 | # |
1577 | # Copyright 2013 Canonical Ltd. |
1578 | # |
1579 | @@ -15,28 +15,37 @@ |
1580 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1581 | # |
1582 | ################################################################################ |
1583 | +BLDDIR=$1 |
1584 | +if [ -z "$BLDDIR" ]; then |
1585 | + echo "Usage: " $(basename $0) "BUILDFOLDER" |
1586 | + exit 1 |
1587 | +fi |
1588 | + |
1589 | QML="modules/Ubuntu/*/qmldir modules/Ubuntu/Components/*/qmldir" |
1590 | CPP="Ubuntu.Components Ubuntu.Layouts Ubuntu.PerformanceMetrics Ubuntu.Test" |
1591 | |
1592 | echo Dumping QML API of C++ components |
1593 | -echo '' > plugins.qmltypes |
1594 | +echo '' > $BLDDIR/plugins.qmltypes |
1595 | ERRORS=0 |
1596 | for i in $CPP; do |
1597 | # Silence spam on stderr due to fonts |
1598 | # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999 |
1599 | # https://bugreports.qt-project.org/browse/QTBUG-36243 |
1600 | - ALARM_BACKEND=memory qmlplugindump $i 0.1 modules 1>> plugins.qmltypes |
1601 | + modulePath=${i//./\/} |
1602 | + pushd "$BLDDIR/../modules/${modulePath}" |
1603 | + ALARM_BACKEND=memory qmlplugindump $i 0.1 ../../ 1>> $BLDDIR/plugins.qmltypes |
1604 | test $? != 0 && ERRORS=1 |
1605 | + popd |
1606 | done |
1607 | test $ERRORS = 1 && echo Error: qmlplugindump failed && exit 1 |
1608 | |
1609 | echo Running QML API check for $QML |
1610 | # Palette and UbuntuColors gets included in Qt > 5.2 qmlplugindump even though it's qml |
1611 | -BUILTINS=QQuick,QQml,U1db::,Palette,UbuntuColors python3 tests/qmlapicheck.py $QML plugins.qmltypes > components.api.new |
1612 | +BUILTINS=QQuick,QQml,U1db::,Palette,UbuntuColors python3 tests/qmlapicheck.py $QML $BLDDIR/plugins.qmltypes > $BLDDIR/components.api.new |
1613 | test $? != 0 && echo Error: qmlapicheck.py failed && exit 1 |
1614 | |
1615 | echo Verifying the diff between existing and generated API |
1616 | -diff -Fqml -u components.api components.api.new |
1617 | +diff -Fqml -u components.api $BLDDIR/components.api.new |
1618 | test $? != 0 && ERRORS=1 |
1619 | |
1620 | if [ "x$ERRORS" != "x1" ]; then |
1621 | |
1622 | === modified file 'tests/uitk_test_plan.sh' |
1623 | --- tests/uitk_test_plan.sh 2014-09-22 09:45:35 +0000 |
1624 | +++ tests/uitk_test_plan.sh 2014-10-16 21:17:25 +0000 |
1625 | @@ -29,40 +29,38 @@ |
1626 | DISTRO="ubuntu-rtm" |
1627 | SERIES="14.09" |
1628 | CHANNEL="ubuntu-touch/${DISTRO}/${SERIES}-proposed" |
1629 | -PWD="0000" |
1630 | -BOOTTIME=300 |
1631 | +PASSWORD="0000" |
1632 | +BOOTTIME=500 |
1633 | +ONLYCOMPARE=false |
1634 | |
1635 | declare -a TEST_SUITE=( |
1636 | - " -p dialer-app-autopilot dialer_app" |
1637 | + " -p ubuntu-ui-toolkit-autopilot ubuntuuitoolkit" |
1638 | + " -p webbrowser-app-autopilot webbrowser_app" |
1639 | + " -p address-book-app-autopilot address_book_app" |
1640 | + " sudoku_app" |
1641 | + " online_accounts_ui" |
1642 | + " ubuntu_calculator_app" |
1643 | " -p messaging-app-autopilot messaging_app" |
1644 | - " -p reminders-app-autopilot reminders" |
1645 | - " -p ubuntu-system-settings-autopilot ubuntu_system_settings" |
1646 | - " -p ubuntu-html5-ui-toolkit-autopilot ubuntu_html5_ui_toolkit" |
1647 | - " -p unity-webapps-qml-autopilot unity_webapps_qml" |
1648 | - " -p address-book-app-autopilot address_book_app" |
1649 | + " -p mediaplayer-app-autopilot mediaplayer_app" |
1650 | " dropping_letters_app" |
1651 | - " sudoku_app" |
1652 | - " -p ubuntu-ui-toolkit-autopilot ubuntuuitoolkit" |
1653 | - " -p webbrowser-app-autopilot webbrowser_app" |
1654 | + " -p dialer-app-autopilot dialer_app" |
1655 | +#hangs " -p reminders-app-autopilot reminders" |
1656 | " shorts_app" |
1657 | " ubuntu_weather_app" |
1658 | - " online_accounts_ui" |
1659 | + " -p ubuntu-system-settings-autopilot ubuntu_system_settings" |
1660 | + " music_app" |
1661 | + " gallery_app" |
1662 | " filemanager" |
1663 | - " calendar_app" |
1664 | - " music_app" |
1665 | - " -p mediaplayer-app-autopilot mediaplayer_app" |
1666 | " ubuntu_terminal_app" |
1667 | + " -n unity8" |
1668 | " ubuntu_clock_app" |
1669 | - " ubuntu_calculator_app" |
1670 | - " gallery_app" |
1671 | -# " -n unity8" |
1672 | -# " -p camera-app-autopilot camera_app" |
1673 | ) |
1674 | |
1675 | |
1676 | UITK_PACKAGES="qtdeclarative5-ubuntu-ui-toolkit-plugin \ |
1677 | ubuntu-ui-toolkit-autopilot \ |
1678 | - ubuntu-ui-toolkit-theme" |
1679 | + ubuntu-ui-toolkit-theme \ |
1680 | + qtorganizer5-eds" |
1681 | |
1682 | AP_PACKAGES="address-book-service-dummy \ |
1683 | python3-lxml \ |
1684 | @@ -86,11 +84,18 @@ |
1685 | i=1 |
1686 | while [ $(adb get-state -s ${SERIALNUMBER}) == "unknown" ] |
1687 | do |
1688 | - echo -ne "Wait: $i seconds\r" |
1689 | + echo -ne "Wait for adb: $i seconds\r" |
1690 | sleep 1 |
1691 | i=$[$i+1] |
1692 | done |
1693 | echo -ne '\n' |
1694 | + until pids=$(adb -s ${SERIALNUMBER} shell pidof unity-system-compositor|egrep -v "^$|initctl:"); |
1695 | + do |
1696 | + echo -ne "Wait for compositor: $i seconds\r" |
1697 | + sleep 1; |
1698 | + i=$[$i+1] |
1699 | + done; |
1700 | + echo -ne '\n' |
1701 | return |
1702 | fi |
1703 | SLEEP=$1 |
1704 | @@ -113,7 +118,7 @@ |
1705 | |
1706 | function reset { |
1707 | if [ ${RESET} == true -o x"$1" == x-f ]; then |
1708 | - adb -s ${SERIALNUMBER} shell "echo 0000|sudo -S reboot 2>&1|grep -v password" |
1709 | + adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S reboot 2>&1|grep -v password" |
1710 | sleep_indicator 120 |
1711 | /usr/share/qtcreator/ubuntu/scripts/device_wait_for_shell ${SERIALNUMBER} > /dev/null |
1712 | sleep_indicator 10 |
1713 | @@ -122,10 +127,9 @@ |
1714 | adb -s ${SERIALNUMBER} shell powerd-cli display on |egrep -v "Display State requested, cookie is|Press ctrl-c to exit|not fully supported." & |
1715 | adb -s ${SERIALNUMBER} shell powerd-cli active |egrep -v "requested, cookie is|Press ctrl-c to exit|not fully supported." & |
1716 | sleep_indicator 10 |
1717 | - adb -s ${SERIALNUMBER} shell "sudo -u phablet -i gdbus call --session --dest com.canonical.UnityGreeter \ |
1718 | - --object-path / \ |
1719 | - --method com.canonical.UnityGreeter.HideGreeter|grep -v '\(\)'" |
1720 | - adb -s ${SERIALNUMBER} shell "echo 0000|sudo -S dbus-send --system --print-reply \ |
1721 | + adb -s ${SERIALNUMBER} shell amixer -D pulse set Master 1+ mute 2>&1 > /dev/null |
1722 | + adb -s ${SERIALNUMBER} shell "gdbus call --session --dest com.canonical.UnityGreeter --object-path / --method com.canonical.UnityGreeter.HideGreeter|grep -v '\(\)'" |
1723 | + adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S dbus-send --system --print-reply \ |
1724 | --dest=org.freedesktop.Accounts \ |
1725 | /org/freedesktop/Accounts/User32011 \ |
1726 | org.freedesktop.DBus.Properties.Set \ |
1727 | @@ -137,10 +141,10 @@ |
1728 | function device_comission { |
1729 | adb -s ${SERIALNUMBER} wait-for-device |
1730 | # Avoid https://bugs.launchpad.net/gallery-app/+bug/1363190 |
1731 | - adb -s ${SERIALNUMBER} shell "echo 0000 |sudo -S rm -rf /userdata/user-data/phablet/.cache/com.ubuntu.gallery 2>&1|grep -v password" |
1732 | + adb -s ${SERIALNUMBER} shell "echo ${PASSWORD} |sudo -S rm -rf /userdata/user-data/phablet/.cache/com.ubuntu.gallery 2>&1|grep -v password" |
1733 | # flash the latest image |
1734 | echo -e "Flashing \e[31m${CHANNEL}\e[0m" |
1735 | - ubuntu-device-flash --serial=${SERIALNUMBER} --channel=${CHANNEL} --wipe --developer-mode --password=0000 |
1736 | + ubuntu-device-flash --serial=${SERIALNUMBER} --channel=${CHANNEL} --wipe --developer-mode --password=${PASSWORD} |
1737 | sleep_indicator ${BOOTTIME} |
1738 | echo -e "Disable the intro wizard" |
1739 | phablet-config -s ${SERIALNUMBER} welcome-wizard --disable |
1740 | @@ -148,31 +152,33 @@ |
1741 | phablet-config -s ${SERIALNUMBER} edges-intro --disable |
1742 | echo -e "Clone the network " |
1743 | network |
1744 | - adb -s ${SERIALNUMBER} shell "echo 0000|sudo -S reboot 2>&1|grep -v password" |
1745 | + adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S reboot 2>&1|grep -v password" |
1746 | sleep_indicator 120 |
1747 | echo -e "phablet-click-test-setup \e[31m${DISTRO} ${SERIES}\e[0m" |
1748 | phablet-click-test-setup -s ${SERIALNUMBER} --distribution=${DISTRO} --series=${SERIES} 2>&1 |
1749 | - echo "Sleep after phablet-click-test-setup";sleep_indicator 120 |
1750 | + echo "Sleep after phablet-click-test-setup"; |
1751 | + sleep_indicator 120 |
1752 | if [ ${PPA} == "archive" ]; then |
1753 | echo "Set up with the archive image" |
1754 | - phablet-config -s ${SERIALNUMBER} writable-image -r 0000 2>&1 > /dev/null |
1755 | - echo "Sleep after phablet-config";sleep_indicator 120 |
1756 | + phablet-config -s ${SERIALNUMBER} writable-image -r ${PASSWORD} 2>&1 > /dev/null |
1757 | + echo "Sleep after phablet-config"; |
1758 | + sleep_indicator 120 |
1759 | network |
1760 | else |
1761 | if [[ "$PPA" =~ ^[0-9]{3}$ ]]; then |
1762 | echo -e "Set up with the silo \e[31m${PPA}\e[0m" |
1763 | - phablet-config -s ${SERIALNUMBER} writable-image -r 0000 2>&1 > /dev/null |
1764 | + phablet-config -s ${SERIALNUMBER} writable-image -r ${PASSWORD} 2>&1 > /dev/null |
1765 | sleep_indicator 120 |
1766 | network |
1767 | - adb -s ${SERIALNUMBER} shell "echo 0000|sudo -S bash -c 'echo \"deb http://ppa.launchpad.net/ci-train-ppa-service/landing-${PPA}/${DISTRO} ${SERIES} main\" > /etc/apt/sources.list.d/silo-${PPA}.list'" |
1768 | - adb -s ${SERIALNUMBER} shell "echo 0000|sudo -S apt-get update 2>&1|grep -v password > /dev/null" |
1769 | + adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S bash -c 'echo \"deb http://ppa.launchpad.net/ci-train-ppa-service/landing-${PPA}/${DISTRO} ${SERIES} main\" > /etc/apt/sources.list.d/silo-${PPA}.list'" |
1770 | + adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S apt-get update 2>&1|grep -v password > /dev/null" |
1771 | else |
1772 | echo -e "Set up with the PPA \e[31m${PPA}\e[0m" |
1773 | - phablet-config -s ${SERIALNUMBER} writable-image -r 0000 2>&1 > /dev/null |
1774 | + phablet-config -s ${SERIALNUMBER} writable-image -r ${PASSWORD} 2>&1 > /dev/null |
1775 | sleep_indicator 120 |
1776 | network |
1777 | - adb -s ${SERIALNUMBER} shell "echo 0000|sudo -S bash -c 'echo \"deb http://ppa.launchpad.net/${PPA}/${DISTRO} ${SERIES} main\" > /etc/apt/sources.list.d/testing-ppa.list'" |
1778 | - adb -s ${SERIALNUMBER} shell "echo 0000|sudo -S apt-get update 2>&1|grep -v password > /dev/null" |
1779 | + adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S bash -c 'echo \"deb http://ppa.launchpad.net/${PPA}/${DISTRO} ${SERIES} main\" > /etc/apt/sources.list.d/testing-ppa.list'" |
1780 | + adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S apt-get update 2>&1|grep -v password > /dev/null" |
1781 | |
1782 | fi |
1783 | fi |
1784 | @@ -180,15 +186,38 @@ |
1785 | UITK_VERSION=`adb -s ${SERIALNUMBER} shell "stty cols 250; dpkg -l"|grep qtdeclarative5-ubuntu-ui-toolkit-plugin|awk '{print $3}'` |
1786 | echo -e "Original UITK version:\t\e[31m${UITK_VERSION}\e[0m" |
1787 | echo "Updating APT"; |
1788 | - adb -s ${SERIALNUMBER} shell "echo 0000 |sudo -S apt-get update 2>&1|grep -v password > /dev/null" |
1789 | + adb -s ${SERIALNUMBER} shell "echo ${PASSWORD} |sudo -S apt-get update 2>&1|grep -v password > /dev/null" |
1790 | echo "Install the UITK packages" |
1791 | - adb -s ${SERIALNUMBER} shell "echo 0000|sudo -S apt-get install --yes --force-yes ${UITK_PACKAGES} 2>&1 |grep -v password > /dev/null" |
1792 | + adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S apt-get install --yes --force-yes ${UITK_PACKAGES} 2>&1 |grep -v password > /dev/null" |
1793 | UITK_VERSION=`adb -s ${SERIALNUMBER} shell "stty cols 250; dpkg -l"|grep qtdeclarative5-ubuntu-ui-toolkit-plugin|awk '{print $3}'` |
1794 | echo -e "New UITK version:\t\e[31m${UITK_VERSION}\e[0m" |
1795 | # Update APT |
1796 | - adb -s ${SERIALNUMBER} shell "echo 0000 |sudo -S apt-get update 2>&1|grep -v password > /dev/null" |
1797 | + adb -s ${SERIALNUMBER} shell "echo ${PASSWORD} |sudo -S apt-get update 2>&1|grep -v password > /dev/null" |
1798 | # Install the autopilot tests for the apps |
1799 | - adb -s ${SERIALNUMBER} shell "echo 0000 |sudo -S apt-get install --yes --force-yes ${AP_PACKAGES} 2>&1 | grep -v password > /dev/null" |
1800 | + adb -s ${SERIALNUMBER} shell "echo ${PASSWORD} |sudo -S apt-get install --yes --force-yes ${AP_PACKAGES} 2>&1 | grep -v password > /dev/null" |
1801 | +} |
1802 | + |
1803 | +function compare_results { |
1804 | + sed -i 's/\r//g' *tests |
1805 | + for RESULT_FILE in *${PPA}.tests; |
1806 | + do |
1807 | + echo "$RESULT_FILE"; |
1808 | + LAST_LINE=`tail -1 $RESULT_FILE` |
1809 | + if [[ "$LAST_LINE" =~ OK || "$LAST_LINE" =~ FAILED ]]; then |
1810 | + echo -e "\t"`tail -2 $RESULT_FILE` |
1811 | + else |
1812 | + echo -e "\t\e[31mBroken tests\e[0m" |
1813 | + fi |
1814 | + egrep -v "NO TAGS DATABASE" $RESULT_FILE |egrep "^ERROR:|^FAIL:" | while read -r FAILED ; |
1815 | + do |
1816 | + echo -e "\tFailed with ${PPA} - $FAILED" |
1817 | + if grep --quiet "$FAILED" *archive.tests; then |
1818 | + echo -e "\tSame on archive" |
1819 | + else |
1820 | + echo -e "\t\e[31mPossible regression\e[0m" |
1821 | + fi |
1822 | + done |
1823 | + done |
1824 | } |
1825 | |
1826 | while getopts ":hrcintdus:o:p:f:" opt; do |
1827 | @@ -216,6 +245,9 @@ |
1828 | c) |
1829 | COMISSION=true |
1830 | ;; |
1831 | + d) |
1832 | + ONLYCOMPARE=true |
1833 | + ;; |
1834 | n) |
1835 | DONOTRUNTESTS=true |
1836 | ;; |
1837 | @@ -227,15 +259,46 @@ |
1838 | ;; |
1839 | h) |
1840 | echo "Usage: uitk_test_plan.sh -s [serial number] -m -c" |
1841 | - echo " -r : Reset after each tests. Default: ${RESET}" |
1842 | - echo " -s : Use the device with the given serial number. Default: ${SERIALNUMBER}" |
1843 | - echo " -c : Comission the device with the ${PPA} enabled" |
1844 | - echo " -n : Do not run the test set. Default ${DONOTRUNTESTS}" |
1845 | - echo " -o : Output directory. Default $OUTPUTDIR" |
1846 | - echo " -p : Source PPA for the UITK. Default $PPA. Use -p archive to test stock image or -p [0-9]* to set a silo." |
1847 | - echo " -f : Filter for the test suite. Default $FILTER" |
1848 | - echo " -u : Provision the Development release of Ubuntu. Default is RTM." |
1849 | - exit |
1850 | + echo -e "\t-r : Reset after each tests. Default: ${RESET}" |
1851 | + echo -e "\t-s : Use the device with the given serial number. Default: ${SERIALNUMBER}" |
1852 | + echo -e "\t-c : Comission the device with the ${PPA} enabled" |
1853 | + echo -e "\t-d : Only compare the -p ${PPA} results with the archive test results. Default: ${ONLYCOMPARE}" |
1854 | + echo -e "\t-n : Do not run the test set. Default ${DONOTRUNTESTS}" |
1855 | + echo -e "\t-o : Output directory. Default $OUTPUTDIR" |
1856 | + echo -e "\t-p : Source PPA for the UITK. Default $PPA. Use -p archive to test stock image or -p [0-9]* to set a silo." |
1857 | + echo -e "\t-f : Filter for the test suite. Default $FILTER" |
1858 | + echo -e "\t-u : Provision the Development release of Ubuntu. Default is RTM." |
1859 | + echo "" |
1860 | + echo "By default tihe uitk_test_plan.sh flashes the latest RTM image on the device, installs the click application" |
1861 | + echo "tests, configures the ppa:ubuntu-sdk-team/staging PPA, installs the UITK from the PPA and executes the test plan." |
1862 | + echo "" |
1863 | + echo "Validate the staging branch of the UITK against the RTM image" |
1864 | + echo -e "\t$ ./uitk_test_plan.sh -c" |
1865 | + echo "" |
1866 | + echo "Validate the UITK from a CI silo on an RTM image" |
1867 | + echo -e "\t$ ./uitk_test_plan.sh -c -p 001" |
1868 | + echo "" |
1869 | + echo "Validate the UITK from teh archive on an RTM image" |
1870 | + echo -e "\t$ ./uitk_test_plan.sh -c -p archive" |
1871 | + echo "" |
1872 | + echo "Validate the UITK from a specific CI silo on an Ubuntu Utopic image" |
1873 | + echo -e "\t$ ./uitk_test_plan.sh -c -p 001 -u" |
1874 | + echo "" |
1875 | + echo "Provision the device for manual testing with the latest RTM image" |
1876 | + echo -e "\t$ ./uitk_test_plan.sh -c -p archive -n" |
1877 | + echo "" |
1878 | + echo "Provision the device for manual testing with the latest Ubuntu Utopic image" |
1879 | + echo -e "\t$ ./uitk_test_plan.sh -c -p archive -u -n" |
1880 | + echo "" |
1881 | + echo "Run the test plan on an already provisioned device" |
1882 | + echo -e "\t$ ./uitk_test_plan.sh" |
1883 | + echo "" |
1884 | + echo "Run only the UITK tests on an already provisioned device" |
1885 | + echo -e "\t$ ./uitk_test_plan.sh -f ubuntuuitoolkit" |
1886 | + echo "" |
1887 | + echo "Compare the archive test results with the silo 001 results" |
1888 | + echo -e "\t$ ./uitk_test_plan.sh -d -p 001" |
1889 | + exit |
1890 | ;; |
1891 | :) |
1892 | echo "Option -$OPTARG requires an argument." >&2 |
1893 | @@ -243,6 +306,13 @@ |
1894 | esac |
1895 | done |
1896 | |
1897 | +if [ ${ONLYCOMPARE} == true ]; then |
1898 | + echo "Comparing results with the archive tests" |
1899 | + compare_results |
1900 | + exit |
1901 | +fi |
1902 | + |
1903 | + |
1904 | # Use the first available device for testing |
1905 | if [ ${LAZY} == true ]; then |
1906 | echo "Waiting for a device" |
1907 | @@ -260,40 +330,35 @@ |
1908 | fi |
1909 | |
1910 | # Check if the job is only comissioning the device |
1911 | -if [ ${DONOTRUNTESTS} == true ]; then |
1912 | - exit |
1913 | -fi |
1914 | - |
1915 | -# Reset the device for testing |
1916 | -reset -f |
1917 | - |
1918 | -# Run the test suite |
1919 | -for TEST_SET in "${TEST_SUITE[@]}" |
1920 | -do |
1921 | - if [[ ${TEST_SET} =~ ${FILTER} ]]; then |
1922 | - APPNAME=${TEST_SET##* } |
1923 | - LOGFILE="$OUTPUTDIR/${LOGFILENAME}-${APPNAME}-1.tests" |
1924 | - COMMAND="phablet-test-run -s ${SERIALNUMBER} $TEST_SET >> ${LOGFILE}" |
1925 | - echo "<<<=== ${APPNAME} 1 ===>>>" >> ${LOGFILE} |
1926 | - reset |
1927 | - eval ${COMMAND} |
1928 | - egrep "<<<===|Ran|OK|FAILED" ${LOGFILE} |
1929 | - # check if the tests were successful and re-run after a reset |
1930 | -# if grep -q "FAILED" ${LOGFILE}; then |
1931 | -# reset -f |
1932 | -# LOGFILE="$OUTPUTDIR/${LOGFILENAME}-${APPNAME}-2.tests" |
1933 | -# COMMAND="phablet-test-run -s ${SERIALNUMBER} $TEST_SET >> ${LOGFILE}" |
1934 | -# echo "<<<=== ${APPNAME} 2 ===>>>" >> ${LOGFILE} |
1935 | -# eval ${COMMAND} |
1936 | -# egrep "<<<===|Ran|OK|FAILED" ${LOGFILE} |
1937 | -# if grep -q "FAILED" ${LOGFILE}; then |
1938 | -# reset -f |
1939 | -# LOGFILE="$OUTPUTDIR/${LOGFILENAME}-${APPNAME}-3.tests" |
1940 | -# COMMAND="phablet-test-run -s ${SERIALNUMBER} $TEST_SET >> ${LOGFILE}" |
1941 | -# echo "<<<=== ${APPNAME} 3 ===>>>" >> ${LOGFILE} |
1942 | -# eval ${COMMAND} |
1943 | -# egrep "<<<===|Ran|OK|FAILED|FAIL|ERROR:" ${LOGFILE} |
1944 | -# fi |
1945 | -# fi |
1946 | - fi |
1947 | -done |
1948 | +if [ ${DONOTRUNTESTS} != true ]; then |
1949 | + # Reset the device for testing |
1950 | + reset -f |
1951 | + |
1952 | + # Run the test suite |
1953 | + for TEST_SET in "${TEST_SUITE[@]}" |
1954 | + do |
1955 | + if [[ ${TEST_SET} =~ ${FILTER} ]]; then |
1956 | + APPNAME=${TEST_SET##* } |
1957 | + LOGFILE="$OUTPUTDIR/${LOGFILENAME}-${APPNAME}-1-${PPA}.tests" |
1958 | + COMMAND="phablet-test-run -r ${PASSWORD} -s ${SERIALNUMBER} $TEST_SET >> ${LOGFILE}" |
1959 | + echo "<<<=== ${APPNAME} 1 ===>>>" >> ${LOGFILE} |
1960 | + reset |
1961 | + eval ${COMMAND} |
1962 | + egrep "<<<===|Ran|OK|FAILED" ${LOGFILE} |
1963 | + # check if the tests were successful and re-run after a reset |
1964 | + if grep -q "FAILED" ${LOGFILE}; then |
1965 | + reset -f |
1966 | + LOGFILE="$OUTPUTDIR/${LOGFILENAME}-${APPNAME}-2-${PPA}.tests" |
1967 | + COMMAND="phablet-test-run -r ${PASSWORD} -s ${SERIALNUMBER} $TEST_SET >> ${LOGFILE}" |
1968 | + echo "<<<=== ${APPNAME} 2 ===>>>" >> ${LOGFILE} |
1969 | + eval ${COMMAND} |
1970 | + egrep "<<<===|Ran|OK|FAILED" ${LOGFILE} |
1971 | + fi |
1972 | + fi |
1973 | + done |
1974 | +fi |
1975 | + |
1976 | +if [ ${PPA} != "archive" ]; then |
1977 | + echo "Comparing results with the archive tests" |
1978 | + compare_results |
1979 | +fi |
1980 | |
1981 | === modified file 'tests/unit/add_qmlmakecheck.pri' |
1982 | --- tests/unit/add_qmlmakecheck.pri 2014-03-04 12:38:39 +0000 |
1983 | +++ tests/unit/add_qmlmakecheck.pri 2014-10-16 21:17:25 +0000 |
1984 | @@ -8,5 +8,5 @@ |
1985 | check.commands += ../../unit/runtest.sh $${TARGET} $${TEST} minimal; |
1986 | } |
1987 | check.commands += cd ../../..; |
1988 | -check.commands += sh tests/qmlapicheck.sh || exit 1; |
1989 | +check.commands += tests/qmlapicheck.sh . || exit 1; |
1990 | check.commands += cd tests/unit |
1991 | |
1992 | === modified file 'tests/unit/tst_alarms/tst_alarms.cpp' |
1993 | --- tests/unit/tst_alarms/tst_alarms.cpp 2014-09-25 08:19:55 +0000 |
1994 | +++ tests/unit/tst_alarms/tst_alarms.cpp 2014-10-16 21:17:25 +0000 |
1995 | @@ -45,6 +45,7 @@ |
1996 | void syncFetch() |
1997 | { |
1998 | // initiate fetch |
1999 | + QSignalSpy spy(&AlarmManager::instance(), SIGNAL(alarmsChanged())); |
2000 | AlarmsAdapter *adapter = AlarmsAdapter::get(); |
2001 | if (!adapter->fetchRequest) { |
2002 | adapter->fetchAlarms(); |
2003 | @@ -53,9 +54,21 @@ |
2004 | adapter->fetchRequest->wait(); |
2005 | } |
2006 | QTest::waitForEvents(); |
2007 | - } |
2008 | - |
2009 | - void waitForRequest(UCAlarm *alarm) |
2010 | + spy.wait(200); |
2011 | + } |
2012 | + |
2013 | + void waitForUpdate(UCAlarm *alarm) |
2014 | + { |
2015 | + QSignalSpy spy(&AlarmManager::instance(), SIGNAL(alarmsUpdated(QList<QVariant>))); |
2016 | + UCAlarmPrivate *pAlarm = UCAlarmPrivate::get(alarm); |
2017 | + if (pAlarm->request) { |
2018 | + pAlarm->request->wait(); |
2019 | + } |
2020 | + QTest::waitForEvents(); |
2021 | + spy.wait(); |
2022 | + } |
2023 | + |
2024 | + void waitAndFetch(UCAlarm *alarm) |
2025 | { |
2026 | UCAlarmPrivate *pAlarm = UCAlarmPrivate::get(alarm); |
2027 | if (pAlarm->request) { |
2028 | @@ -136,7 +149,7 @@ |
2029 | UCAlarm *alarm = model.get(i); |
2030 | if (alarm && alarm->message().startsWith("test_")) { |
2031 | alarm->cancel(); |
2032 | - waitForRequest(alarm); |
2033 | + waitAndFetch(alarm); |
2034 | i = 0; |
2035 | } else { |
2036 | i++; |
2037 | @@ -153,7 +166,7 @@ |
2038 | void test_singleShotAlarmPass() { |
2039 | UCAlarm alarm(QDateTime::currentDateTime().addSecs(4), "test_singleShotAlarmPass"); |
2040 | alarm.save(); |
2041 | - waitForRequest(&alarm); |
2042 | + waitAndFetch(&alarm); |
2043 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2044 | QVERIFY(containsAlarm(&alarm)); |
2045 | } |
2046 | @@ -163,7 +176,7 @@ |
2047 | UCAlarm alarm(QDateTime::currentDateTime().addSecs(20), UCAlarm::AutoDetect, "test_repeating_autoDetect"); |
2048 | |
2049 | alarm.save(); |
2050 | - waitForRequest(&alarm); |
2051 | + waitAndFetch(&alarm); |
2052 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2053 | QVERIFY(containsAlarm(&alarm)); |
2054 | } |
2055 | @@ -173,7 +186,7 @@ |
2056 | UCAlarm alarm(QDateTime::currentDateTime().addSecs(10), UCAlarm::Daily, "test_repeating_daily"); |
2057 | |
2058 | alarm.save(); |
2059 | - waitForRequest(&alarm); |
2060 | + waitAndFetch(&alarm); |
2061 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2062 | QVERIFY(containsAlarm(&alarm)); |
2063 | } |
2064 | @@ -199,7 +212,7 @@ |
2065 | UCAlarm alarm(QDateTime::currentDateTime(), (UCAlarm::DaysOfWeek)day, "test_repeating_givenDay_exact_" + message); |
2066 | |
2067 | alarm.save(); |
2068 | - waitForRequest(&alarm); |
2069 | + waitAndFetch(&alarm); |
2070 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2071 | QVERIFY(containsAlarm(&alarm)); |
2072 | } |
2073 | @@ -232,7 +245,7 @@ |
2074 | UCAlarmPrivate::get(&firstOccurrence)->checkAlarm(); |
2075 | |
2076 | alarm.save(); |
2077 | - waitForRequest(&alarm); |
2078 | + waitAndFetch(&alarm); |
2079 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2080 | QVERIFY(containsAlarm(&alarm)); |
2081 | QVERIFY(containsAlarm(&firstOccurrence)); |
2082 | @@ -257,7 +270,7 @@ |
2083 | |
2084 | UCAlarm alarm(QDateTime::currentDateTime().addSecs(3600), (UCAlarm::DaysOfWeek)dow, "test_repeating_weekly_" + message); |
2085 | alarm.save(); |
2086 | - waitForRequest(&alarm); |
2087 | + waitAndFetch(&alarm); |
2088 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2089 | QVERIFY(containsAlarm(&alarm)); |
2090 | } |
2091 | @@ -291,12 +304,12 @@ |
2092 | UCAlarm alarm(QDateTime::currentDateTime().addDays(1), "test_cancelPass"); |
2093 | |
2094 | alarm.save(); |
2095 | - waitForRequest(&alarm); |
2096 | + waitAndFetch(&alarm); |
2097 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2098 | QVERIFY(containsAlarm(&alarm)); |
2099 | |
2100 | alarm.cancel(); |
2101 | - waitForRequest(&alarm); |
2102 | + waitAndFetch(&alarm); |
2103 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2104 | QVERIFY(!containsAlarm(&alarm)); |
2105 | } |
2106 | @@ -308,9 +321,9 @@ |
2107 | UCAlarm alarm2(dt, "test_twoAlarmsOnSameTime"); |
2108 | |
2109 | alarm1.save(); |
2110 | - waitForRequest(&alarm1); |
2111 | + waitAndFetch(&alarm1); |
2112 | alarm2.save(); |
2113 | - waitForRequest(&alarm2); |
2114 | + waitAndFetch(&alarm2); |
2115 | QCOMPARE(alarm1.error(), (int)UCAlarm::NoError); |
2116 | QCOMPARE(alarm2.error(), (int)UCAlarm::NoError); |
2117 | } |
2118 | @@ -322,9 +335,9 @@ |
2119 | UCAlarm alarm2(dt, UCAlarm::Daily, "test_twoAlarmsOnSameTime2"); |
2120 | |
2121 | alarm1.save(); |
2122 | - waitForRequest(&alarm1); |
2123 | + waitAndFetch(&alarm1); |
2124 | alarm2.save(); |
2125 | - waitForRequest(&alarm2); |
2126 | + waitAndFetch(&alarm2); |
2127 | QCOMPARE(alarm1.error(), (int)UCAlarm::NoError); |
2128 | QCOMPARE(alarm2.error(), (int)UCAlarm::NoError); |
2129 | } |
2130 | @@ -336,7 +349,7 @@ |
2131 | UCAlarm copy(dt, "test_updateAlarm_SameType"); |
2132 | |
2133 | alarm.save(); |
2134 | - waitForRequest(&alarm); |
2135 | + waitAndFetch(&alarm); |
2136 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2137 | QVERIFY(containsAlarm(&alarm)); |
2138 | |
2139 | @@ -344,7 +357,8 @@ |
2140 | QVERIFY(!compareAlarms(&alarm, ©)); |
2141 | |
2142 | alarm.save(); |
2143 | - waitForRequest(&alarm); |
2144 | + // do not fetch! |
2145 | + waitForUpdate(&alarm); |
2146 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2147 | QVERIFY(containsAlarm(&alarm)); |
2148 | QVERIFY(!containsAlarm(©)); |
2149 | @@ -357,14 +371,15 @@ |
2150 | UCAlarm copy(dt, "test_updateAlarm_DifferentType"); |
2151 | |
2152 | alarm.save(); |
2153 | - waitForRequest(&alarm); |
2154 | + waitAndFetch(&alarm); |
2155 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2156 | QVERIFY(containsAlarm(&alarm)); |
2157 | |
2158 | alarm.setType(UCAlarm::Repeating); |
2159 | QVERIFY(!compareAlarms(&alarm, ©)); |
2160 | alarm.save(); |
2161 | - waitForRequest(&alarm); |
2162 | + // do not fetch |
2163 | + waitForUpdate(&alarm); |
2164 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2165 | QVERIFY(containsAlarm(&alarm)); |
2166 | QVERIFY(!containsAlarm(©)); |
2167 | @@ -375,20 +390,20 @@ |
2168 | UCAlarm alarm(QDateTime::currentDateTime().addMSecs(5000), UCAlarm::AutoDetect, "test_updateAlarm_Repeating"); |
2169 | |
2170 | alarm.save(); |
2171 | - waitForRequest(&alarm); |
2172 | + waitAndFetch(&alarm); |
2173 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2174 | QSKIP("https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1322558"); |
2175 | QVERIFY(containsAlarm(&alarm)); |
2176 | |
2177 | alarm.setDate(alarm.date().addDays(1)); |
2178 | alarm.save(); |
2179 | - waitForRequest(&alarm); |
2180 | + waitForUpdate(&alarm); |
2181 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2182 | QVERIFY(containsAlarm(&alarm)); |
2183 | |
2184 | alarm.setDaysOfWeek(UCAlarm::Daily); |
2185 | alarm.save(); |
2186 | - waitForRequest(&alarm); |
2187 | + waitForUpdate(&alarm); |
2188 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2189 | QVERIFY(containsAlarm(&alarm)); |
2190 | } |
2191 | @@ -399,19 +414,19 @@ |
2192 | UCAlarm alarm(dt, "test_fetchAlarmPlus7Days"); |
2193 | |
2194 | alarm.save(); |
2195 | - waitForRequest(&alarm); |
2196 | + waitAndFetch(&alarm); |
2197 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2198 | QVERIFY(containsAlarm(&alarm)); |
2199 | |
2200 | UCAlarm nextMonth(dt.addMonths(1), "test_fetchAlarmPlus1Month"); |
2201 | nextMonth.save(); |
2202 | - waitForRequest(&nextMonth); |
2203 | + waitAndFetch(&nextMonth); |
2204 | QCOMPARE(nextMonth.error(), (int)UCAlarm::NoError); |
2205 | QVERIFY(containsAlarm(&nextMonth)); |
2206 | |
2207 | UCAlarm nextYear(dt.addYears(1), "test_fetchAlarmPlus1Year"); |
2208 | nextYear.save(); |
2209 | - waitForRequest(&nextYear); |
2210 | + waitAndFetch(&nextYear); |
2211 | QCOMPARE(nextYear.error(), (int)UCAlarm::NoError); |
2212 | QVERIFY(containsAlarm(&nextYear)); |
2213 | } |
2214 | @@ -426,7 +441,7 @@ |
2215 | UCAlarm nextAlarm(nextDt, UCAlarm::Daily, "test_correctAlarmOrderDaily"); |
2216 | |
2217 | alarm.save(); |
2218 | - waitForRequest(&alarm); |
2219 | + waitAndFetch(&alarm); |
2220 | QTest::qWait(2000); |
2221 | syncFetch(); |
2222 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2223 | @@ -443,7 +458,7 @@ |
2224 | UCAlarm nextAlarm(nextDt, UCAlarm::AutoDetect, "test_correctAlarmOrderWeekly"); |
2225 | |
2226 | alarm.save(); |
2227 | - waitForRequest(&alarm); |
2228 | + waitAndFetch(&alarm); |
2229 | QTest::qWait(2000); |
2230 | syncFetch(); |
2231 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2232 | @@ -500,7 +515,7 @@ |
2233 | UCAlarm alarm(QDateTime::currentDateTime().addSecs(3600), "test_oneTime_dow_" + message); |
2234 | alarm.setDaysOfWeek((UCAlarm::DaysOfWeek)dow); |
2235 | alarm.save(); |
2236 | - waitForRequest(&alarm); |
2237 | + waitAndFetch(&alarm); |
2238 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
2239 | QVERIFY(containsAlarm(&alarm)); |
2240 | } |
2241 | @@ -531,7 +546,7 @@ |
2242 | UCAlarm alarm(QDateTime::currentDateTime().addSecs(60), "test_onetime_sound"); |
2243 | alarm.setSound(QUrl("file:///usr/share/sounds/ubuntu/ringtones/Celestial.ogg")); |
2244 | alarm.save(); |
2245 | - waitForRequest(&alarm); |
2246 | + waitAndFetch(&alarm); |
2247 | |
2248 | UCAlarm saved; |
2249 | QVERIFY(findAlarm("test_onetime_sound", saved)); |
2250 | @@ -544,20 +559,20 @@ |
2251 | UCAlarm alarm(QDateTime::currentDateTime(), UCAlarm::AutoDetect, "test_create_update_and_disable_alarm"); |
2252 | alarm.setSound(QUrl("file:///usr/share/sounds/ubuntu/ringtones/Celestial.ogg")); |
2253 | alarm.save(); |
2254 | - waitForRequest(&alarm); |
2255 | + waitAndFetch(&alarm); |
2256 | QVERIFY(containsAlarm(&alarm)); |
2257 | |
2258 | // update alarm to occur 1h earlier |
2259 | QDateTime date = alarm.date(); |
2260 | date.addSecs(-60); |
2261 | alarm.save(); |
2262 | - waitForRequest(&alarm); |
2263 | + waitForUpdate(&alarm); |
2264 | QVERIFY(containsAlarm(&alarm)); |
2265 | |
2266 | // disable alarm |
2267 | alarm.setEnabled(false); |
2268 | alarm.save(); |
2269 | - waitForRequest(&alarm); |
2270 | + waitForUpdate(&alarm); |
2271 | QVERIFY(containsAlarm(&alarm)); |
2272 | AlarmData data = getAlarmDataFromAlarmCookie(&alarm); |
2273 | QVERIFY(data.cookie.isValid()); |
2274 | @@ -567,14 +582,15 @@ |
2275 | void test_change_alarm_sound() |
2276 | { |
2277 | UCAlarm alarm(QDateTime::currentDateTime(), UCAlarm::AutoDetect, "test_change_alarm_fields_sound"); |
2278 | + alarm.setSound(QUrl("file:///usr/share/sounds/ubuntu/ringtones/Bliss.ogg")); |
2279 | alarm.save(); |
2280 | - waitForRequest(&alarm); |
2281 | + waitAndFetch(&alarm); |
2282 | QVERIFY(containsAlarm(&alarm)); |
2283 | |
2284 | // do the change |
2285 | - alarm.setSound(QUrl("file:///usr/share/sounds/ubuntu/ringtones/Celestial.ogg")); |
2286 | + alarm.setSound(QUrl("file:///usr/share/sounds/ubuntu/ringtones/Sparkle.ogg")); |
2287 | alarm.save(); |
2288 | - waitForRequest(&alarm); |
2289 | + waitForUpdate(&alarm); |
2290 | QVERIFY(containsAlarm(&alarm)); |
2291 | |
2292 | //verify whether we have the desired change |
2293 | @@ -595,9 +611,10 @@ |
2294 | QFETCH(bool, enabled); |
2295 | |
2296 | UCAlarm alarm(QDateTime::currentDateTime().addDays(1), "test_check_alarm_tags_" + message); |
2297 | + alarm.setSound(QUrl("file:///usr/share/sounds/ubuntu/ringtones/Marimbach.ogg")); |
2298 | alarm.setEnabled(enabled); |
2299 | alarm.save(); |
2300 | - waitForRequest(&alarm); |
2301 | + waitAndFetch(&alarm); |
2302 | QVERIFY(containsAlarm(&alarm)); |
2303 | |
2304 | // check the tags |
2305 | |
2306 | === modified file 'tests/unit/tst_i18n/src/LocalizedApp.qml' |
2307 | --- tests/unit/tst_i18n/src/LocalizedApp.qml 2014-04-23 08:50:20 +0000 |
2308 | +++ tests/unit/tst_i18n/src/LocalizedApp.qml 2014-10-16 21:17:25 +0000 |
2309 | @@ -24,7 +24,7 @@ |
2310 | |
2311 | Page { |
2312 | objectName: 'page' |
2313 | - title: i18n.dtr('localizedApp', 'Welcome') |
2314 | + title: i18n.dtr('localizedApp', "Welcome") |
2315 | Button { |
2316 | objectName: 'button' |
2317 | anchors.centerIn: parent |
2318 | |
2319 | === modified file 'tests/unit_x11/tst_components/tst_textarea.qml' |
2320 | --- tests/unit_x11/tst_components/tst_textarea.qml 2014-06-24 14:03:44 +0000 |
2321 | +++ tests/unit_x11/tst_components/tst_textarea.qml 2014-10-16 21:17:25 +0000 |
2322 | @@ -191,6 +191,16 @@ |
2323 | |
2324 | function test_0_readOnly() { |
2325 | compare(textArea.readOnly,textEdit.readOnly,"TextArea.readOnly is same as TextEdit.readOnly") |
2326 | + |
2327 | + textArea.text = "ab"; |
2328 | + textArea.cursorPosition = 1; |
2329 | + textArea.textFormat = TextEdit.PlainText; |
2330 | + keyClick(Qt.Key_Return); |
2331 | + compare("ab", textArea.text, "No split occurred in plain area"); |
2332 | + |
2333 | + textArea.textFormat = TextEdit.RichText; |
2334 | + keyClick(Qt.Key_Return); |
2335 | + compare(textArea.text.indexOf("<br />"), -1, "No split occurred in rich area"); |
2336 | } |
2337 | |
2338 | function test_0_renderType() { |