Merge lp:~nskaggs/ubuntu-ui-toolkit/add-min-max-datepicker-tests into lp:ubuntu-ui-toolkit

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
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
=== modified file 'debian/control'
--- debian/control 2014-10-01 07:35:42 +0000
+++ debian/control 2014-10-16 21:17:25 +0000
@@ -35,7 +35,6 @@
35 libqt5organizer5,35 libqt5organizer5,
36 qtpim5-dev,36 qtpim5-dev,
37 language-pack-en-base,37 language-pack-en-base,
38 libthumbnailer-dev,
39 libdbus-1-dev,38 libdbus-1-dev,
40 libnih-dbus-dev,39 libnih-dbus-dev,
41 xvfb,40 xvfb,
4241
=== modified file 'examples/ubuntu-ui-toolkit-gallery/Icons.qml'
--- examples/ubuntu-ui-toolkit-gallery/Icons.qml 2014-07-31 14:14:56 +0000
+++ examples/ubuntu-ui-toolkit-gallery/Icons.qml 2014-10-16 21:17:25 +0000
@@ -79,10 +79,11 @@
79 TemplateRow {79 TemplateRow {
80 title: i18n.tr("Theme")80 title: i18n.tr("Theme")
81 spacing: units.gu(2)81 spacing: units.gu(2)
8282 height: iconFlow.height
8383
84 Flow {84 Flow {
85 anchors.fill: parent85 id: iconFlow
86 width: parent.width
86 spacing: units.gu(2)87 spacing: units.gu(2)
8788
88 Repeater {89 Repeater {
8990
=== modified file 'examples/ubuntu-ui-toolkit-gallery/TemplateRow.qml'
--- examples/ubuntu-ui-toolkit-gallery/TemplateRow.qml 2014-08-07 10:28:01 +0000
+++ examples/ubuntu-ui-toolkit-gallery/TemplateRow.qml 2014-10-16 21:17:25 +0000
@@ -33,7 +33,7 @@
33 text: templateRow.title33 text: templateRow.title
34 width: templateRow.titleWidth34 width: templateRow.titleWidth
35 anchors.left: parent.left35 anchors.left: parent.left
36 anchors.verticalCenter: contentRow.verticalCenter36 anchors.top: contentRow.top
37 elide: Text.ElideRight37 elide: Text.ElideRight
38 font.weight: Font.Light38 font.weight: Font.Light
39 }39 }
4040
=== modified file 'examples/ubuntu-ui-toolkit-gallery/TextInputs.qml'
--- examples/ubuntu-ui-toolkit-gallery/TextInputs.qml 2014-09-17 15:11:08 +0000
+++ examples/ubuntu-ui-toolkit-gallery/TextInputs.qml 2014-10-16 21:17:25 +0000
@@ -74,10 +74,22 @@
74 }74 }
7575
76 TemplateRow {76 TemplateRow {
77 title: i18n.tr("Read-only")
78
79 TextField {
80 objectName: "textfield_read_only"
81 text: i18n.tr("Nobody type here")
82 readOnly: true
83 width: parent.width
84 }
85 }
86
87 TemplateRow {
77 title: i18n.tr("Disabled")88 title: i18n.tr("Disabled")
7889
79 TextField {90 TextField {
80 objectName: "textfield_disabled"91 objectName: "textfield_disabled"
92 text: i18n.tr("No interaction allowed")
81 enabled: false93 enabled: false
82 width: parent.width94 width: parent.width
83 }95 }
8496
=== modified file 'modules/Ubuntu/Components/Icon10.qml'
--- modules/Ubuntu/Components/Icon10.qml 2014-09-19 13:22:18 +0000
+++ modules/Ubuntu/Components/Icon10.qml 2014-10-16 21:17:25 +0000
@@ -31,45 +31,27 @@
31 */31 */
32 property alias keyColor: colorizedImage.keyColorIn32 property alias keyColor: colorizedImage.keyColorIn
3333
34 implicitWidth: image.implicitWidth
35 implicitHeight: image.implicitHeight
36
34 Image {37 Image {
35 id: image38 id: image
36 objectName: "image"39 objectName: "image"
37 anchors.fill: parent40 anchors.fill: parent
41 fillMode: Image.PreserveAspectFit
3842
39 /* Necessary so that icons are not loaded before a size is set. */
40 source: ""
41 sourceSize {43 sourceSize {
42 width: 044 width: icon.width
43 height: 045 height: icon.height
44 }46 }
4547
46 Component.onCompleted: update()48 source: {
47 onWidthChanged: update()49 if (icon.hasOwnProperty("source"))
48 onHeightChanged: update()50 return icon.source;
49 Connections {51 else if (icon.name)
50 target: icon52 return "image://theme/%1".arg(icon.name);
51 ignoreUnknownSignals: true53 else
52 onNameChanged: image.update()54 return "";
53 onSourceChanged: image.update()
54 }
55
56 function update() {
57 // only set sourceSize.width, sourceSize.height and source when
58 // icon dimensions are valid, see bug #1349769.
59 if (width > 0 && height > 0
60 && (icon.name || (icon.hasOwnProperty("source") && icon.source))) {
61 sourceSize.width = width;
62 sourceSize.height = height;
63 if (icon.hasOwnProperty("source")) {
64 source = icon.source;
65 } else {
66 source = "image://theme/%1".arg(icon.name);
67 }
68 } else {
69 source = "";
70 sourceSize.width = 0;
71 sourceSize.height = 0;
72 }
73 }55 }
7456
75 cache: true57 cache: true
7658
=== modified file 'modules/Ubuntu/Components/ListItems/Empty.qml'
--- modules/Ubuntu/Components/ListItems/Empty.qml 2014-09-09 16:03:39 +0000
+++ modules/Ubuntu/Components/ListItems/Empty.qml 2014-10-16 21:17:25 +0000
@@ -410,7 +410,7 @@
410 width: units.gu(5)410 width: units.gu(5)
411 }411 }
412 Label {412 Label {
413 text: i18n.dtr('ubuntu-ui-toolkit', 'Delete')413 text: i18n.dtr('ubuntu-ui-toolkit', "Delete")
414 verticalAlignment: Text.AlignVCenter414 verticalAlignment: Text.AlignVCenter
415 anchors {415 anchors {
416 verticalCenter: parent.verticalCenter416 verticalCenter: parent.verticalCenter
417417
=== modified file 'modules/Ubuntu/Components/OrientationHelper.qml'
--- modules/Ubuntu/Components/OrientationHelper.qml 2014-07-10 11:50:13 +0000
+++ modules/Ubuntu/Components/OrientationHelper.qml 2014-10-16 21:17:25 +0000
@@ -134,7 +134,10 @@
134 window.contentOrientation = Screen.orientation134 window.contentOrientation = Screen.orientation
135 }135 }
136136
137 onWindowActiveChanged: applyOrientation()137 onWindowActiveChanged: {
138 if (automaticOrientation)
139 applyOrientation();
140 }
138141
139 state: orientationAngle.toString()142 state: orientationAngle.toString()
140143
141144
=== modified file 'modules/Ubuntu/Components/Popups/Dialog.qml'
--- modules/Ubuntu/Components/Popups/Dialog.qml 2014-10-01 10:21:28 +0000
+++ modules/Ubuntu/Components/Popups/Dialog.qml 2014-10-16 21:17:25 +0000
@@ -173,43 +173,46 @@
173173
174 height: Math.min(contentsColumn.height + foreground.margins, dialog.height)174 height: Math.min(contentsColumn.height + foreground.margins, dialog.height)
175175
176 Column {176 Flickable {
177 id: contentsColumn177 anchors.fill: parent
178 anchors {178 anchors.margins: foreground.margins
179 top: parent.top179 contentWidth: contentsColumn.width
180 left: parent.left180 contentHeight: contentsColumn.height - foreground.margins
181 right: parent.right181 boundsBehavior: Flickable.StopAtBounds
182 margins: foreground.margins182
183 }183 Column {
184 spacing: foreground.itemSpacing184 id: contentsColumn
185 height: childrenRect.height + foreground.margins185 spacing: foreground.itemSpacing
186 onWidthChanged: updateChildrenWidths();186 width: foreground.width - foreground.margins * 2 - foreground.itemSpacing
187187 height: childrenRect.height + foreground.margins
188 Label {188 onWidthChanged: updateChildrenWidths();
189 horizontalAlignment: Text.AlignHCenter189
190 text: dialog.title190 Label {
191 wrapMode: Text.Wrap191 horizontalAlignment: Text.AlignHCenter
192 maximumLineCount: 2192 text: dialog.title
193 elide: Text.ElideRight193 wrapMode: Text.Wrap
194 fontSize: "large"194 maximumLineCount: 2
195 color: UbuntuColors.darkGrey195 elide: Text.ElideRight
196 visible: (text !== "")196 fontSize: "large"
197 }197 color: UbuntuColors.darkGrey
198198 visible: (text !== "")
199 Label {199 }
200 horizontalAlignment: Text.AlignHCenter200
201 text: dialog.text201 Label {
202 fontSize: "medium"202 horizontalAlignment: Text.AlignHCenter
203 color: UbuntuColors.darkGrey203 text: dialog.text
204 wrapMode: Text.Wrap204 fontSize: "medium"
205 visible: (text !== "")205 color: UbuntuColors.darkGrey
206 }206 wrapMode: Text.Wrap
207207 visible: (text !== "")
208 onChildrenChanged: updateChildrenWidths()208 }
209209
210 function updateChildrenWidths() {210 onChildrenChanged: updateChildrenWidths()
211 for (var i = 0; i < children.length; i++) {211
212 children[i].width = contentsColumn.width;212 function updateChildrenWidths() {
213 for (var i = 0; i < children.length; i++) {
214 children[i].width = contentsColumn.width;
215 }
213 }216 }
214 }217 }
215 }218 }
216219
=== modified file 'modules/Ubuntu/Components/TextArea.qml'
--- modules/Ubuntu/Components/TextArea.qml 2014-07-11 15:11:02 +0000
+++ modules/Ubuntu/Components/TextArea.qml 2014-10-16 21:17:25 +0000
@@ -776,6 +776,8 @@
776 // grab Enter/Return keys which may be stolen from parent components of TextArea776 // grab Enter/Return keys which may be stolen from parent components of TextArea
777 // due to forwarded keys from TextEdit777 // due to forwarded keys from TextEdit
778 Keys.onPressed: {778 Keys.onPressed: {
779 if (readOnly)
780 return;
779 if ((event.key === Qt.Key_Enter) || (event.key === Qt.Key_Return)) {781 if ((event.key === Qt.Key_Enter) || (event.key === Qt.Key_Return)) {
780 if (editor.textFormat === TextEdit.RichText) {782 if (editor.textFormat === TextEdit.RichText) {
781 // FIXME: use control.paste("<br />") instead when paste() gets sich text support783 // FIXME: use control.paste("<br />") instead when paste() gets sich text support
782784
=== modified file 'modules/Ubuntu/Components/TextCursor.qml'
--- modules/Ubuntu/Components/TextCursor.qml 2014-09-19 09:07:48 +0000
+++ modules/Ubuntu/Components/TextCursor.qml 2014-10-16 21:17:25 +0000
@@ -129,6 +129,7 @@
129 }129 }
130 property bool typing: false130 property bool typing: false
131 property bool contextMenuVisible: false131 property bool contextMenuVisible: false
132 property bool readOnly: handler.main.readOnly
132 function contextMenuHidden(p) {133 function contextMenuHidden(p) {
133 contextMenuVisible = false134 contextMenuVisible = false
134 }135 }
135136
=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml'
--- modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-10-14 14:33:50 +0000
+++ modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-10-16 21:17:25 +0000
@@ -540,6 +540,7 @@
540 verticalCenterOffset: units.dp(-1)540 verticalCenterOffset: units.dp(-1)
541 left: actionIcon.right541 left: actionIcon.right
542 leftMargin: units.gu(2)542 leftMargin: units.gu(2)
543 right: parent.right
543 }544 }
544 fontSize: "small"545 fontSize: "small"
545 elide: Text.ElideRight546 elide: Text.ElideRight
546547
=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TextAreaStyle.qml'
--- modules/Ubuntu/Components/Themes/Ambiance/TextAreaStyle.qml 2014-09-18 15:42:37 +0000
+++ modules/Ubuntu/Components/Themes/Ambiance/TextAreaStyle.qml 2014-10-16 21:17:25 +0000
@@ -61,6 +61,7 @@
61 onErrorChanged: (error) ? visuals.errorColor : visuals.backgroundColor;61 onErrorChanged: (error) ? visuals.errorColor : visuals.backgroundColor;
62 color: visuals.backgroundColor;62 color: visuals.backgroundColor;
63 anchors.fill: parent63 anchors.fill: parent
64 visible: !styledItem.readOnly
64 }65 }
6566
66 Loader {67 Loader {
6768
=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml'
--- modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml 2014-09-22 07:19:56 +0000
+++ modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml 2014-10-16 21:17:25 +0000
@@ -63,6 +63,7 @@
63 running: (cursorStyle.cursorVisibleTimeout > 0) &&63 running: (cursorStyle.cursorVisibleTimeout > 0) &&
64 (cursorStyle.cursorHiddenTimeout > 0) &&64 (cursorStyle.cursorHiddenTimeout > 0) &&
65 styledItem.visible &&65 styledItem.visible &&
66 !styledItem.readOnly &&
66 !styledItem.contextMenuVisible &&67 !styledItem.contextMenuVisible &&
67 styledItem.positionProperty === "cursorPosition"68 styledItem.positionProperty === "cursorPosition"
68 repeat: true69 repeat: true
6970
=== modified file 'modules/Ubuntu/Components/ToolbarItems.qml'
--- modules/Ubuntu/Components/ToolbarItems.qml 2014-05-23 09:27:57 +0000
+++ modules/Ubuntu/Components/ToolbarItems.qml 2014-10-16 21:17:25 +0000
@@ -139,7 +139,7 @@
139 property Item back: ToolbarButton {139 property Item back: ToolbarButton {
140 objectName: "back_toolbar_button"140 objectName: "back_toolbar_button"
141 iconSource: Qt.resolvedUrl("artwork/back.png")141 iconSource: Qt.resolvedUrl("artwork/back.png")
142 text: i18n.dtr('ubuntu-ui-toolkit', 'Back')142 text: i18n.dtr('ubuntu-ui-toolkit', "Back")
143 visible: toolbarItems.pageStack && toolbarItems.pageStack.depth > 1143 visible: toolbarItems.pageStack && toolbarItems.pageStack.depth > 1
144 /*!144 /*!
145 If there is a \l PageStack of sufficient depth, triggering the back button145 If there is a \l PageStack of sufficient depth, triggering the back button
146146
=== modified file 'modules/Ubuntu/Components/plugin/adapters/alarmsadapter_organizer.cpp'
--- modules/Ubuntu/Components/plugin/adapters/alarmsadapter_organizer.cpp 2014-09-25 08:19:55 +0000
+++ modules/Ubuntu/Components/plugin/adapters/alarmsadapter_organizer.cpp 2014-10-16 21:17:25 +0000
@@ -25,6 +25,7 @@
2525
26#include <QtCore/QFile>26#include <QtCore/QFile>
27#include <QtCore/QDir>27#include <QtCore/QDir>
28#include <QtCore/QTimeZone>
28#include <QtCore/QStandardPaths>29#include <QtCore/QStandardPaths>
29#include <QtCore/QJsonDocument>30#include <QtCore/QJsonDocument>
30#include <QtCore/QJsonObject>31#include <QtCore/QJsonObject>
@@ -127,7 +128,7 @@
127128
128 AlarmData alarm;129 AlarmData alarm;
129 alarm.message = object["message"].toString();130 alarm.message = object["message"].toString();
130 alarm.originalDate = alarm.date = AlarmData::transcodeDate(QDateTime::fromString(object["date"].toString()), Qt::LocalTime);131 alarm.originalDate = alarm.date = QDateTime::fromString(object["date"].toString());
131 alarm.sound = object["sound"].toString();132 alarm.sound = object["sound"].toString();
132 alarm.type = static_cast<UCAlarm::AlarmType>(object["type"].toInt());133 alarm.type = static_cast<UCAlarm::AlarmType>(object["type"].toInt());
133 alarm.days = static_cast<UCAlarm::DaysOfWeek>(object["days"].toInt());134 alarm.days = static_cast<UCAlarm::DaysOfWeek>(object["days"].toInt());
@@ -158,7 +159,7 @@
158 Q_FOREACH(const AlarmData &alarm, alarmList) {159 Q_FOREACH(const AlarmData &alarm, alarmList) {
159 QJsonObject object;160 QJsonObject object;
160 object["message"] = alarm.message;161 object["message"] = alarm.message;
161 object["date"] = AlarmData::transcodeDate(alarm.originalDate, Qt::UTC).toString();162 object["date"] = alarm.originalDate.toString();
162 object["sound"] = alarm.sound.toString();163 object["sound"] = alarm.sound.toString();
163 object["type"] = QJsonValue(alarm.type);164 object["type"] = QJsonValue(alarm.type);
164 object["days"] = QJsonValue(alarm.days);165 object["days"] = QJsonValue(alarm.days);
@@ -181,7 +182,12 @@
181 event.setCollectionId(collection.id());182 event.setCollectionId(collection.id());
182 event.setAllDay(false);183 event.setAllDay(false);
183 if (alarm.changes & AlarmData::Date) {184 if (alarm.changes & AlarmData::Date) {
184 event.setStartDateTime(AlarmData::transcodeDate(alarm.date, Qt::UTC));185 QDateTime dt = AlarmData::normalizeDate(alarm.date);
186 // use invalid timezone to sinalize floating time, this is valid only for EDS backend
187 if (manager->managerName() == ALARM_MANAGER) {
188 dt = QDateTime(dt.date(), dt.time(), QTimeZone());
189 }
190 event.setStartDateTime(dt);
185 }191 }
186 if (alarm.changes & AlarmData::Message) {192 if (alarm.changes & AlarmData::Message) {
187 event.setDisplayLabel(alarm.message);193 event.setDisplayLabel(alarm.message);
@@ -195,7 +201,11 @@
195 event.saveDetail(&visual);201 event.saveDetail(&visual);
196 }202 }
197 QOrganizerItemAudibleReminder audible = event.detail(QOrganizerItemDetail::TypeAudibleReminder);203 QOrganizerItemAudibleReminder audible = event.detail(QOrganizerItemDetail::TypeAudibleReminder);
198 if (audible.isEmpty()) {204 if (audible.dataUrl() != alarm.sound) {
205 if (!audible.isEmpty()) {
206 // remove previous attachment
207 event.removeDetail(&audible);
208 }
199 audible.setSecondsBeforeStart(0);209 audible.setSecondsBeforeStart(0);
200 audible.setDataUrl(alarm.sound);210 audible.setDataUrl(alarm.sound);
201 event.saveDetail(&audible);211 event.saveDetail(&audible);
@@ -213,20 +223,6 @@
213 }223 }
214 }224 }
215225
216 // save the sound as description as the audible reminder may be off
217 if (alarm.changes && AlarmData::Sound) {
218 event.setDescription(alarm.sound.toString());
219 // update audible reminder as well if alarm is enabled
220 if (alarm.enabled) {
221 QOrganizerItemAudibleReminder audible = event.detail(QOrganizerItemDetail::TypeAudibleReminder);
222 // remove the previous data, otherwise we will have two melodies
223 event.removeDetail(&audible);
224 // update sound and save
225 audible.setDataUrl(alarm.sound);
226 event.saveDetail(&audible);
227 }
228 }
229
230 // set repeating, reset recurrence no matter if we had it or not226 // set repeating, reset recurrence no matter if we had it or not
231 if (((alarm.changes & AlarmData::Type) == AlarmData::Type)227 if (((alarm.changes & AlarmData::Type) == AlarmData::Type)
232 || ((alarm.changes & AlarmData::Days) == AlarmData::Days)) {228 || ((alarm.changes & AlarmData::Days) == AlarmData::Days)) {
@@ -261,8 +257,9 @@
261257
262 alarm.cookie = QVariant::fromValue<QOrganizerItemId>(event.id());258 alarm.cookie = QVariant::fromValue<QOrganizerItemId>(event.id());
263 alarm.message = event.displayLabel();259 alarm.message = event.displayLabel();
264 alarm.date = AlarmData::transcodeDate(event.startDateTime().toUTC(), Qt::LocalTime);260 alarm.date = AlarmData::transcodeDate(event.startDateTime(), Qt::LocalTime);
265 alarm.sound = QUrl(event.description());261 QOrganizerItemAudibleReminder audible = event.detail(QOrganizerItemDetail::TypeAudibleReminder);
262 alarm.sound = audible.dataUrl();
266 alarm.originalDate = alarm.date;263 alarm.originalDate = alarm.date;
267264
268 // check if the alarm is enabled or not265 // check if the alarm is enabled or not
@@ -341,13 +338,6 @@
341 if (value.toBool()) {338 if (value.toBool()) {
342 return !todo.tags().contains(tagDisabledAlarm) && todo.tags().contains(tagAlarmService);339 return !todo.tags().contains(tagDisabledAlarm) && todo.tags().contains(tagAlarmService);
343 } else {340 } else {
344 // check if we have the attachments still
345 QOrganizerItemVisualReminder visual = todo.detail(QOrganizerItemDetail::TypeVisualReminder);
346 QOrganizerItemAudibleReminder audible = todo.detail(QOrganizerItemDetail::TypeAudibleReminder);
347 if (visual.isEmpty() || audible.isEmpty()) {
348 // we don't, return failure
349 return false;
350 }
351 return todo.tags().contains(tagDisabledAlarm) && todo.tags().contains(tagAlarmService);341 return todo.tags().contains(tagDisabledAlarm) && todo.tags().contains(tagAlarmService);
352 }342 }
353 }343 }
@@ -361,14 +351,9 @@
361 }351 }
362 case AlarmData::Sound:352 case AlarmData::Sound:
363 {353 {
364 // it is enough to check teh audible presence, as they are added/removed in pair with visual reminder354 // it is enough to check the audible presence, as they are added/removed in pair with visual reminder
365 QOrganizerItemAudibleReminder audible = todo.detail(QOrganizerItemDetail::TypeAudibleReminder);355 QOrganizerItemAudibleReminder audible = todo.detail(QOrganizerItemDetail::TypeAudibleReminder);
366 bool result = todo.description() == value.toString();356 return audible.dataUrl().toString() == value.toString();
367 if (result && !audible.isEmpty()) {
368 // check whether the reminder has the same sound
369 result = audible.dataUrl().toString() == value.toString();
370 }
371 return result;
372 }357 }
373 case AlarmData::Type:358 case AlarmData::Type:
374 {359 {
@@ -415,7 +400,14 @@
415 return adapter->fetch();400 return adapter->fetch();
416}401}
417402
418void AlarmsAdapter::updateAlarms(QList<QOrganizerItemId> list)403bool AlarmsAdapter::compareCookies(const QVariant &cookie1, const QVariant &cookie2)
404{
405 QOrganizerItemId id1 = cookie1.value<QOrganizerItemId>();
406 QOrganizerItemId id2 = cookie2.value<QOrganizerItemId>();
407 return id1 == id2;
408}
409
410void AlarmsAdapter::updateAlarms(const QList<QOrganizerItemId> &list)
419{411{
420 if (list.size() < 0) {412 if (list.size() < 0) {
421 return;413 return;
@@ -443,7 +435,8 @@
443 QVariant cookie = QVariant::fromValue<QOrganizerItemId>(event.id());435 QVariant cookie = QVariant::fromValue<QOrganizerItemId>(event.id());
444 int index = alarmList.indexOfAlarm(cookie);436 int index = alarmList.indexOfAlarm(cookie);
445 if (index < 0) {437 if (index < 0) {
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!");
439 continue;
447 }440 }
448 AlarmData data = alarmList[index];441 AlarmData data = alarmList[index];
449 if (alarmDataFromOrganizerEvent(event, data) == UCAlarm::NoError) {442 if (alarmDataFromOrganizerEvent(event, data) == UCAlarm::NoError) {
@@ -512,10 +505,6 @@
512 endDate = startDate.addDays(8);505 endDate = startDate.addDays(8);
513 }506 }
514507
515 // transcode both dates
516 startDate = AlarmData::transcodeDate(startDate, Qt::UTC);
517 endDate = AlarmData::transcodeDate(endDate, Qt::UTC);
518
519 QList<QOrganizerItem> occurrences = manager->itemOccurrences(event, startDate, endDate, 10);508 QList<QOrganizerItem> occurrences = manager->itemOccurrences(event, startDate, endDate, 10);
520 // get the first occurrence and use the date from it509 // get the first occurrence and use the date from it
521 if ((occurrences.length() > 0) && (occurrences[0].type() == QOrganizerItemType::TypeTodoOccurrence)) {510 if ((occurrences.length() > 0) && (occurrences[0].type() == QOrganizerItemType::TypeTodoOccurrence)) {
@@ -525,7 +514,7 @@
525 // check if the date is after the current datetime514 // check if the date is after the current datetime
526 // the first occurrence is the one closest to the currentDate, therefore we can safely515 // the first occurrence is the one closest to the currentDate, therefore we can safely
527 // set that startDate to the alarm516 // set that startDate to the alarm
528 alarm.date = AlarmData::transcodeDate(occurrence.startDateTime().toUTC(), Qt::LocalTime);517 alarm.date = AlarmData::transcodeDate(occurrence.startDateTime(), Qt::LocalTime);
529 if (alarm.date > currentDate) {518 if (alarm.date > currentDate) {
530 // we have the proper date set, leave519 // we have the proper date set, leave
531 break;520 break;
@@ -587,13 +576,9 @@
587 return false;576 return false;
588 }577 }
589578
590 QOrganizerTodo event;579 QOrganizerItemRemoveByIdRequest *operation = new QOrganizerItemRemoveByIdRequest(q_ptr);
591 AlarmsAdapter::get()->organizerEventFromAlarmData(alarm, event);
592 event.setId(alarm.cookie.value<QOrganizerItemId>());
593
594 QOrganizerItemRemoveRequest *operation = new QOrganizerItemRemoveRequest(q_ptr);
595 operation->setManager(AlarmsAdapter::get()->manager);580 operation->setManager(AlarmsAdapter::get()->manager);
596 operation->setItem(event);581 operation->setItemId(alarm.cookie.value<QOrganizerItemId>());
597 AlarmsAdapter::get()->listDirty = true;582 AlarmsAdapter::get()->listDirty = true;
598 return start(operation);583 return start(operation);
599}584}
@@ -644,7 +629,7 @@
644 completed = false;629 completed = false;
645 // make sure we are in progress state630 // make sure we are in progress state
646 setStatus(requestTypeToOperation(), AlarmRequest::InProgress);631 setStatus(requestTypeToOperation(), AlarmRequest::InProgress);
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()));
648 if (m_request->start()) {633 if (m_request->start()) {
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)
650 if (!completed && m_request->state() >= QOrganizerAbstractRequest::CanceledState) {635 if (!completed && m_request->state() >= QOrganizerAbstractRequest::CanceledState) {
@@ -661,11 +646,11 @@
661void AlarmRequestAdapter::_q_updateProgress()646void AlarmRequestAdapter::_q_updateProgress()
662{647{
663 completed = true;648 completed = true;
664
665 QOrganizerAbstractRequest::State state = m_request->state();649 QOrganizerAbstractRequest::State state = m_request->state();
666 AlarmRequest::Operation opCode = requestTypeToOperation();650 AlarmRequest::Operation opCode = requestTypeToOperation();
667 switch (state) {651 switch (state) {
668 case QOrganizerAbstractRequest::InactiveState: {652 case QOrganizerAbstractRequest::InactiveState: {
653 completed = false;
669 setStatus(opCode, AlarmRequest::Ready);654 setStatus(opCode, AlarmRequest::Ready);
670 break;655 break;
671 }656 }
@@ -730,7 +715,7 @@
730 case QOrganizerAbstractRequest::ItemSaveRequest: {715 case QOrganizerAbstractRequest::ItemSaveRequest: {
731 return AlarmRequest::Saving;716 return AlarmRequest::Saving;
732 }717 }
733 case QOrganizerAbstractRequest::ItemRemoveRequest: {718 case QOrganizerAbstractRequest::ItemRemoveByIdRequest: {
734 return AlarmRequest::Canceling;719 return AlarmRequest::Canceling;
735 }720 }
736 case QOrganizerAbstractRequest::ItemFetchRequest: {721 case QOrganizerAbstractRequest::ItemFetchRequest: {
737722
=== modified file 'modules/Ubuntu/Components/plugin/adapters/alarmsadapter_p.h'
--- modules/Ubuntu/Components/plugin/adapters/alarmsadapter_p.h 2014-09-04 13:47:03 +0000
+++ modules/Ubuntu/Components/plugin/adapters/alarmsadapter_p.h 2014-10-16 21:17:25 +0000
@@ -90,10 +90,11 @@
90 void daysFromSet(AlarmData &alarm, QSet<Qt::DayOfWeek> set);90 void daysFromSet(AlarmData &alarm, QSet<Qt::DayOfWeek> set);
9191
92 bool verifyChange(const QVariant &cookie, AlarmData::Change change, const QVariant &value);92 bool verifyChange(const QVariant &cookie, AlarmData::Change change, const QVariant &value);
93 bool compareCookies(const QVariant &cookie1, const QVariant &cookie2);
9394
94public Q_SLOTS:95public Q_SLOTS:
95 bool fetchAlarms();96 bool fetchAlarms();
96 void updateAlarms(QList<QOrganizerItemId> list);97 void updateAlarms(const QList<QOrganizerItemId> &list);
9798
98protected:99protected:
99 AlarmRequest *fetchRequest;100 AlarmRequest *fetchRequest;
100101
=== modified file 'modules/Ubuntu/Components/plugin/alarmmanager_p.cpp'
--- modules/Ubuntu/Components/plugin/alarmmanager_p.cpp 2014-09-04 13:47:03 +0000
+++ modules/Ubuntu/Components/plugin/alarmmanager_p.cpp 2014-10-16 21:17:25 +0000
@@ -66,5 +66,10 @@
66 return d->verifyChange(pAlarm->rawData.cookie, change, newData);66 return d->verifyChange(pAlarm->rawData.cookie, change, newData);
67}67}
6868
69bool AlarmManager::compareCookies(const QVariant &cookie1, const QVariant &cookie2)
70{
71 Q_D(AlarmManager);
72 return d->compareCookies(cookie1, cookie2);
73}
6974
70#include "moc_alarmmanager_p.cpp"75#include "moc_alarmmanager_p.cpp"
7176
=== modified file 'modules/Ubuntu/Components/plugin/alarmmanager_p.h'
--- modules/Ubuntu/Components/plugin/alarmmanager_p.h 2014-09-04 13:47:03 +0000
+++ modules/Ubuntu/Components/plugin/alarmmanager_p.h 2014-10-16 21:17:25 +0000
@@ -123,26 +123,9 @@
123 bool enabled;123 bool enabled;
124};124};
125125
126// list of alarms
127class AlarmList: public QList<AlarmData>
128{
129public:
130 AlarmList(){}
131
132 // returns the index of the alarm matching a cookie, -1 on error
133 inline int indexOfAlarm(const QVariant &cookie)
134 {
135 for (int i = 0; i < size(); i++) {
136 if (at(i).cookie == cookie) {
137 return i;
138 }
139 }
140 return -1;
141 }
142};
143
144class AlarmRequest;126class AlarmRequest;
145class AlarmManagerPrivate;127class AlarmManagerPrivate;
128class AlarmList;
146class AlarmManager : public QObject129class AlarmManager : public QObject
147{130{
148 Q_OBJECT131 Q_OBJECT
@@ -160,6 +143,7 @@
160 AlarmList alarms() const;143 AlarmList alarms() const;
161144
162 bool verifyChange(UCAlarm *alarm, AlarmData::Change change, const QVariant &newData);145 bool verifyChange(UCAlarm *alarm, AlarmData::Change change, const QVariant &newData);
146 bool compareCookies(const QVariant &cookie1, const QVariant &cookie2);
163147
164Q_SIGNALS:148Q_SIGNALS:
165 void alarmsChanged();149 void alarmsChanged();
@@ -172,4 +156,22 @@
172 QScopedPointer<AlarmManagerPrivate> d_ptr;156 QScopedPointer<AlarmManagerPrivate> d_ptr;
173};157};
174158
159// list of alarms
160class AlarmList: public QList<AlarmData>
161{
162public:
163 AlarmList(){}
164
165 // returns the index of the alarm matching a cookie, -1 on error
166 inline int indexOfAlarm(const QVariant &cookie)
167 {
168 for (int i = 0; i < size(); i++) {
169 if (AlarmManager::instance().compareCookies(at(i).cookie, cookie)) {
170 return i;
171 }
172 }
173 return -1;
174 }
175};
176
175#endif // ALARMMANAGER_H177#endif // ALARMMANAGER_H
176178
=== modified file 'modules/Ubuntu/Components/plugin/alarmmanager_p_p.h'
--- modules/Ubuntu/Components/plugin/alarmmanager_p_p.h 2014-09-04 13:47:03 +0000
+++ modules/Ubuntu/Components/plugin/alarmmanager_p_p.h 2014-10-16 21:17:25 +0000
@@ -44,6 +44,8 @@
4444
45 virtual bool fetchAlarms() = 0;45 virtual bool fetchAlarms() = 0;
4646
47 virtual bool compareCookies(const QVariant &cookie1, const QVariant &cookie2) = 0;
48
47 // function to verify whether the given alarm property has a given value set49 // function to verify whether the given alarm property has a given value set
48 // used for testing purposes50 // used for testing purposes
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;
5052
=== modified file 'modules/Ubuntu/Components/plugin/plugin.cpp'
--- modules/Ubuntu/Components/plugin/plugin.cpp 2014-09-07 16:42:47 +0000
+++ modules/Ubuntu/Components/plugin/plugin.cpp 2014-10-16 21:17:25 +0000
@@ -35,7 +35,6 @@
35#include "inversemouseareatype.h"35#include "inversemouseareatype.h"
36#include "qquickclipboard.h"36#include "qquickclipboard.h"
37#include "qquickmimedata.h"37#include "qquickmimedata.h"
38#include "thumbnailgenerator.h"
39#include "ucubuntuanimation.h"38#include "ucubuntuanimation.h"
40#include "ucfontutils.h"39#include "ucfontutils.h"
41#include "ucarguments.h"40#include "ucarguments.h"
@@ -214,12 +213,6 @@
214 // register icon provider213 // register icon provider
215 engine->addImageProvider(QLatin1String("theme"), new UnityThemeIconProvider);214 engine->addImageProvider(QLatin1String("theme"), new UnityThemeIconProvider);
216215
217 try {
218 engine->addImageProvider(QLatin1String("thumbnailer"), new ThumbnailGenerator);
219 } catch(std::runtime_error &e) {
220 qDebug() << "Could not create thumbnailer: " << e.what();
221 }
222
223 // Necessary for Screen.orientation (from import QtQuick.Window 2.0) to work216 // Necessary for Screen.orientation (from import QtQuick.Window 2.0) to work
224 QGuiApplication::primaryScreen()->setOrientationUpdateMask(217 QGuiApplication::primaryScreen()->setOrientationUpdateMask(
225 Qt::PortraitOrientation |218 Qt::PortraitOrientation |
226219
=== modified file 'modules/Ubuntu/Components/plugin/plugin.pro'
--- modules/Ubuntu/Components/plugin/plugin.pro 2014-09-07 16:42:47 +0000
+++ modules/Ubuntu/Components/plugin/plugin.pro 2014-10-16 21:17:25 +0000
@@ -1,6 +1,6 @@
1unix {1unix {
2 CONFIG += link_pkgconfig2 CONFIG += link_pkgconfig
3 PKGCONFIG += gio-2.0 thumbnailer dbus-1 libnih-dbus3 PKGCONFIG += gio-2.0 dbus-1 libnih-dbus
4}4}
55
6TEMPLATE = lib6TEMPLATE = lib
@@ -50,7 +50,6 @@
50 alarmmanager_p.h \50 alarmmanager_p.h \
51 ucalarmmodel.h \51 ucalarmmodel.h \
52 unitythemeiconprovider.h \52 unitythemeiconprovider.h \
53 thumbnailgenerator.h \
54 alarmrequest_p.h \53 alarmrequest_p.h \
55 alarmrequest_p_p.h \54 alarmrequest_p_p.h \
56 adapters/alarmsadapter_p.h \55 adapters/alarmsadapter_p.h \
@@ -93,7 +92,6 @@
93 alarmmanager_p.cpp \92 alarmmanager_p.cpp \
94 ucalarmmodel.cpp \93 ucalarmmodel.cpp \
95 unitythemeiconprovider.cpp \94 unitythemeiconprovider.cpp \
96 thumbnailgenerator.cpp \
97 alarmrequest_p.cpp \95 alarmrequest_p.cpp \
98 ucstatesaver.cpp \96 ucstatesaver.cpp \
99 sortbehavior.cpp \97 sortbehavior.cpp \
10098
=== removed file 'modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp'
--- modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp 2014-05-27 14:07:00 +0000
+++ modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp 1970-01-01 00:00:00 +0000
@@ -1,87 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors: Jussi Pakkanen <jussi.pakkanen@canonical.com>
17*/
18
19#include "thumbnailgenerator.h"
20#include <stdexcept>
21#include <QDebug>
22#include <QMimeDatabase>
23#include <QUrl>
24
25const char *DEFAULT_VIDEO_ART = "/usr/share/unity/icons/video_missing.png";
26const char *DEFAULT_ALBUM_ART = "/usr/share/unity/icons/album_missing.png";
27
28ThumbnailGenerator::ThumbnailGenerator() : QQuickImageProvider(QQuickImageProvider::Image,
29 QQmlImageProviderBase::ForceAsynchronousImageLoading) {
30
31}
32
33QImage ThumbnailGenerator::requestImage(const QString &id, QSize *realSize,
34 const QSize &requestedSize) {
35 /* Allow appending a query string (e.g. ?something=timestamp)
36 * to the id and then ignore it.
37 * This is workaround to force reloading a thumbnail when it has
38 * the same file name on disk but we know the content has changed.
39 * It is necessary because in such a situation the QML image cache
40 * will kick in and this ImageProvider will never get called.
41 * The only "solution" is setting Image.cache = false, but in some
42 * cases we don't want to do that for performance reasons, so this
43 * is the only way around the issue for now. */
44 std::string src_path(QUrl(id).path().toUtf8().data());
45 std::string tgt_path;
46 const int xlarge_cutoff = 512;
47 const int large_cutoff = 256;
48 const int small_cutoff = 128;
49 try {
50 ThumbnailSize desiredSize;
51 if(requestedSize.width() > xlarge_cutoff || requestedSize.height() > xlarge_cutoff) {
52 desiredSize = TN_SIZE_ORIGINAL;
53 } else if(requestedSize.width() > large_cutoff || requestedSize.height() > large_cutoff) {
54 desiredSize = TN_SIZE_XLARGE;
55 } else if(requestedSize.width() > small_cutoff || requestedSize.height() > small_cutoff) {
56 desiredSize = TN_SIZE_LARGE;
57 } else {
58 desiredSize = TN_SIZE_SMALL;
59 }
60 tgt_path = tn.get_thumbnail(src_path, desiredSize);
61 if(!tgt_path.empty()) {
62 QString tgt(tgt_path.c_str());
63 QImage image;
64 image.load(tgt);
65 *realSize = image.size();
66 return image;
67 }
68 } catch(std::runtime_error &e) {
69 qDebug() << "Thumbnail generator failed: " << e.what();
70 }
71 return getFallbackImage(id, realSize, requestedSize);
72}
73
74QImage ThumbnailGenerator::getFallbackImage(const QString &id, QSize *size,
75 const QSize &requestedSize) {
76 Q_UNUSED(requestedSize);
77 QMimeDatabase db;
78 QMimeType mime = db.mimeTypeForFile(id);
79 QImage result;
80 if(mime.name().contains("audio")) {
81 result.load(DEFAULT_ALBUM_ART);
82 } else if(mime.name().contains("video")) {
83 result.load(DEFAULT_VIDEO_ART);
84 }
85 *size = result.size();
86 return result;
87}
880
=== removed file 'modules/Ubuntu/Components/plugin/thumbnailgenerator.h'
--- modules/Ubuntu/Components/plugin/thumbnailgenerator.h 2013-10-10 10:56:22 +0000
+++ modules/Ubuntu/Components/plugin/thumbnailgenerator.h 1970-01-01 00:00:00 +0000
@@ -1,36 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors: Jussi Pakkanen <jussi.pakkanen@canonical.com>
17*/
18
19#ifndef THUMBNAIL_GENERATOR_H
20#define THUMBNAIL_GENERATOR_H
21
22#include <QQuickImageProvider>
23#include <thumbnailer.h>
24
25class ThumbnailGenerator: public QQuickImageProvider
26{
27private:
28 Thumbnailer tn;
29
30public:
31 ThumbnailGenerator();
32 QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize);
33 QImage getFallbackImage(const QString &id, QSize *size, const QSize &requestedSize);
34};
35
36#endif
370
=== modified file 'modules/Ubuntu/Components/plugin/ucactioncontext.h'
--- modules/Ubuntu/Components/plugin/ucactioncontext.h 2014-09-16 07:49:07 +0000
+++ modules/Ubuntu/Components/plugin/ucactioncontext.h 2014-10-16 21:17:25 +0000
@@ -27,6 +27,7 @@
27class UCActionContext : public QObject, public QQmlParserStatus27class UCActionContext : public QObject, public QQmlParserStatus
28{28{
29 Q_OBJECT29 Q_OBJECT
30 Q_INTERFACES(QQmlParserStatus)
30 Q_PROPERTY(QQmlListProperty<QObject> actions READ actions)31 Q_PROPERTY(QQmlListProperty<QObject> actions READ actions)
31 Q_PROPERTY(bool active MEMBER m_active WRITE setActive NOTIFY activeChanged)32 Q_PROPERTY(bool active MEMBER m_active WRITE setActive NOTIFY activeChanged)
32 Q_CLASSINFO("DefaultProperty", "actions")33 Q_CLASSINFO("DefaultProperty", "actions")
3334
=== modified file 'modules/Ubuntu/Components/plugin/ucactionmanager.h'
--- modules/Ubuntu/Components/plugin/ucactionmanager.h 2014-09-16 07:49:07 +0000
+++ modules/Ubuntu/Components/plugin/ucactionmanager.h 2014-10-16 21:17:25 +0000
@@ -26,6 +26,7 @@
26class UCActionManager : public QObject, public QQmlParserStatus26class UCActionManager : public QObject, public QQmlParserStatus
27{27{
28 Q_OBJECT28 Q_OBJECT
29 Q_INTERFACES(QQmlParserStatus)
29 Q_PROPERTY(QQmlListProperty<QObject> actions READ actions)30 Q_PROPERTY(QQmlListProperty<QObject> actions READ actions)
30 Q_PROPERTY(QQmlListProperty<QObject> localContexts READ localContexts)31 Q_PROPERTY(QQmlListProperty<QObject> localContexts READ localContexts)
31 Q_PROPERTY(UCActionContext *globalContext READ globalContext CONSTANT)32 Q_PROPERTY(UCActionContext *globalContext READ globalContext CONSTANT)
3233
=== modified file 'modules/Ubuntu/Components/plugin/ucscalingimageprovider.cpp'
--- modules/Ubuntu/Components/plugin/ucscalingimageprovider.cpp 2014-09-18 09:29:49 +0000
+++ modules/Ubuntu/Components/plugin/ucscalingimageprovider.cpp 2014-10-16 21:17:25 +0000
@@ -65,7 +65,7 @@
65 }65 }
66 }66 }
6767
68 if (constrainedSize.isValid()) {68 if (!constrainedSize.isEmpty()) {
69 imageReader.setScaledSize(constrainedSize);69 imageReader.setScaledSize(constrainedSize);
70 } else if (scaledSize != realSize) {70 } else if (scaledSize != realSize) {
71 imageReader.setScaledSize(scaledSize);71 imageReader.setScaledSize(scaledSize);
7272
=== modified file 'modules/Ubuntu/PerformanceMetrics/plugin/rendertimer.cpp'
--- modules/Ubuntu/PerformanceMetrics/plugin/rendertimer.cpp 2014-02-11 17:40:02 +0000
+++ modules/Ubuntu/PerformanceMetrics/plugin/rendertimer.cpp 2014-10-16 21:17:25 +0000
@@ -20,14 +20,67 @@
20#include <QtGui/QOpenGLContext>20#include <QtGui/QOpenGLContext>
21#include "rendertimer.h"21#include "rendertimer.h"
2222
23#if defined(QT_OPENGL_ES)
24#include <EGL/egl.h>
25#include <EGL/eglext.h>
26#endif
27
23#if !defined(GL_TIME_ELAPSED)28#if !defined(GL_TIME_ELAPSED)
24#define GL_TIME_ELAPSED 0x88BF29#define GL_TIME_ELAPSED 0x88BF
25#endif30#endif
2631
32class RenderTimerPrivate
33{
34public:
35
36 RenderTimerPrivate() :
37 m_type(RenderTimer::Trivial)
38 { }
39
40 RenderTimer::TimerType m_type;
41 QElapsedTimer m_trivialTimer;
42
43#if defined(QT_OPENGL_ES)
44 struct {
45 void (QOPENGLF_APIENTRYP genFencesNV)(GLsizei n, GLuint* fences);
46 void (QOPENGLF_APIENTRYP deleteFencesNV)(GLsizei n, const GLuint* fences);
47 void (QOPENGLF_APIENTRYP setFenceNV)(GLuint fence, GLenum condition);
48 void (QOPENGLF_APIENTRYP finishFenceNV)(GLuint fence);
49 } m_fenceNV;
50 GLuint m_fence[2];
51
52 struct {
53 EGLSyncKHR (QOPENGLF_APIENTRYP createSyncKHR)(EGLDisplay dpy, EGLenum type,
54 const EGLint* attrib_list);
55 EGLBoolean (QOPENGLF_APIENTRYP destroySyncKHR)(EGLDisplay dpy, EGLSyncKHR sync);
56 EGLint (QOPENGLF_APIENTRYP clientWaitSyncKHR)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags,
57 EGLTimeKHR timeout);
58 } m_fenceSyncKHR;
59 EGLSyncKHR m_beforeSync;
60#else
61 struct {
62 void (QOPENGLF_APIENTRYP genQueries)(GLsizei n, GLuint* ids);
63 void (QOPENGLF_APIENTRYP deleteQueries)(GLsizei n, const GLuint* ids);
64 void (QOPENGLF_APIENTRYP beginQuery)(GLenum target, GLuint id);
65 void (QOPENGLF_APIENTRYP endQuery)(GLenum target);
66 void (QOPENGLF_APIENTRYP getQueryObjectui64v)(GLuint id, GLenum pname, GLuint64* params);
67 void (QOPENGLF_APIENTRYP getQueryObjectui64vExt)(GLuint id, GLenum pname, GLuint64EXT* params);
68 void (QOPENGLF_APIENTRYP queryCounter)(GLuint id, GLenum target);
69 } m_timerQuery;
70 enum { TimerQueryUnavailable, TimerQueryCore, TimerQueryExt } m_timerQueryVersion;
71 GLuint m_timer[2];
72#endif
73};
74
27RenderTimer::RenderTimer(QObject* parent) :75RenderTimer::RenderTimer(QObject* parent) :
28 QObject(parent),76 QObject(parent)
29 m_type(RenderTimer::Trivial)77{
30{78 d_ptr = new RenderTimerPrivate;
79}
80
81RenderTimer::~RenderTimer()
82{
83 delete d_ptr;
31}84}
3285
33bool RenderTimer::isAvailable(TimerType type)86bool RenderTimer::isAvailable(TimerType type)
@@ -89,132 +142,136 @@
89142
90void RenderTimer::setup(TimerType type)143void RenderTimer::setup(TimerType type)
91{144{
145 Q_D(RenderTimer);
92 if (type == RenderTimer::Automatic) {146 if (type == RenderTimer::Automatic) {
93 type = RenderTimer::optimalTimerType();147 type = RenderTimer::optimalTimerType();
94 }148 }
95149
96 m_type = type;150 d->m_type = type;
97151
98 if (m_type == RenderTimer::Trivial) {152 if (d->m_type == RenderTimer::Trivial) {
99#if defined(QT_OPENGL_ES)153#if defined(QT_OPENGL_ES)
100 } else if (m_type == RenderTimer::KHRFence) {154 } else if (d->m_type == RenderTimer::KHRFence) {
101 m_fenceSyncKHR.createSyncKHR = reinterpret_cast<155 d->m_fenceSyncKHR.createSyncKHR = reinterpret_cast<
102 EGLSyncKHR (QOPENGLF_APIENTRYP)(EGLDisplay, EGLenum, const EGLint*)>(156 EGLSyncKHR (QOPENGLF_APIENTRYP)(EGLDisplay, EGLenum, const EGLint*)>(
103 eglGetProcAddress("eglCreateSyncKHR"));157 eglGetProcAddress("eglCreateSyncKHR"));
104 m_fenceSyncKHR.destroySyncKHR = reinterpret_cast<158 d->m_fenceSyncKHR.destroySyncKHR = reinterpret_cast<
105 EGLBoolean (QOPENGLF_APIENTRYP)(EGLDisplay, EGLSyncKHR)>(159 EGLBoolean (QOPENGLF_APIENTRYP)(EGLDisplay, EGLSyncKHR)>(
106 eglGetProcAddress("eglDestroySyncKHR"));160 eglGetProcAddress("eglDestroySyncKHR"));
107 m_fenceSyncKHR.clientWaitSyncKHR = reinterpret_cast<161 d->m_fenceSyncKHR.clientWaitSyncKHR = reinterpret_cast<
108 EGLint (QOPENGLF_APIENTRYP)(EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR)>(162 EGLint (QOPENGLF_APIENTRYP)(EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR)>(
109 eglGetProcAddress("eglClientWaitSyncKHR"));163 eglGetProcAddress("eglClientWaitSyncKHR"));
110164
111 } else if (m_type == RenderTimer::NVFence) {165 } else if (d->m_type == RenderTimer::NVFence) {
112 m_fenceNV.genFencesNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, GLuint*)>(166 d->m_fenceNV.genFencesNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, GLuint*)>(
113 eglGetProcAddress("glGenFencesNV"));167 eglGetProcAddress("glGenFencesNV"));
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*)>(
115 eglGetProcAddress("glDeleteFencesNV"));169 eglGetProcAddress("glDeleteFencesNV"));
116 m_fenceNV.setFenceNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint, GLenum)>(170 d->m_fenceNV.setFenceNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint, GLenum)>(
117 eglGetProcAddress("glSetFenceNV"));171 eglGetProcAddress("glSetFenceNV"));
118 m_fenceNV.finishFenceNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint)>(172 d->m_fenceNV.finishFenceNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint)>(
119 eglGetProcAddress("glFinishFenceNV"));173 eglGetProcAddress("glFinishFenceNV"));
120 m_fenceNV.genFencesNV(2, m_fence);174 d->m_fenceNV.genFencesNV(2, d->m_fence);
121#else175#else
122 } else if (m_type == RenderTimer::ARBTimerQuery) {176 } else if (d->m_type == RenderTimer::ARBTimerQuery) {
123 QOpenGLContext* context = QOpenGLContext::currentContext();177 QOpenGLContext* context = QOpenGLContext::currentContext();
124 m_timerQuery.genQueries = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, GLuint*)>(178 d->m_timerQuery.genQueries = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, GLuint*)>(
125 context->getProcAddress("glGenQueries"));179 context->getProcAddress("glGenQueries"));
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*)>(
127 context->getProcAddress("glDeleteQueries"));181 context->getProcAddress("glDeleteQueries"));
128 m_timerQuery.getQueryObjectui64v =182 d->m_timerQuery.getQueryObjectui64v =
129 reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint, GLenum, GLuint64*)>(183 reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint, GLenum, GLuint64*)>(
130 context->getProcAddress("glGetQueryObjectui64v"));184 context->getProcAddress("glGetQueryObjectui64v"));
131 m_timerQuery.queryCounter = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint, GLenum)>(185 d->m_timerQuery.queryCounter = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint, GLenum)>(
132 context->getProcAddress("glQueryCounter"));186 context->getProcAddress("glQueryCounter"));
133 m_timerQueryVersion = TimerQueryCore;187 d->m_timerQueryVersion = RenderTimerPrivate::TimerQueryCore;
134 m_timerQuery.genQueries(2, m_timer);188 d->m_timerQuery.genQueries(2, d->m_timer);
135189
136 } else if (m_type == RenderTimer::EXTTimerQuery) {190 } else if (d->m_type == RenderTimer::EXTTimerQuery) {
137 QOpenGLContext* context = QOpenGLContext::currentContext();191 QOpenGLContext* context = QOpenGLContext::currentContext();
138 m_timerQuery.genQueries = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, GLuint*)>(192 d->m_timerQuery.genQueries = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei, GLuint*)>(
139 context->getProcAddress("glGenQueries"));193 context->getProcAddress("glGenQueries"));
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*)>(
141 context->getProcAddress("glDeleteQueries"));195 context->getProcAddress("glDeleteQueries"));
142 m_timerQuery.beginQuery = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLuint)>(196 d->m_timerQuery.beginQuery = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLuint)>(
143 context->getProcAddress("glBeginQuery"));197 context->getProcAddress("glBeginQuery"));
144 m_timerQuery.endQuery = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum)>(198 d->m_timerQuery.endQuery = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum)>(
145 context->getProcAddress("glEndQuery"));199 context->getProcAddress("glEndQuery"));
146 m_timerQuery.getQueryObjectui64vExt =200 d->m_timerQuery.getQueryObjectui64vExt =
147 reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint, GLenum, GLuint64EXT*)>(201 reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint, GLenum, GLuint64EXT*)>(
148 context->getProcAddress("glGetQueryObjectui64vEXT"));202 context->getProcAddress("glGetQueryObjectui64vEXT"));
149 m_timerQueryVersion = TimerQueryExt;203 d->m_timerQueryVersion = RenderTimerPrivate::TimerQueryExt;
150 m_timerQuery.genQueries(1, m_timer);204 d->m_timerQuery.genQueries(1, d->m_timer);
151#endif205#endif
152 }206 }
153}207}
154208
155void RenderTimer::teardown()209void RenderTimer::teardown()
156{210{
157 teardown(m_type);211 teardown(d_ptr->m_type);
158}212}
159213
160void RenderTimer::teardown(TimerType type)214void RenderTimer::teardown(TimerType type)
161{215{
216 Q_D(RenderTimer);
162 if (type == RenderTimer::Trivial) {217 if (type == RenderTimer::Trivial) {
163#if defined(QT_OPENGL_ES)218#if defined(QT_OPENGL_ES)
164 } else if (type == RenderTimer::KHRFence) {219 } else if (type == RenderTimer::KHRFence) {
165 if (m_beforeSync != EGL_NO_SYNC_KHR) {220 if (d->m_beforeSync != EGL_NO_SYNC_KHR) {
166 m_fenceSyncKHR.destroySyncKHR(eglGetCurrentDisplay(), m_beforeSync);221 d->m_fenceSyncKHR.destroySyncKHR(eglGetCurrentDisplay(), d->m_beforeSync);
167 }222 }
168223
169 } else if (type == RenderTimer::NVFence) {224 } else if (type == RenderTimer::NVFence) {
170 m_fenceNV.deleteFencesNV(2, m_fence);225 d->m_fenceNV.deleteFencesNV(2, d->m_fence);
171#else226#else
172 } else if (type == RenderTimer::ARBTimerQuery) {227 } else if (type == RenderTimer::ARBTimerQuery) {
173 m_timerQuery.deleteQueries(2, m_timer);228 d->m_timerQuery.deleteQueries(2, d->m_timer);
174229
175 } else if (type == RenderTimer::EXTTimerQuery) {230 } else if (type == RenderTimer::EXTTimerQuery) {
176 m_timerQuery.deleteQueries(1, m_timer);231 d->m_timerQuery.deleteQueries(1, d->m_timer);
177#endif232#endif
178 }233 }
179}234}
180235
181void RenderTimer::start()236void RenderTimer::start()
182{237{
183 if (m_type == RenderTimer::Trivial) {238 Q_D(RenderTimer);
184 m_trivialTimer.start();239 if (d->m_type == RenderTimer::Trivial) {
240 d-> m_trivialTimer.start();
185#if defined(QT_OPENGL_ES)241#if defined(QT_OPENGL_ES)
186 } else if (m_type == RenderTimer::KHRFence) {242 } else if (d->m_type == RenderTimer::KHRFence) {
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);
188244
189 } else if (m_type == RenderTimer::NVFence) {245 } else if (d->m_type == RenderTimer::NVFence) {
190 m_fenceNV.setFenceNV(m_fence[0], GL_ALL_COMPLETED_NV);246 d->m_fenceNV.setFenceNV(d->m_fence[0], GL_ALL_COMPLETED_NV);
191#else247#else
192 } else if (m_type == RenderTimer::ARBTimerQuery) {248 } else if (d->m_type == RenderTimer::ARBTimerQuery) {
193 m_timerQuery.queryCounter(m_timer[0], GL_TIMESTAMP);249 d->m_timerQuery.queryCounter(d->m_timer[0], GL_TIMESTAMP);
194250
195 } else if (m_type == RenderTimer::EXTTimerQuery) {251 } else if (d->m_type == RenderTimer::EXTTimerQuery) {
196 m_timerQuery.beginQuery(GL_TIME_ELAPSED, m_timer[0]);252 d->m_timerQuery.beginQuery(GL_TIME_ELAPSED, d->m_timer[0]);
197#endif253#endif
198 }254 }
199}255}
200256
201qint64 RenderTimer::stop()257qint64 RenderTimer::stop()
202{258{
203 if (m_type == RenderTimer::Trivial) {259 Q_D(RenderTimer);
260 if (d->m_type == RenderTimer::Trivial) {
204 glFinish();261 glFinish();
205 return m_trivialTimer.nsecsElapsed();262 return d-> m_trivialTimer.nsecsElapsed();
206#if defined(QT_OPENGL_ES)263#if defined(QT_OPENGL_ES)
207 } else if (m_type == RenderTimer::KHRFence) {264 } else if (d->m_type == RenderTimer::KHRFence) {
208 QElapsedTimer timer;265 QElapsedTimer timer;
209 EGLDisplay dpy = eglGetCurrentDisplay();266 EGLDisplay dpy = eglGetCurrentDisplay();
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);
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);
212 qint64 beforeTime = timer.nsecsElapsed();269 qint64 beforeTime = timer.nsecsElapsed();
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);
214 qint64 afterTime = timer.nsecsElapsed();271 qint64 afterTime = timer.nsecsElapsed();
215 m_fenceSyncKHR.destroySyncKHR(dpy, afterSync);272 d->m_fenceSyncKHR.destroySyncKHR(dpy, afterSync);
216 m_fenceSyncKHR.destroySyncKHR(dpy, m_beforeSync);273 d->m_fenceSyncKHR.destroySyncKHR(dpy, d->m_beforeSync);
217 m_beforeSync = EGL_NO_SYNC_KHR;274 d->m_beforeSync = EGL_NO_SYNC_KHR;
218 if (beforeSyncValue == EGL_CONDITION_SATISFIED_KHR275 if (beforeSyncValue == EGL_CONDITION_SATISFIED_KHR
219 && afterSyncValue == EGL_CONDITION_SATISFIED_KHR) {276 && afterSyncValue == EGL_CONDITION_SATISFIED_KHR) {
220 return afterTime - beforeTime;277 return afterTime - beforeTime;
@@ -222,30 +279,30 @@
222 return -1;279 return -1;
223 }280 }
224281
225 } else if (m_type == RenderTimer::NVFence) {282 } else if (d->m_type == RenderTimer::NVFence) {
226 QElapsedTimer timer;283 QElapsedTimer timer;
227 m_fenceNV.setFenceNV(m_fence[1], GL_ALL_COMPLETED_NV);284 d->m_fenceNV.setFenceNV(d->m_fence[1], GL_ALL_COMPLETED_NV);
228 m_fenceNV.finishFenceNV(m_fence[0]);285 d->m_fenceNV.finishFenceNV(d->m_fence[0]);
229 qint64 beforeTime = timer.nsecsElapsed();286 qint64 beforeTime = timer.nsecsElapsed();
230 m_fenceNV.finishFenceNV(m_fence[1]);287 d->m_fenceNV.finishFenceNV(d->m_fence[1]);
231 qint64 afterTime = timer.nsecsElapsed();288 qint64 afterTime = timer.nsecsElapsed();
232 return afterTime - beforeTime;289 return afterTime - beforeTime;
233#else290#else
234 } else if (m_type == RenderTimer::ARBTimerQuery) {291 } else if (d->m_type == RenderTimer::ARBTimerQuery) {
235 GLuint64 time[2] = { 0, 0 };292 GLuint64 time[2] = { 0, 0 };
236 m_timerQuery.queryCounter(m_timer[1], GL_TIMESTAMP);293 d->m_timerQuery.queryCounter(d->m_timer[1], GL_TIMESTAMP);
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]);
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]);
239 if (time[0] != 0 && time[1] != 0) {296 if (time[0] != 0 && time[1] != 0) {
240 return time[1] - time[0];297 return time[1] - time[0];
241 } else {298 } else {
242 return -1;299 return -1;
243 }300 }
244301
245 } else if (m_type == RenderTimer::EXTTimerQuery) {302 } else if (d->m_type == RenderTimer::EXTTimerQuery) {
246 GLuint64EXT time;303 GLuint64EXT time;
247 m_timerQuery.endQuery(GL_TIME_ELAPSED);304 d->m_timerQuery.endQuery(GL_TIME_ELAPSED);
248 m_timerQuery.getQueryObjectui64vExt(m_timer[0], GL_QUERY_RESULT, &time);305 d->m_timerQuery.getQueryObjectui64vExt(d->m_timer[0], GL_QUERY_RESULT, &time);
249 return static_cast<qint64>(time);306 return static_cast<qint64>(time);
250#endif307#endif
251 }308 }
252309
=== modified file 'modules/Ubuntu/PerformanceMetrics/plugin/rendertimer.h'
--- modules/Ubuntu/PerformanceMetrics/plugin/rendertimer.h 2014-02-11 17:40:02 +0000
+++ modules/Ubuntu/PerformanceMetrics/plugin/rendertimer.h 2014-10-16 21:17:25 +0000
@@ -24,10 +24,7 @@
24#include <QtCore/QElapsedTimer>24#include <QtCore/QElapsedTimer>
25#include <QtGui/qopenglfunctions.h>25#include <QtGui/qopenglfunctions.h>
2626
27#if defined(QT_OPENGL_ES)27class RenderTimerPrivate;
28#include <EGL/egl.h>
29#include <EGL/eglext.h>
30#endif
3128
32class RenderTimer : public QObject29class RenderTimer : public QObject
33{30{
@@ -49,6 +46,7 @@
49 };46 };
5047
51 explicit RenderTimer(QObject* parent = 0);48 explicit RenderTimer(QObject* parent = 0);
49 virtual ~RenderTimer();
5250
53 static bool isAvailable(TimerType type);51 static bool isAvailable(TimerType type);
54 static TimerType optimalTimerType();52 static TimerType optimalTimerType();
@@ -61,39 +59,8 @@
61 void teardown(TimerType type);59 void teardown(TimerType type);
6260
63private:61private:
64 TimerType m_type;62 Q_DECLARE_PRIVATE(RenderTimer)
65 QElapsedTimer m_trivialTimer;63 RenderTimerPrivate *d_ptr;
66
67#if defined(QT_OPENGL_ES)
68 struct {
69 void (QOPENGLF_APIENTRYP genFencesNV)(GLsizei n, GLuint* fences);
70 void (QOPENGLF_APIENTRYP deleteFencesNV)(GLsizei n, const GLuint* fences);
71 void (QOPENGLF_APIENTRYP setFenceNV)(GLuint fence, GLenum condition);
72 void (QOPENGLF_APIENTRYP finishFenceNV)(GLuint fence);
73 } m_fenceNV;
74 GLuint m_fence[2];
75
76 struct {
77 EGLSyncKHR (QOPENGLF_APIENTRYP createSyncKHR)(EGLDisplay dpy, EGLenum type,
78 const EGLint* attrib_list);
79 EGLBoolean (QOPENGLF_APIENTRYP destroySyncKHR)(EGLDisplay dpy, EGLSyncKHR sync);
80 EGLint (QOPENGLF_APIENTRYP clientWaitSyncKHR)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags,
81 EGLTimeKHR timeout);
82 } m_fenceSyncKHR;
83 EGLSyncKHR m_beforeSync;
84#else
85 struct {
86 void (QOPENGLF_APIENTRYP genQueries)(GLsizei n, GLuint* ids);
87 void (QOPENGLF_APIENTRYP deleteQueries)(GLsizei n, const GLuint* ids);
88 void (QOPENGLF_APIENTRYP beginQuery)(GLenum target, GLuint id);
89 void (QOPENGLF_APIENTRYP endQuery)(GLenum target);
90 void (QOPENGLF_APIENTRYP getQueryObjectui64v)(GLuint id, GLenum pname, GLuint64* params);
91 void (QOPENGLF_APIENTRYP getQueryObjectui64vExt)(GLuint id, GLenum pname, GLuint64EXT* params);
92 void (QOPENGLF_APIENTRYP queryCounter)(GLuint id, GLenum target);
93 } m_timerQuery;
94 enum { TimerQueryUnavailable, TimerQueryCore, TimerQueryExt } m_timerQueryVersion;
95 GLuint m_timer[2];
96#endif
97};64};
9865
99#endif // RENDERTIMER_H66#endif // RENDERTIMER_H
10067
=== modified file 'modules/Ubuntu/Test/UbuntuTestCase.qml'
--- modules/Ubuntu/Test/UbuntuTestCase.qml 2014-07-15 11:40:02 +0000
+++ modules/Ubuntu/Test/UbuntuTestCase.qml 2014-10-16 21:17:25 +0000
@@ -101,28 +101,29 @@
101 return center;101 return center;
102 }102 }
103103
104104 /*!
105105 Move Mouse from x,y to distance of dx, dy divided to steps with a stepdelay (ms).
106 /*!106 */
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) {
108 */108 mouseMove(item, x, y);
109 function mouseMoveSlowly(item,x,y,dx,dy,steps,stepdelay) {109 var abs_dx = Math.abs(dx)
110 mouseMove(item,x,y);110 var abs_dy = Math.abs(dy)
111 var step_dx = dx/steps;111 var step_dx = dx / steps;
112 var step_dy = dy/steps;112 var step_dy = dy /steps;
113113
114 var ix = 0;114 var ix = 0;
115 var iy = 0;115 var iy = 0;
116 for (var step=0; step<steps; step++) {116
117 if (ix<dx) {117 for (var step=0; step < steps; step++) {
118 ix += step_dx;118 if (ix < abs_dx) {
119 }119 ix += step_dx;
120 if (iy<dx) {120 }
121 iy += step_dy;121 if (iy < abs_dy) {
122 }122 iy += step_dy;
123 mouseMove(item,x + ix,y + iy,stepdelay);123 }
124 }124 mouseMove(item, x + ix, y + iy, stepdelay);
125 }125 }
126 }
126127
127 /*!128 /*!
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)
129130
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_popover.py'
--- tests/autopilot/ubuntuuitoolkit/tests/components/test_popover.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/components/test_popover.py 2014-10-16 21:17:25 +0000
@@ -0,0 +1,51 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
3# Copyright (C) 2014 Canonical Ltd.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as published by
7# the Free Software Foundation; version 3.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17"""Tests for the Ubuntu UI Toolkit Header component."""
18
19import os
20
21from ubuntuuitoolkit import tests
22
23
24class DialogScrollTestCase(tests.QMLFileAppTestCase):
25
26 path = os.path.abspath(__file__)
27 dir_path = os.path.dirname(path)
28 test_qml_file_path = os.path.join(
29 dir_path, 'test_popover.qml')
30
31 def setUp(self):
32 super(DialogScrollTestCase, self).setUp()
33
34 def test_dialog_small(self):
35 button = self.main_view.select_single(objectName='button_small')
36 self.pointing_device.click_object(button)
37 dialog = self.main_view.select_single(objectName='dialog_small')
38 flickable = dialog.select_single('QQuickFlickable')
39 # There's nothing to reveal
40 self.assertTrue(flickable.atYEnd)
41
42 def test_dialog_scrollable(self):
43 button = self.main_view.select_single(objectName='button_huge')
44 self.pointing_device.click_object(button)
45 dialog = self.main_view.select_single(objectName='dialog_huge')
46 flickable = dialog.select_single('QQuickFlickable')
47 buttlet = dialog.select_single(objectName='buttlet49')
48 # We can scroll
49 self.assertFalse(flickable.atYEnd)
50 flickable.swipe_child_into_view(buttlet)
51 self.assertEqual(flickable.is_child_visible(buttlet), True)
052
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_popover.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/components/test_popover.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/components/test_popover.qml 2014-10-16 21:17:25 +0000
@@ -0,0 +1,70 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.1
19import Ubuntu.Components.Popups 1.0
20
21MainView {
22 width: units.gu(48)
23 height: units.gu(60)
24
25 Page {
26 title: "Popover"
27
28 Column {
29 Button {
30 objectName: "button_small"
31 text: "Small"
32 onClicked: PopupUtils.open(smallDialogComponent)
33 }
34 Button {
35 objectName: "button_huge"
36 text: "Huge"
37 onClicked: PopupUtils.open(hugeDialogComponent)
38 }
39 }
40
41 Component {
42 id: smallDialogComponent
43 Dialog {
44 objectName: "dialog_small"
45 Column {
46 Button {
47 text: "Just a button"
48 }
49 }
50 }
51 }
52
53 Component {
54 id: hugeDialogComponent
55 Dialog {
56 objectName: "dialog_huge"
57 Column {
58 Repeater {
59 model: 50
60
61 Button {
62 objectName: "buttlet%1".arg(index)
63 text: "Button %1".arg(index)
64 }
65 }
66 }
67 }
68 }
69 }
70}
071
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py 2014-07-18 20:09:22 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py 2014-10-16 21:17:25 +0000
@@ -36,16 +36,6 @@
36 id: datePicker36 id: datePicker
37 objectName: 'datePicker'37 objectName: 'datePicker'
38 mode: 'Years|Months|Days'38 mode: 'Years|Months|Days'
39 maximum: {
40 var d = new Date()
41 d.setFullYear('2030')
42 return d
43 }
44 minimum: {
45 var d = new Date()
46 d.setFullYear('1990')
47 return d
48 }
49 date: {39 date: {
50 var d = new Date()40 var d = new Date()
51 d.setFullYear('2010')41 d.setFullYear('2010')
@@ -58,16 +48,6 @@
58 id: timePicker48 id: timePicker
59 objectName: 'timePicker'49 objectName: 'timePicker'
60 mode: 'Hours|Minutes|Seconds'50 mode: 'Hours|Minutes|Seconds'
61 maximum: {
62 var d = new Date()
63 d.setFullYear('2030')
64 return d
65 }
66 minimum: {
67 var d = new Date()
68 d.setFullYear('1990')
69 return d
70 }
71 date: {51 date: {
72 var d = new Date()52 var d = new Date()
73 d.setHours(12)53 d.setHours(12)
@@ -87,6 +67,65 @@
87 self.time_picker = self.main_view.select_single(67 self.time_picker = self.main_view.select_single(
88 pickers.DatePicker, objectName='timePicker')68 pickers.DatePicker, objectName='timePicker')
8969
70class DatePickerBaseTestCaseWithMinMax(DatePickerBaseTestCase):
71
72 test_qml = ("""
73import QtQuick 2.0
74import Ubuntu.Components 1.1
75import Ubuntu.Components.Pickers 1.0
76
77MainView {
78 width: units.gu(48)
79 height: units.gu(60)
80
81 Column {
82 DatePicker {
83 id: datePicker
84 objectName: 'datePicker'
85 mode: 'Years|Months|Days'
86 maximum: {
87 var d = new Date()
88 d.setFullYear('2030')
89 return d
90 }
91 minimum: {
92 var d = new Date()
93 d.setFullYear('1990')
94 return d
95 }
96 date: {
97 var d = new Date()
98 d.setFullYear('2010')
99 d.setMonth('5')
100 d.setDate('15')
101 return d
102 }
103 }
104 DatePicker {
105 id: timePicker
106 objectName: 'timePicker'
107 mode: 'Hours|Minutes|Seconds'
108 maximum: {
109 var d = new Date()
110 d.setFullYear('2030')
111 return d
112 }
113 minimum: {
114 var d = new Date()
115 d.setFullYear('1990')
116 return d
117 }
118 date: {
119 var d = new Date()
120 d.setHours(12)
121 d.setMinutes('30')
122 d.setSeconds('30')
123 return d
124 }
125 }
126 }
127}
128""")
90129
91class DatePickerTestCase(DatePickerBaseTestCase):130class DatePickerTestCase(DatePickerBaseTestCase):
92131
@@ -217,3 +256,12 @@
217 def test_pick_time(self):256 def test_pick_time(self):
218 self.time_picker.pick_time(self.time_to_pick)257 self.time_picker.pick_time(self.time_to_pick)
219 self.assertEqual(self.time_picker.get_time(), self.time_to_pick)258 self.assertEqual(self.time_picker.get_time(), self.time_to_pick)
259
260class DatePickerTestCaseWithMinMax(DatePickerTestCase):
261 """Repeat tests with min/max qml"""
262
263class PickDateFromDatePickerTestCaseWithMinMax(PickDateFromDatePickerTestCase):
264 """Repeat tests with min/max qml"""
265
266class PickTimeFromDatePickerTestCaseWithMinMax(PickTimeFromDatePickerTestCase):
267 """Repeat tests with min/max qml"""
220268
=== modified file 'tests/qmlapicheck.py'
--- tests/qmlapicheck.py 2014-09-03 10:24:54 +0000
+++ tests/qmlapicheck.py 2014-10-16 21:17:25 +0000
@@ -84,6 +84,8 @@
84def skipversion(filename):84def skipversion(filename):
85 for v in ['10', '11']:85 for v in ['10', '11']:
86 filename = filename.replace(v + '/', '')86 filename = filename.replace(v + '/', '')
87 if filename[-8:] == 'qmltypes':
88 filename = os.path.basename(filename)
87 return filename89 return filename
88inputfiles.sort(key=skipversion)90inputfiles.sort(key=skipversion)
8991
@@ -110,7 +112,7 @@
110 if fileinput.filename() in classes:112 if fileinput.filename() in classes:
111 classname = ' '.join(classes[fileinput.filename()])113 classname = ' '.join(classes[fileinput.filename()])
112 else:114 else:
113 classname = fileinput.filename()115 classname = os.path.basename(fileinput.filename())
114 print(classname)116 print(classname)
115117
116 line = line.split('//')[0]118 line = line.split('//')[0]
117119
=== modified file 'tests/qmlapicheck.sh'
--- tests/qmlapicheck.sh 2014-09-05 05:49:46 +0000
+++ tests/qmlapicheck.sh 2014-10-16 21:17:25 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/env sh1#!/usr/bin/env bash
2#2#
3# Copyright 2013 Canonical Ltd.3# Copyright 2013 Canonical Ltd.
4#4#
@@ -15,28 +15,37 @@
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/>.
16#16#
17################################################################################17################################################################################
18BLDDIR=$1
19if [ -z "$BLDDIR" ]; then
20 echo "Usage: " $(basename $0) "BUILDFOLDER"
21 exit 1
22fi
23
18QML="modules/Ubuntu/*/qmldir modules/Ubuntu/Components/*/qmldir"24QML="modules/Ubuntu/*/qmldir modules/Ubuntu/Components/*/qmldir"
19CPP="Ubuntu.Components Ubuntu.Layouts Ubuntu.PerformanceMetrics Ubuntu.Test"25CPP="Ubuntu.Components Ubuntu.Layouts Ubuntu.PerformanceMetrics Ubuntu.Test"
2026
21echo Dumping QML API of C++ components27echo Dumping QML API of C++ components
22echo '' > plugins.qmltypes28echo '' > $BLDDIR/plugins.qmltypes
23ERRORS=029ERRORS=0
24for i in $CPP; do30for i in $CPP; do
25 # Silence spam on stderr due to fonts31 # Silence spam on stderr due to fonts
26 # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/125699932 # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999
27 # https://bugreports.qt-project.org/browse/QTBUG-3624333 # https://bugreports.qt-project.org/browse/QTBUG-36243
28 ALARM_BACKEND=memory qmlplugindump $i 0.1 modules 1>> plugins.qmltypes34 modulePath=${i//./\/}
35 pushd "$BLDDIR/../modules/${modulePath}"
36 ALARM_BACKEND=memory qmlplugindump $i 0.1 ../../ 1>> $BLDDIR/plugins.qmltypes
29 test $? != 0 && ERRORS=137 test $? != 0 && ERRORS=1
38 popd
30done39done
31test $ERRORS = 1 && echo Error: qmlplugindump failed && exit 140test $ERRORS = 1 && echo Error: qmlplugindump failed && exit 1
3241
33echo Running QML API check for $QML42echo Running QML API check for $QML
34# Palette and UbuntuColors gets included in Qt > 5.2 qmlplugindump even though it's qml43# Palette and UbuntuColors gets included in Qt > 5.2 qmlplugindump even though it's qml
35BUILTINS=QQuick,QQml,U1db::,Palette,UbuntuColors python3 tests/qmlapicheck.py $QML plugins.qmltypes > components.api.new44BUILTINS=QQuick,QQml,U1db::,Palette,UbuntuColors python3 tests/qmlapicheck.py $QML $BLDDIR/plugins.qmltypes > $BLDDIR/components.api.new
36test $? != 0 && echo Error: qmlapicheck.py failed && exit 145test $? != 0 && echo Error: qmlapicheck.py failed && exit 1
3746
38echo Verifying the diff between existing and generated API47echo Verifying the diff between existing and generated API
39diff -Fqml -u components.api components.api.new48diff -Fqml -u components.api $BLDDIR/components.api.new
40test $? != 0 && ERRORS=149test $? != 0 && ERRORS=1
4150
42if [ "x$ERRORS" != "x1" ]; then51if [ "x$ERRORS" != "x1" ]; then
4352
=== modified file 'tests/uitk_test_plan.sh'
--- tests/uitk_test_plan.sh 2014-09-22 09:45:35 +0000
+++ tests/uitk_test_plan.sh 2014-10-16 21:17:25 +0000
@@ -29,40 +29,38 @@
29DISTRO="ubuntu-rtm" 29DISTRO="ubuntu-rtm"
30SERIES="14.09"30SERIES="14.09"
31CHANNEL="ubuntu-touch/${DISTRO}/${SERIES}-proposed"31CHANNEL="ubuntu-touch/${DISTRO}/${SERIES}-proposed"
32PWD="0000"32PASSWORD="0000"
33BOOTTIME=30033BOOTTIME=500
34ONLYCOMPARE=false
34 35
35declare -a TEST_SUITE=(36declare -a TEST_SUITE=(
36 " -p dialer-app-autopilot dialer_app"37 " -p ubuntu-ui-toolkit-autopilot ubuntuuitoolkit"
38 " -p webbrowser-app-autopilot webbrowser_app"
39 " -p address-book-app-autopilot address_book_app"
40 " sudoku_app"
41 " online_accounts_ui"
42 " ubuntu_calculator_app"
37 " -p messaging-app-autopilot messaging_app"43 " -p messaging-app-autopilot messaging_app"
38 " -p reminders-app-autopilot reminders"44 " -p mediaplayer-app-autopilot mediaplayer_app"
39 " -p ubuntu-system-settings-autopilot ubuntu_system_settings"
40 " -p ubuntu-html5-ui-toolkit-autopilot ubuntu_html5_ui_toolkit"
41 " -p unity-webapps-qml-autopilot unity_webapps_qml"
42 " -p address-book-app-autopilot address_book_app"
43 " dropping_letters_app"45 " dropping_letters_app"
44 " sudoku_app"46 " -p dialer-app-autopilot dialer_app"
45 " -p ubuntu-ui-toolkit-autopilot ubuntuuitoolkit"47#hangs " -p reminders-app-autopilot reminders"
46 " -p webbrowser-app-autopilot webbrowser_app"
47 " shorts_app"48 " shorts_app"
48 " ubuntu_weather_app"49 " ubuntu_weather_app"
49 " online_accounts_ui"50 " -p ubuntu-system-settings-autopilot ubuntu_system_settings"
51 " music_app"
52 " gallery_app"
50 " filemanager"53 " filemanager"
51 " calendar_app"
52 " music_app"
53 " -p mediaplayer-app-autopilot mediaplayer_app"
54 " ubuntu_terminal_app"54 " ubuntu_terminal_app"
55 " -n unity8"
55 " ubuntu_clock_app"56 " ubuntu_clock_app"
56 " ubuntu_calculator_app"
57 " gallery_app"
58# " -n unity8"
59# " -p camera-app-autopilot camera_app"
60)57)
6158
6259
63UITK_PACKAGES="qtdeclarative5-ubuntu-ui-toolkit-plugin \60UITK_PACKAGES="qtdeclarative5-ubuntu-ui-toolkit-plugin \
64 ubuntu-ui-toolkit-autopilot \61 ubuntu-ui-toolkit-autopilot \
65 ubuntu-ui-toolkit-theme"62 ubuntu-ui-toolkit-theme \
63 qtorganizer5-eds"
6664
67AP_PACKAGES="address-book-service-dummy \65AP_PACKAGES="address-book-service-dummy \
68 python3-lxml \66 python3-lxml \
@@ -86,11 +84,18 @@
86 i=184 i=1
87 while [ $(adb get-state -s ${SERIALNUMBER}) == "unknown" ]85 while [ $(adb get-state -s ${SERIALNUMBER}) == "unknown" ]
88 do86 do
89 echo -ne "Wait: $i seconds\r"87 echo -ne "Wait for adb: $i seconds\r"
90 sleep 188 sleep 1
91 i=$[$i+1]89 i=$[$i+1]
92 done90 done
93 echo -ne '\n'91 echo -ne '\n'
92 until pids=$(adb -s ${SERIALNUMBER} shell pidof unity-system-compositor|egrep -v "^$|initctl:");
93 do
94 echo -ne "Wait for compositor: $i seconds\r"
95 sleep 1;
96 i=$[$i+1]
97 done;
98 echo -ne '\n'
94 return99 return
95 fi100 fi
96 SLEEP=$1101 SLEEP=$1
@@ -113,7 +118,7 @@
113118
114function reset {119function reset {
115 if [ ${RESET} == true -o x"$1" == x-f ]; then120 if [ ${RESET} == true -o x"$1" == x-f ]; then
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"
117 sleep_indicator 120122 sleep_indicator 120
118 /usr/share/qtcreator/ubuntu/scripts/device_wait_for_shell ${SERIALNUMBER} > /dev/null123 /usr/share/qtcreator/ubuntu/scripts/device_wait_for_shell ${SERIALNUMBER} > /dev/null
119 sleep_indicator 10124 sleep_indicator 10
@@ -122,10 +127,9 @@
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." &
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." &
124 sleep_indicator 10129 sleep_indicator 10
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
126 --object-path / \131 adb -s ${SERIALNUMBER} shell "gdbus call --session --dest com.canonical.UnityGreeter --object-path / --method com.canonical.UnityGreeter.HideGreeter|grep -v '\(\)'"
127 --method com.canonical.UnityGreeter.HideGreeter|grep -v '\(\)'"132 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S dbus-send --system --print-reply \
128 adb -s ${SERIALNUMBER} shell "echo 0000|sudo -S dbus-send --system --print-reply \
129 --dest=org.freedesktop.Accounts \133 --dest=org.freedesktop.Accounts \
130 /org/freedesktop/Accounts/User32011 \134 /org/freedesktop/Accounts/User32011 \
131 org.freedesktop.DBus.Properties.Set \135 org.freedesktop.DBus.Properties.Set \
@@ -137,10 +141,10 @@
137function device_comission {141function device_comission {
138 adb -s ${SERIALNUMBER} wait-for-device142 adb -s ${SERIALNUMBER} wait-for-device
139 # Avoid https://bugs.launchpad.net/gallery-app/+bug/1363190143 # Avoid https://bugs.launchpad.net/gallery-app/+bug/1363190
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"
141 # flash the latest image145 # flash the latest image
142 echo -e "Flashing \e[31m${CHANNEL}\e[0m"146 echo -e "Flashing \e[31m${CHANNEL}\e[0m"
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}
144 sleep_indicator ${BOOTTIME}148 sleep_indicator ${BOOTTIME}
145 echo -e "Disable the intro wizard"149 echo -e "Disable the intro wizard"
146 phablet-config -s ${SERIALNUMBER} welcome-wizard --disable150 phablet-config -s ${SERIALNUMBER} welcome-wizard --disable
@@ -148,31 +152,33 @@
148 phablet-config -s ${SERIALNUMBER} edges-intro --disable152 phablet-config -s ${SERIALNUMBER} edges-intro --disable
149 echo -e "Clone the network "153 echo -e "Clone the network "
150 network154 network
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"
152 sleep_indicator 120156 sleep_indicator 120
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"
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
155 echo "Sleep after phablet-click-test-setup";sleep_indicator 120159 echo "Sleep after phablet-click-test-setup";
160 sleep_indicator 120
156 if [ ${PPA} == "archive" ]; then161 if [ ${PPA} == "archive" ]; then
157 echo "Set up with the archive image"162 echo "Set up with the archive image"
158 phablet-config -s ${SERIALNUMBER} writable-image -r 0000 2>&1 > /dev/null163 phablet-config -s ${SERIALNUMBER} writable-image -r ${PASSWORD} 2>&1 > /dev/null
159 echo "Sleep after phablet-config";sleep_indicator 120164 echo "Sleep after phablet-config";
165 sleep_indicator 120
160 network166 network
161 else167 else
162 if [[ "$PPA" =~ ^[0-9]{3}$ ]]; then168 if [[ "$PPA" =~ ^[0-9]{3}$ ]]; then
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"
164 phablet-config -s ${SERIALNUMBER} writable-image -r 0000 2>&1 > /dev/null170 phablet-config -s ${SERIALNUMBER} writable-image -r ${PASSWORD} 2>&1 > /dev/null
165 sleep_indicator 120171 sleep_indicator 120
166 network172 network
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'"
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"
169 else175 else
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"
171 phablet-config -s ${SERIALNUMBER} writable-image -r 0000 2>&1 > /dev/null177 phablet-config -s ${SERIALNUMBER} writable-image -r ${PASSWORD} 2>&1 > /dev/null
172 sleep_indicator 120178 sleep_indicator 120
173 network179 network
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'"
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"
176182
177 fi183 fi
178 fi184 fi
@@ -180,15 +186,38 @@
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}'`
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"
182 echo "Updating APT";188 echo "Updating APT";
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"
184 echo "Install the UITK packages"190 echo "Install the UITK packages"
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"
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}'`
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"
188 # Update APT194 # Update APT
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"
190 # Install the autopilot tests for the apps196 # Install the autopilot tests for the apps
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"
198}
199
200function compare_results {
201 sed -i 's/\r//g' *tests
202 for RESULT_FILE in *${PPA}.tests;
203 do
204 echo "$RESULT_FILE";
205 LAST_LINE=`tail -1 $RESULT_FILE`
206 if [[ "$LAST_LINE" =~ OK || "$LAST_LINE" =~ FAILED ]]; then
207 echo -e "\t"`tail -2 $RESULT_FILE`
208 else
209 echo -e "\t\e[31mBroken tests\e[0m"
210 fi
211 egrep -v "NO TAGS DATABASE" $RESULT_FILE |egrep "^ERROR:|^FAIL:" | while read -r FAILED ;
212 do
213 echo -e "\tFailed with ${PPA} - $FAILED"
214 if grep --quiet "$FAILED" *archive.tests; then
215 echo -e "\tSame on archive"
216 else
217 echo -e "\t\e[31mPossible regression\e[0m"
218 fi
219 done
220 done
192}221}
193222
194while getopts ":hrcintdus:o:p:f:" opt; do223while getopts ":hrcintdus:o:p:f:" opt; do
@@ -216,6 +245,9 @@
216 c)245 c)
217 COMISSION=true246 COMISSION=true
218 ;;247 ;;
248 d)
249 ONLYCOMPARE=true
250 ;;
219 n)251 n)
220 DONOTRUNTESTS=true252 DONOTRUNTESTS=true
221 ;;253 ;;
@@ -227,15 +259,46 @@
227 ;;259 ;;
228 h)260 h)
229 echo "Usage: uitk_test_plan.sh -s [serial number] -m -c"261 echo "Usage: uitk_test_plan.sh -s [serial number] -m -c"
230 echo " -r : Reset after each tests. Default: ${RESET}"262 echo -e "\t-r : Reset after each tests. Default: ${RESET}"
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}"
232 echo " -c : Comission the device with the ${PPA} enabled"264 echo -e "\t-c : Comission the device with the ${PPA} enabled"
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}"
234 echo " -o : Output directory. Default $OUTPUTDIR"266 echo -e "\t-n : Do not run the test set. Default ${DONOTRUNTESTS}"
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"
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."
237 echo " -u : Provision the Development release of Ubuntu. Default is RTM."269 echo -e "\t-f : Filter for the test suite. Default $FILTER"
238 exit270 echo -e "\t-u : Provision the Development release of Ubuntu. Default is RTM."
271 echo ""
272 echo "By default tihe uitk_test_plan.sh flashes the latest RTM image on the device, installs the click application"
273 echo "tests, configures the ppa:ubuntu-sdk-team/staging PPA, installs the UITK from the PPA and executes the test plan."
274 echo ""
275 echo "Validate the staging branch of the UITK against the RTM image"
276 echo -e "\t$ ./uitk_test_plan.sh -c"
277 echo ""
278 echo "Validate the UITK from a CI silo on an RTM image"
279 echo -e "\t$ ./uitk_test_plan.sh -c -p 001"
280 echo ""
281 echo "Validate the UITK from teh archive on an RTM image"
282 echo -e "\t$ ./uitk_test_plan.sh -c -p archive"
283 echo ""
284 echo "Validate the UITK from a specific CI silo on an Ubuntu Utopic image"
285 echo -e "\t$ ./uitk_test_plan.sh -c -p 001 -u"
286 echo ""
287 echo "Provision the device for manual testing with the latest RTM image"
288 echo -e "\t$ ./uitk_test_plan.sh -c -p archive -n"
289 echo ""
290 echo "Provision the device for manual testing with the latest Ubuntu Utopic image"
291 echo -e "\t$ ./uitk_test_plan.sh -c -p archive -u -n"
292 echo ""
293 echo "Run the test plan on an already provisioned device"
294 echo -e "\t$ ./uitk_test_plan.sh"
295 echo ""
296 echo "Run only the UITK tests on an already provisioned device"
297 echo -e "\t$ ./uitk_test_plan.sh -f ubuntuuitoolkit"
298 echo ""
299 echo "Compare the archive test results with the silo 001 results"
300 echo -e "\t$ ./uitk_test_plan.sh -d -p 001"
301 exit
239 ;;302 ;;
240 :)303 :)
241 echo "Option -$OPTARG requires an argument." >&2304 echo "Option -$OPTARG requires an argument." >&2
@@ -243,6 +306,13 @@
243 esac306 esac
244done307done
245308
309if [ ${ONLYCOMPARE} == true ]; then
310 echo "Comparing results with the archive tests"
311 compare_results
312 exit
313fi
314
315
246# Use the first available device for testing316# Use the first available device for testing
247if [ ${LAZY} == true ]; then317if [ ${LAZY} == true ]; then
248 echo "Waiting for a device"318 echo "Waiting for a device"
@@ -260,40 +330,35 @@
260fi330fi
261331
262# Check if the job is only comissioning the device332# Check if the job is only comissioning the device
263if [ ${DONOTRUNTESTS} == true ]; then333if [ ${DONOTRUNTESTS} != true ]; then
264 exit334 # Reset the device for testing
265fi335 reset -f
266336
267# Reset the device for testing337 # Run the test suite
268reset -f338 for TEST_SET in "${TEST_SUITE[@]}"
269339 do
270# Run the test suite340 if [[ ${TEST_SET} =~ ${FILTER} ]]; then
271for TEST_SET in "${TEST_SUITE[@]}"341 APPNAME=${TEST_SET##* }
272do342 LOGFILE="$OUTPUTDIR/${LOGFILENAME}-${APPNAME}-1-${PPA}.tests"
273 if [[ ${TEST_SET} =~ ${FILTER} ]]; then343 COMMAND="phablet-test-run -r ${PASSWORD} -s ${SERIALNUMBER} $TEST_SET >> ${LOGFILE}"
274 APPNAME=${TEST_SET##* }344 echo "<<<=== ${APPNAME} 1 ===>>>" >> ${LOGFILE}
275 LOGFILE="$OUTPUTDIR/${LOGFILENAME}-${APPNAME}-1.tests"345 reset
276 COMMAND="phablet-test-run -s ${SERIALNUMBER} $TEST_SET >> ${LOGFILE}"346 eval ${COMMAND}
277 echo "<<<=== ${APPNAME} 1 ===>>>" >> ${LOGFILE}347 egrep "<<<===|Ran|OK|FAILED" ${LOGFILE}
278 reset348 # check if the tests were successful and re-run after a reset
279 eval ${COMMAND}349 if grep -q "FAILED" ${LOGFILE}; then
280 egrep "<<<===|Ran|OK|FAILED" ${LOGFILE}350 reset -f
281 # check if the tests were successful and re-run after a reset351 LOGFILE="$OUTPUTDIR/${LOGFILENAME}-${APPNAME}-2-${PPA}.tests"
282# if grep -q "FAILED" ${LOGFILE}; then 352 COMMAND="phablet-test-run -r ${PASSWORD} -s ${SERIALNUMBER} $TEST_SET >> ${LOGFILE}"
283# reset -f353 echo "<<<=== ${APPNAME} 2 ===>>>" >> ${LOGFILE}
284# LOGFILE="$OUTPUTDIR/${LOGFILENAME}-${APPNAME}-2.tests"354 eval ${COMMAND}
285# COMMAND="phablet-test-run -s ${SERIALNUMBER} $TEST_SET >> ${LOGFILE}"355 egrep "<<<===|Ran|OK|FAILED" ${LOGFILE}
286# echo "<<<=== ${APPNAME} 2 ===>>>" >> ${LOGFILE}356 fi
287# eval ${COMMAND}357 fi
288# egrep "<<<===|Ran|OK|FAILED" ${LOGFILE}358 done
289# if grep -q "FAILED" ${LOGFILE}; then359fi
290# reset -f360
291# LOGFILE="$OUTPUTDIR/${LOGFILENAME}-${APPNAME}-3.tests"361if [ ${PPA} != "archive" ]; then
292# COMMAND="phablet-test-run -s ${SERIALNUMBER} $TEST_SET >> ${LOGFILE}"362 echo "Comparing results with the archive tests"
293# echo "<<<=== ${APPNAME} 3 ===>>>" >> ${LOGFILE}363 compare_results
294# eval ${COMMAND}364fi
295# egrep "<<<===|Ran|OK|FAILED|FAIL|ERROR:" ${LOGFILE}
296# fi
297# fi
298 fi
299done
300365
=== modified file 'tests/unit/add_qmlmakecheck.pri'
--- tests/unit/add_qmlmakecheck.pri 2014-03-04 12:38:39 +0000
+++ tests/unit/add_qmlmakecheck.pri 2014-10-16 21:17:25 +0000
@@ -8,5 +8,5 @@
8 check.commands += ../../unit/runtest.sh $${TARGET} $${TEST} minimal;8 check.commands += ../../unit/runtest.sh $${TARGET} $${TEST} minimal;
9}9}
10check.commands += cd ../../..;10check.commands += cd ../../..;
11check.commands += sh tests/qmlapicheck.sh || exit 1;11check.commands += tests/qmlapicheck.sh . || exit 1;
12check.commands += cd tests/unit12check.commands += cd tests/unit
1313
=== modified file 'tests/unit/tst_alarms/tst_alarms.cpp'
--- tests/unit/tst_alarms/tst_alarms.cpp 2014-09-25 08:19:55 +0000
+++ tests/unit/tst_alarms/tst_alarms.cpp 2014-10-16 21:17:25 +0000
@@ -45,6 +45,7 @@
45 void syncFetch()45 void syncFetch()
46 {46 {
47 // initiate fetch47 // initiate fetch
48 QSignalSpy spy(&AlarmManager::instance(), SIGNAL(alarmsChanged()));
48 AlarmsAdapter *adapter = AlarmsAdapter::get();49 AlarmsAdapter *adapter = AlarmsAdapter::get();
49 if (!adapter->fetchRequest) {50 if (!adapter->fetchRequest) {
50 adapter->fetchAlarms();51 adapter->fetchAlarms();
@@ -53,9 +54,21 @@
53 adapter->fetchRequest->wait();54 adapter->fetchRequest->wait();
54 }55 }
55 QTest::waitForEvents();56 QTest::waitForEvents();
56 }57 spy.wait(200);
5758 }
58 void waitForRequest(UCAlarm *alarm)59
60 void waitForUpdate(UCAlarm *alarm)
61 {
62 QSignalSpy spy(&AlarmManager::instance(), SIGNAL(alarmsUpdated(QList<QVariant>)));
63 UCAlarmPrivate *pAlarm = UCAlarmPrivate::get(alarm);
64 if (pAlarm->request) {
65 pAlarm->request->wait();
66 }
67 QTest::waitForEvents();
68 spy.wait();
69 }
70
71 void waitAndFetch(UCAlarm *alarm)
59 {72 {
60 UCAlarmPrivate *pAlarm = UCAlarmPrivate::get(alarm);73 UCAlarmPrivate *pAlarm = UCAlarmPrivate::get(alarm);
61 if (pAlarm->request) {74 if (pAlarm->request) {
@@ -136,7 +149,7 @@
136 UCAlarm *alarm = model.get(i);149 UCAlarm *alarm = model.get(i);
137 if (alarm && alarm->message().startsWith("test_")) {150 if (alarm && alarm->message().startsWith("test_")) {
138 alarm->cancel();151 alarm->cancel();
139 waitForRequest(alarm);152 waitAndFetch(alarm);
140 i = 0;153 i = 0;
141 } else {154 } else {
142 i++;155 i++;
@@ -153,7 +166,7 @@
153 void test_singleShotAlarmPass() {166 void test_singleShotAlarmPass() {
154 UCAlarm alarm(QDateTime::currentDateTime().addSecs(4), "test_singleShotAlarmPass");167 UCAlarm alarm(QDateTime::currentDateTime().addSecs(4), "test_singleShotAlarmPass");
155 alarm.save();168 alarm.save();
156 waitForRequest(&alarm);169 waitAndFetch(&alarm);
157 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);170 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
158 QVERIFY(containsAlarm(&alarm));171 QVERIFY(containsAlarm(&alarm));
159 }172 }
@@ -163,7 +176,7 @@
163 UCAlarm alarm(QDateTime::currentDateTime().addSecs(20), UCAlarm::AutoDetect, "test_repeating_autoDetect");176 UCAlarm alarm(QDateTime::currentDateTime().addSecs(20), UCAlarm::AutoDetect, "test_repeating_autoDetect");
164177
165 alarm.save();178 alarm.save();
166 waitForRequest(&alarm);179 waitAndFetch(&alarm);
167 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);180 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
168 QVERIFY(containsAlarm(&alarm));181 QVERIFY(containsAlarm(&alarm));
169 }182 }
@@ -173,7 +186,7 @@
173 UCAlarm alarm(QDateTime::currentDateTime().addSecs(10), UCAlarm::Daily, "test_repeating_daily");186 UCAlarm alarm(QDateTime::currentDateTime().addSecs(10), UCAlarm::Daily, "test_repeating_daily");
174187
175 alarm.save();188 alarm.save();
176 waitForRequest(&alarm);189 waitAndFetch(&alarm);
177 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);190 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
178 QVERIFY(containsAlarm(&alarm));191 QVERIFY(containsAlarm(&alarm));
179 }192 }
@@ -199,7 +212,7 @@
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);
200213
201 alarm.save();214 alarm.save();
202 waitForRequest(&alarm);215 waitAndFetch(&alarm);
203 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);216 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
204 QVERIFY(containsAlarm(&alarm));217 QVERIFY(containsAlarm(&alarm));
205 }218 }
@@ -232,7 +245,7 @@
232 UCAlarmPrivate::get(&firstOccurrence)->checkAlarm();245 UCAlarmPrivate::get(&firstOccurrence)->checkAlarm();
233246
234 alarm.save();247 alarm.save();
235 waitForRequest(&alarm);248 waitAndFetch(&alarm);
236 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);249 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
237 QVERIFY(containsAlarm(&alarm));250 QVERIFY(containsAlarm(&alarm));
238 QVERIFY(containsAlarm(&firstOccurrence));251 QVERIFY(containsAlarm(&firstOccurrence));
@@ -257,7 +270,7 @@
257270
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);
259 alarm.save();272 alarm.save();
260 waitForRequest(&alarm);273 waitAndFetch(&alarm);
261 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);274 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
262 QVERIFY(containsAlarm(&alarm));275 QVERIFY(containsAlarm(&alarm));
263 }276 }
@@ -291,12 +304,12 @@
291 UCAlarm alarm(QDateTime::currentDateTime().addDays(1), "test_cancelPass");304 UCAlarm alarm(QDateTime::currentDateTime().addDays(1), "test_cancelPass");
292305
293 alarm.save();306 alarm.save();
294 waitForRequest(&alarm);307 waitAndFetch(&alarm);
295 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);308 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
296 QVERIFY(containsAlarm(&alarm));309 QVERIFY(containsAlarm(&alarm));
297310
298 alarm.cancel();311 alarm.cancel();
299 waitForRequest(&alarm);312 waitAndFetch(&alarm);
300 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);313 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
301 QVERIFY(!containsAlarm(&alarm));314 QVERIFY(!containsAlarm(&alarm));
302 }315 }
@@ -308,9 +321,9 @@
308 UCAlarm alarm2(dt, "test_twoAlarmsOnSameTime");321 UCAlarm alarm2(dt, "test_twoAlarmsOnSameTime");
309322
310 alarm1.save();323 alarm1.save();
311 waitForRequest(&alarm1);324 waitAndFetch(&alarm1);
312 alarm2.save();325 alarm2.save();
313 waitForRequest(&alarm2);326 waitAndFetch(&alarm2);
314 QCOMPARE(alarm1.error(), (int)UCAlarm::NoError);327 QCOMPARE(alarm1.error(), (int)UCAlarm::NoError);
315 QCOMPARE(alarm2.error(), (int)UCAlarm::NoError);328 QCOMPARE(alarm2.error(), (int)UCAlarm::NoError);
316 }329 }
@@ -322,9 +335,9 @@
322 UCAlarm alarm2(dt, UCAlarm::Daily, "test_twoAlarmsOnSameTime2");335 UCAlarm alarm2(dt, UCAlarm::Daily, "test_twoAlarmsOnSameTime2");
323336
324 alarm1.save();337 alarm1.save();
325 waitForRequest(&alarm1);338 waitAndFetch(&alarm1);
326 alarm2.save();339 alarm2.save();
327 waitForRequest(&alarm2);340 waitAndFetch(&alarm2);
328 QCOMPARE(alarm1.error(), (int)UCAlarm::NoError);341 QCOMPARE(alarm1.error(), (int)UCAlarm::NoError);
329 QCOMPARE(alarm2.error(), (int)UCAlarm::NoError);342 QCOMPARE(alarm2.error(), (int)UCAlarm::NoError);
330 }343 }
@@ -336,7 +349,7 @@
336 UCAlarm copy(dt, "test_updateAlarm_SameType");349 UCAlarm copy(dt, "test_updateAlarm_SameType");
337350
338 alarm.save();351 alarm.save();
339 waitForRequest(&alarm);352 waitAndFetch(&alarm);
340 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);353 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
341 QVERIFY(containsAlarm(&alarm));354 QVERIFY(containsAlarm(&alarm));
342355
@@ -344,7 +357,8 @@
344 QVERIFY(!compareAlarms(&alarm, &copy));357 QVERIFY(!compareAlarms(&alarm, &copy));
345358
346 alarm.save();359 alarm.save();
347 waitForRequest(&alarm);360 // do not fetch!
361 waitForUpdate(&alarm);
348 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);362 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
349 QVERIFY(containsAlarm(&alarm));363 QVERIFY(containsAlarm(&alarm));
350 QVERIFY(!containsAlarm(&copy));364 QVERIFY(!containsAlarm(&copy));
@@ -357,14 +371,15 @@
357 UCAlarm copy(dt, "test_updateAlarm_DifferentType");371 UCAlarm copy(dt, "test_updateAlarm_DifferentType");
358372
359 alarm.save();373 alarm.save();
360 waitForRequest(&alarm);374 waitAndFetch(&alarm);
361 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);375 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
362 QVERIFY(containsAlarm(&alarm));376 QVERIFY(containsAlarm(&alarm));
363377
364 alarm.setType(UCAlarm::Repeating);378 alarm.setType(UCAlarm::Repeating);
365 QVERIFY(!compareAlarms(&alarm, &copy));379 QVERIFY(!compareAlarms(&alarm, &copy));
366 alarm.save();380 alarm.save();
367 waitForRequest(&alarm);381 // do not fetch
382 waitForUpdate(&alarm);
368 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);383 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
369 QVERIFY(containsAlarm(&alarm));384 QVERIFY(containsAlarm(&alarm));
370 QVERIFY(!containsAlarm(&copy));385 QVERIFY(!containsAlarm(&copy));
@@ -375,20 +390,20 @@
375 UCAlarm alarm(QDateTime::currentDateTime().addMSecs(5000), UCAlarm::AutoDetect, "test_updateAlarm_Repeating");390 UCAlarm alarm(QDateTime::currentDateTime().addMSecs(5000), UCAlarm::AutoDetect, "test_updateAlarm_Repeating");
376391
377 alarm.save();392 alarm.save();
378 waitForRequest(&alarm);393 waitAndFetch(&alarm);
379 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);394 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
380 QSKIP("https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1322558");395 QSKIP("https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1322558");
381 QVERIFY(containsAlarm(&alarm));396 QVERIFY(containsAlarm(&alarm));
382397
383 alarm.setDate(alarm.date().addDays(1));398 alarm.setDate(alarm.date().addDays(1));
384 alarm.save();399 alarm.save();
385 waitForRequest(&alarm);400 waitForUpdate(&alarm);
386 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);401 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
387 QVERIFY(containsAlarm(&alarm));402 QVERIFY(containsAlarm(&alarm));
388403
389 alarm.setDaysOfWeek(UCAlarm::Daily);404 alarm.setDaysOfWeek(UCAlarm::Daily);
390 alarm.save();405 alarm.save();
391 waitForRequest(&alarm);406 waitForUpdate(&alarm);
392 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);407 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
393 QVERIFY(containsAlarm(&alarm));408 QVERIFY(containsAlarm(&alarm));
394 }409 }
@@ -399,19 +414,19 @@
399 UCAlarm alarm(dt, "test_fetchAlarmPlus7Days");414 UCAlarm alarm(dt, "test_fetchAlarmPlus7Days");
400415
401 alarm.save();416 alarm.save();
402 waitForRequest(&alarm);417 waitAndFetch(&alarm);
403 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);418 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
404 QVERIFY(containsAlarm(&alarm));419 QVERIFY(containsAlarm(&alarm));
405420
406 UCAlarm nextMonth(dt.addMonths(1), "test_fetchAlarmPlus1Month");421 UCAlarm nextMonth(dt.addMonths(1), "test_fetchAlarmPlus1Month");
407 nextMonth.save();422 nextMonth.save();
408 waitForRequest(&nextMonth);423 waitAndFetch(&nextMonth);
409 QCOMPARE(nextMonth.error(), (int)UCAlarm::NoError);424 QCOMPARE(nextMonth.error(), (int)UCAlarm::NoError);
410 QVERIFY(containsAlarm(&nextMonth));425 QVERIFY(containsAlarm(&nextMonth));
411426
412 UCAlarm nextYear(dt.addYears(1), "test_fetchAlarmPlus1Year");427 UCAlarm nextYear(dt.addYears(1), "test_fetchAlarmPlus1Year");
413 nextYear.save();428 nextYear.save();
414 waitForRequest(&nextYear);429 waitAndFetch(&nextYear);
415 QCOMPARE(nextYear.error(), (int)UCAlarm::NoError);430 QCOMPARE(nextYear.error(), (int)UCAlarm::NoError);
416 QVERIFY(containsAlarm(&nextYear));431 QVERIFY(containsAlarm(&nextYear));
417 }432 }
@@ -426,7 +441,7 @@
426 UCAlarm nextAlarm(nextDt, UCAlarm::Daily, "test_correctAlarmOrderDaily");441 UCAlarm nextAlarm(nextDt, UCAlarm::Daily, "test_correctAlarmOrderDaily");
427442
428 alarm.save();443 alarm.save();
429 waitForRequest(&alarm);444 waitAndFetch(&alarm);
430 QTest::qWait(2000);445 QTest::qWait(2000);
431 syncFetch();446 syncFetch();
432 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);447 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
@@ -443,7 +458,7 @@
443 UCAlarm nextAlarm(nextDt, UCAlarm::AutoDetect, "test_correctAlarmOrderWeekly");458 UCAlarm nextAlarm(nextDt, UCAlarm::AutoDetect, "test_correctAlarmOrderWeekly");
444459
445 alarm.save();460 alarm.save();
446 waitForRequest(&alarm);461 waitAndFetch(&alarm);
447 QTest::qWait(2000);462 QTest::qWait(2000);
448 syncFetch();463 syncFetch();
449 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);464 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
@@ -500,7 +515,7 @@
500 UCAlarm alarm(QDateTime::currentDateTime().addSecs(3600), "test_oneTime_dow_" + message);515 UCAlarm alarm(QDateTime::currentDateTime().addSecs(3600), "test_oneTime_dow_" + message);
501 alarm.setDaysOfWeek((UCAlarm::DaysOfWeek)dow);516 alarm.setDaysOfWeek((UCAlarm::DaysOfWeek)dow);
502 alarm.save();517 alarm.save();
503 waitForRequest(&alarm);518 waitAndFetch(&alarm);
504 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);519 QCOMPARE(alarm.error(), (int)UCAlarm::NoError);
505 QVERIFY(containsAlarm(&alarm));520 QVERIFY(containsAlarm(&alarm));
506 }521 }
@@ -531,7 +546,7 @@
531 UCAlarm alarm(QDateTime::currentDateTime().addSecs(60), "test_onetime_sound");546 UCAlarm alarm(QDateTime::currentDateTime().addSecs(60), "test_onetime_sound");
532 alarm.setSound(QUrl("file:///usr/share/sounds/ubuntu/ringtones/Celestial.ogg"));547 alarm.setSound(QUrl("file:///usr/share/sounds/ubuntu/ringtones/Celestial.ogg"));
533 alarm.save();548 alarm.save();
534 waitForRequest(&alarm);549 waitAndFetch(&alarm);
535550
536 UCAlarm saved;551 UCAlarm saved;
537 QVERIFY(findAlarm("test_onetime_sound", saved));552 QVERIFY(findAlarm("test_onetime_sound", saved));
@@ -544,20 +559,20 @@
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");
545 alarm.setSound(QUrl("file:///usr/share/sounds/ubuntu/ringtones/Celestial.ogg"));560 alarm.setSound(QUrl("file:///usr/share/sounds/ubuntu/ringtones/Celestial.ogg"));
546 alarm.save();561 alarm.save();
547 waitForRequest(&alarm);562 waitAndFetch(&alarm);
548 QVERIFY(containsAlarm(&alarm));563 QVERIFY(containsAlarm(&alarm));
549564
550 // update alarm to occur 1h earlier565 // update alarm to occur 1h earlier
551 QDateTime date = alarm.date();566 QDateTime date = alarm.date();
552 date.addSecs(-60);567 date.addSecs(-60);
553 alarm.save();568 alarm.save();
554 waitForRequest(&alarm);569 waitForUpdate(&alarm);
555 QVERIFY(containsAlarm(&alarm));570 QVERIFY(containsAlarm(&alarm));
556571
557 // disable alarm572 // disable alarm
558 alarm.setEnabled(false);573 alarm.setEnabled(false);
559 alarm.save();574 alarm.save();
560 waitForRequest(&alarm);575 waitForUpdate(&alarm);
561 QVERIFY(containsAlarm(&alarm));576 QVERIFY(containsAlarm(&alarm));
562 AlarmData data = getAlarmDataFromAlarmCookie(&alarm);577 AlarmData data = getAlarmDataFromAlarmCookie(&alarm);
563 QVERIFY(data.cookie.isValid());578 QVERIFY(data.cookie.isValid());
@@ -567,14 +582,15 @@
567 void test_change_alarm_sound()582 void test_change_alarm_sound()
568 {583 {
569 UCAlarm alarm(QDateTime::currentDateTime(), UCAlarm::AutoDetect, "test_change_alarm_fields_sound");584 UCAlarm alarm(QDateTime::currentDateTime(), UCAlarm::AutoDetect, "test_change_alarm_fields_sound");
585 alarm.setSound(QUrl("file:///usr/share/sounds/ubuntu/ringtones/Bliss.ogg"));
570 alarm.save();586 alarm.save();
571 waitForRequest(&alarm);587 waitAndFetch(&alarm);
572 QVERIFY(containsAlarm(&alarm));588 QVERIFY(containsAlarm(&alarm));
573589
574 // do the change590 // do the change
575 alarm.setSound(QUrl("file:///usr/share/sounds/ubuntu/ringtones/Celestial.ogg"));591 alarm.setSound(QUrl("file:///usr/share/sounds/ubuntu/ringtones/Sparkle.ogg"));
576 alarm.save();592 alarm.save();
577 waitForRequest(&alarm);593 waitForUpdate(&alarm);
578 QVERIFY(containsAlarm(&alarm));594 QVERIFY(containsAlarm(&alarm));
579595
580 //verify whether we have the desired change596 //verify whether we have the desired change
@@ -595,9 +611,10 @@
595 QFETCH(bool, enabled);611 QFETCH(bool, enabled);
596612
597 UCAlarm alarm(QDateTime::currentDateTime().addDays(1), "test_check_alarm_tags_" + message);613 UCAlarm alarm(QDateTime::currentDateTime().addDays(1), "test_check_alarm_tags_" + message);
614 alarm.setSound(QUrl("file:///usr/share/sounds/ubuntu/ringtones/Marimbach.ogg"));
598 alarm.setEnabled(enabled);615 alarm.setEnabled(enabled);
599 alarm.save();616 alarm.save();
600 waitForRequest(&alarm);617 waitAndFetch(&alarm);
601 QVERIFY(containsAlarm(&alarm));618 QVERIFY(containsAlarm(&alarm));
602619
603 // check the tags620 // check the tags
604621
=== modified file 'tests/unit/tst_i18n/src/LocalizedApp.qml'
--- tests/unit/tst_i18n/src/LocalizedApp.qml 2014-04-23 08:50:20 +0000
+++ tests/unit/tst_i18n/src/LocalizedApp.qml 2014-10-16 21:17:25 +0000
@@ -24,7 +24,7 @@
2424
25 Page {25 Page {
26 objectName: 'page'26 objectName: 'page'
27 title: i18n.dtr('localizedApp', 'Welcome')27 title: i18n.dtr('localizedApp', "Welcome")
28 Button {28 Button {
29 objectName: 'button'29 objectName: 'button'
30 anchors.centerIn: parent30 anchors.centerIn: parent
3131
=== modified file 'tests/unit_x11/tst_components/tst_textarea.qml'
--- tests/unit_x11/tst_components/tst_textarea.qml 2014-06-24 14:03:44 +0000
+++ tests/unit_x11/tst_components/tst_textarea.qml 2014-10-16 21:17:25 +0000
@@ -191,6 +191,16 @@
191191
192 function test_0_readOnly() {192 function test_0_readOnly() {
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")
194
195 textArea.text = "ab";
196 textArea.cursorPosition = 1;
197 textArea.textFormat = TextEdit.PlainText;
198 keyClick(Qt.Key_Return);
199 compare("ab", textArea.text, "No split occurred in plain area");
200
201 textArea.textFormat = TextEdit.RichText;
202 keyClick(Qt.Key_Return);
203 compare(textArea.text.indexOf("<br />"), -1, "No split occurred in rich area");
194 }204 }
195205
196 function test_0_renderType() {206 function test_0_renderType() {

Subscribers

People subscribed via source and target branches

to status/vote changes: