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