Merge lp:~macslow/unity8/fix-1348092 into lp:unity8

Proposed by Mirco Müller
Status: Merged
Approved by: Michał Sawicz
Approved revision: 1090
Merged at revision: 1254
Proposed branch: lp:~macslow/unity8/fix-1348092
Merge into: lp:unity8
Diff against target: 818 lines (+258/-162)
6 files modified
qml/Notifications/Notification.qml (+132/-46)
qml/Notifications/NotificationMenuItemFactory.qml (+4/-0)
qml/Notifications/Notifications.qml (+1/-1)
qml/Shell.qml (+1/-1)
tests/autopilot/unity8/shell/tests/test_notifications.py (+61/-97)
tests/qmltests/Notifications/tst_Notifications.qml (+59/-17)
To merge this branch: bzr merge lp:~macslow/unity8/fix-1348092
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Daniel d'Andrada (community) Approve
Michał Sawicz Needs Fixing
Albert Astals Cid (community) Abstain
Review via email: mp+228090@code.launchpad.net

Commit message

Implemented the needed visual updates on notifications requested by Design for RTM.

Description of the change

Implemented the needed visual updates on notifications requested by Design for RTM.

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

It needs lp:~macslow/unity8/qmltest-tweak-for-1354406-workaround to be merge to trunk first.

Not directly required to work, but nice to land at roughly the same time is lp:~macslow/unity-notifications/fix-1348092.

* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes.

* Did you make sure that your branch does not contain spurious tags?
Yes.

* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Not applicable.

* If you changed the UI, has there been a design review?
Ongoing.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Looks good. Just one small issue, which I commented inline in the diff

review: Needs Fixing
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

 * Did CI run pass? If not, please explain why.
No, but according to Mirco they were already unstable before that MP and he doesn't know why they fail in CI.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Autopilot failures:
unity8.shell.tests.test_notifications.InteractiveNotificationBase.test_modal_sd_with_greeter(Native Device)
unity8.shell.tests.test_notifications.InteractiveNotificationBase.test_modal_sd_without_greeter(Native Device)
unity8.shell.tests.test_notifications.InteractiveNotificationBase.test_sd_incoming_call(Native Device)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mirco Müller (macslow) wrote :

All AP-issues fixed... just triggered a rebuild for rev1080 to see if it passes on Jenkins too now. Works locally on the desktop.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

qmltestrunner.NotificationRendererTest::test_NotificationRenderer is failing

review: Needs Fixing
Revision history for this message
Daniel d'Andrada (dandrader) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

That failure looks like something that could be caused by your MP:

unity8.shell.tests.test_notifications.InteractiveNotificationBase.test_sd_one_over_two_layout(Native Device)

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mirco Müller (macslow) wrote :

Updated branch requirements, due to latest issues which came up with LP: #1354406

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Ok, top-approving once we also get Jenkins approval (autopilot tests)

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Text conflict in qml/Notifications/Notification.qml
1 conflicts encountered.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Conflict, see ↑↑↑

review: Needs Fixing
Revision history for this message
Mirco Müller (macslow) wrote :

*sigh* fixed conflicts again

Revision history for this message
Albert Astals Cid (aacid) :
review: Abstain
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

We got tags again, please strip...

Revision history for this message
Michał Sawicz (saviq) wrote :

SIM unlock has some badness on it:

https://docs.google.com/a/canonical.com/file/d/0B32jwBcbaPlobmp6eU45aF9mNUE/edit

I managed to get stuck in the SIM PIN dialog, too.

review: Needs Fixing
Revision history for this message
Mirco Müller (macslow) wrote :

I'll look into this.

lp:~macslow/unity8/fix-1348092 updated
1086. By Mirco Müller

Merge with trunk.

1087. By Mirco Müller

Fixed the white bar at the top of fullscreen sim-unlock snap-decision notification.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~macslow/unity8/fix-1348092 updated
1088. By Mirco Müller

Avoid the inset appearance of the surrounding UbuntuShape of a notification.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mirco Müller (macslow) wrote :

Still not passing Jenkins-CI because of PageHeaderLabelTest::test_popover failing.

lp:~macslow/unity8/fix-1348092 updated
1089. By Mirco Müller

Avoid focus-stealing from entry, if checkbox is tapped.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Still looks sane, code-wise

review: Approve
lp:~macslow/unity8/fix-1348092 updated
1090. By Mirco Müller

Merged with trunk.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Notifications/Notification.qml'
2--- qml/Notifications/Notification.qml 2014-08-21 08:04:40 +0000
3+++ qml/Notifications/Notification.qml 2014-09-05 10:04:40 +0000
4@@ -39,19 +39,17 @@
5 property bool fullscreen: false
6 property int maxHeight
7 property int margins
8- property Gradient greenGradient : Gradient {
9- GradientStop { position: 0.0; color: "#3fb24f" }
10- GradientStop { position: 1.0; color: "#3fb24f" }
11- }
12- property Gradient darkgreyGradient: Gradient {
13- GradientStop { position: 0.0; color: "#4d4745" }
14- GradientStop { position: 1.0; color: "#4d4745" }
15- }
16+ readonly property color red: "#fc4949"
17+ readonly property color green: "#3fb24f"
18+ readonly property color sdLightGrey: "#eaeaea"
19+ readonly property color sdDarkGrey: "#dddddd"
20+ readonly property color sdFontColor: "#5d5d5d"
21+ readonly property real contentSpacing: units.gu(2)
22
23 objectName: "background"
24- implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : contentColumn.height + contentColumn.spacing * 2) : 0
25+ implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : outterColumn.height + contentSpacing * 2) : 0
26
27- color: Qt.rgba(0.132, 0.117, 0.109, 0.97)
28+ color: type == Notification.SnapDecision ? sdLightGrey : Qt.rgba(0.132, 0.117, 0.109, 0.97)
29 opacity: 1 // FIXME: 1 because of LP: #1354406 workaround, has to be 0 really
30
31 state: {
32@@ -107,7 +105,7 @@
33 states:[
34 State {
35 name: "contracted"
36- PropertyChanges {target: notification; height: units.gu(8)}
37+ PropertyChanges {target: notification; height: units.gu(10)}
38 },
39 State {
40 name: "expanded"
41@@ -131,6 +129,7 @@
42 color: parent.color
43 opacity: parent.opacity
44 radius: "medium"
45+ borderSource: "none"
46 }
47
48 Rectangle {
49@@ -199,50 +198,41 @@
50 }
51
52 Column {
53- id: contentColumn
54- objectName: "contentColumn"
55+ id: outterColumn
56
57 anchors {
58 left: parent.left
59 right: parent.right
60 top: parent.top
61- margins: fullscreen ? 0 : spacing
62+ margins: 0
63+ topMargin: fullscreen ? 0 : units.gu(2)
64 }
65
66- spacing: units.gu(1)
67+ spacing: units.gu(2)
68
69 Row {
70 id: topRow
71
72- spacing: contentColumn.spacing
73+ spacing: contentSpacing
74 anchors {
75 left: parent.left
76 right: parent.right
77+ margins: contentSpacing
78 }
79
80 ShapedIcon {
81 id: icon
82
83 objectName: "icon"
84- width: units.gu(6)
85- height: units.gu(6)
86+ width: type == Notification.Ephemeral && !bodyLabel.visible ? units.gu(3) : units.gu(6)
87+ height: width
88 shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
89 visible: iconSource !== undefined && iconSource != ""
90- }
91-
92- Image {
93- id: secondaryIcon
94-
95- objectName: "secondaryIcon"
96- width: units.gu(2)
97- height: units.gu(2)
98- visible: source !== undefined && source != ""
99- fillMode: Image.PreserveAspectCrop
100- }
101+ }
102
103 Column {
104 id: labelColumn
105- width: parent.width - x
106+ width: secondaryIcon.visible ? parent.width - x - units.gu(4.5) : parent.width - x
107
108 anchors.verticalCenter: (icon.visible && !bodyLabel.visible) ? icon.verticalCenter : undefined
109
110@@ -255,8 +245,7 @@
111 right: parent.right
112 }
113 fontSize: "medium"
114- font.bold: true
115- color: Theme.palette.selected.backgroundText
116+ color: type == Notification.SnapDecision ? sdFontColor : Theme.palette.selected.backgroundText
117 elide: Text.ElideRight
118 textFormat: Text.PlainText
119 }
120@@ -271,14 +260,27 @@
121 }
122 visible: body != ""
123 fontSize: "small"
124- color: Theme.palette.selected.backgroundText
125- opacity: 0.6
126+ color: type == Notification.SnapDecision ? sdFontColor : Theme.palette.selected.backgroundText
127 wrapMode: Text.WordWrap
128- maximumLineCount: 10
129+ maximumLineCount: 2
130 elide: Text.ElideRight
131 textFormat: Text.PlainText
132 }
133 }
134+
135+ Image {
136+ id: secondaryIcon
137+
138+ objectName: "secondaryIcon"
139+ width: units.gu(3)
140+ height: units.gu(3)
141+ visible: status === Image.Ready
142+ fillMode: Image.PreserveAspectCrop
143+ }
144+ }
145+
146+ ListItem.ThinDivider {
147+ visible: type == Notification.SnapDecision
148 }
149
150 Column {
151@@ -321,6 +323,74 @@
152 }
153 }
154
155+ Column {
156+ id: oneOverTwoCase
157+
158+ anchors {
159+ left: parent.left
160+ right: parent.right
161+ margins: contentSpacing
162+ }
163+
164+ spacing: contentSpacing
165+
166+ visible: notification.type == Notification.SnapDecision && oneOverTwoRepeaterTop.count == 3
167+
168+ Repeater {
169+ id: oneOverTwoRepeaterTop
170+
171+ model: notification.actions
172+ delegate: Loader {
173+ id: oneOverTwoLoaderTop
174+
175+ property string actionId: id
176+ property string actionLabel: label
177+
178+ Component {
179+ id: oneOverTwoButtonTop
180+
181+ Button {
182+ objectName: "notify_oot_button" + index
183+ width: oneOverTwoCase.width
184+ text: oneOverTwoLoaderTop.actionLabel
185+ color: notification.hints["x-canonical-private-affirmative-tint"] == "true" ? green : sdDarkGrey
186+ onClicked: notification.notification.invokeAction(oneOverTwoLoaderTop.actionId)
187+ }
188+ }
189+ sourceComponent: index == 0 ? oneOverTwoButtonTop : undefined
190+ }
191+ }
192+
193+ Row {
194+ spacing: contentSpacing
195+
196+ Repeater {
197+ id: oneOverTwoRepeaterBottom
198+
199+ model: notification.actions
200+ delegate: Loader {
201+ id: oneOverTwoLoaderBottom
202+
203+ property string actionId: id
204+ property string actionLabel: label
205+
206+ Component {
207+ id: oneOverTwoButtonBottom
208+
209+ Button {
210+ objectName: "notify_oot_button" + index
211+ width: oneOverTwoCase.width / 2 - spacing * 2
212+ text: oneOverTwoLoaderBottom.actionLabel
213+ color: index == 1 && notification.hints["x-canonical-private-rejection-tint"] == "true" ? red : sdDarkGrey
214+ onClicked: notification.notification.invokeAction(oneOverTwoLoaderBottom.actionId)
215+ }
216+ }
217+ sourceComponent: (index == 1 || index == 2) ? oneOverTwoButtonBottom : undefined
218+ }
219+ }
220+ }
221+ }
222+
223 Row {
224 id: buttonRow
225
226@@ -328,9 +398,10 @@
227 anchors {
228 left: parent.left
229 right: parent.right
230+ margins: contentSpacing
231 }
232- visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
233- spacing: units.gu(1)
234+ visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0 && !oneOverTwoCase.visible
235+ spacing: units.gu(2)
236 layoutDirection: Qt.RightToLeft
237
238 Repeater {
239@@ -347,10 +418,19 @@
240 id: actionButton
241
242 Button {
243- objectName: "button" + index
244- width: buttonRow.width / 2 - spacing
245+ objectName: "notify_button" + index
246+ width: buttonRow.width / 2 - spacing*2
247 text: loader.actionLabel
248- gradient: notification.hints["x-canonical-private-button-tint"] == "true" && index == 0 ? greenGradient : darkgreyGradient
249+ color: {
250+ var result = sdDarkGrey;
251+ if (index == 0 && notification.hints["x-canonical-private-affirmative-tint"] == "true") {
252+ result = green;
253+ }
254+ if (index == 1 && notification.hints["x-canonical-private-rejection-tint"] == "true") {
255+ result = red;
256+ }
257+ return result;
258+ }
259 onClicked: notification.notification.invokeAction(loader.actionId)
260 }
261 }
262@@ -362,10 +442,16 @@
263 ComboButton {
264 id: comboButton
265
266- objectName: "button2"
267+ objectName: "notify_button2"
268 width: parent.width
269- visible: notification.type == Notification.SnapDecision && actionRepeater.count > 3
270- gradient: darkgreyGradient
271+ anchors {
272+ left: parent.left
273+ right: parent.right
274+ margins: contentSpacing
275+ }
276+
277+ visible: notification.type == Notification.SnapDecision && actionRepeater.count > 3 && !oneOverTwoCase.visible
278+ color: sdDarkGrey
279 onClicked: notification.notification.invokeAction(comboRepeater.itemAt(2).actionId)
280 expanded: false
281 expandedHeight: (comboRepeater.count - 2) * units.gu(4) + units.gu(.5)
282@@ -399,7 +485,7 @@
283 MouseArea {
284 id: comboInputArea
285
286- objectName: "button" + index
287+ objectName: "notify_button" + index
288 width: comboButton.width
289 height: comboIcon.height + units.gu(2)
290
291@@ -421,7 +507,7 @@
292 }
293 width: units.gu(2)
294 height: units.gu(2)
295- color: "white"
296+ color: sdFontColor
297 name: splitLabel[2]
298 }
299
300@@ -434,7 +520,7 @@
301 verticalCenter: comboIcon.verticalCenter
302 }
303 fontSize: "small"
304- color: "white"
305+ color: sdFontColor
306 text: splitLabel[3]
307 }
308 }
309
310=== modified file 'qml/Notifications/NotificationMenuItemFactory.qml'
311--- qml/Notifications/NotificationMenuItemFactory.qml 2014-08-22 09:28:47 +0000
312+++ qml/Notifications/NotificationMenuItemFactory.qml 2014-09-05 10:04:40 +0000
313@@ -55,6 +55,7 @@
314 anchors {
315 left: parent.left
316 right: parent.right
317+ margins: spacing
318 }
319
320 Component.onCompleted: {
321@@ -65,6 +66,7 @@
322
323 Label {
324 text: menuData.label
325+ color: notification.sdFontColor
326 }
327
328 TextField {
329@@ -98,11 +100,13 @@
330 id: checkBox
331
332 checked: false
333+ activeFocusOnPress: false
334 }
335
336 Label {
337 anchors.verticalCenter: checkBox.verticalCenter
338 text: i18n.tr("Show password")
339+ color: notification.sdFontColor
340 }
341 }
342 }
343
344=== modified file 'qml/Notifications/Notifications.qml'
345--- qml/Notifications/Notifications.qml 2014-08-21 08:04:40 +0000
346+++ qml/Notifications/Notifications.qml 2014-09-05 10:04:40 +0000
347@@ -33,7 +33,7 @@
348 id: snapDecisionProxyModel
349
350 model: notificationList.model
351- filterRole: UnityNotifications.ModelInterface.RoleType
352+ filterRole: UnityNotifications.ModelInterface != undefined ? UnityNotifications.ModelInterface.RoleType : 0
353 filterRegExp: RegExp(UnityNotifications.Notification.SnapDecision)
354 }
355
356
357=== modified file 'qml/Shell.qml'
358--- qml/Shell.qml 2014-09-03 07:58:32 +0000
359+++ qml/Shell.qml 2014-09-05 10:04:40 +0000
360@@ -568,7 +568,7 @@
361 visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
362 color: "#000000"
363 anchors.fill: parent
364- opacity: 0.5
365+ opacity: 0.9
366
367 MouseArea {
368 anchors.fill: parent
369
370=== modified file 'tests/autopilot/unity8/shell/tests/test_notifications.py'
371--- tests/autopilot/unity8/shell/tests/test_notifications.py 2014-08-11 15:27:04 +0000
372+++ tests/autopilot/unity8/shell/tests/test_notifications.py 2014-09-05 10:04:40 +0000
373@@ -135,10 +135,7 @@
374 actions = [("action_id", "dummy")]
375 hints = [
376 ("x-canonical-switch-to-application", "true"),
377- (
378- "x-canonical-secondary-icon",
379- self._get_icon_path('applicationIcons/dialer-app.png')
380- )
381+ ("x-canonical-secondary-icon","dialer")
382 ]
383
384 self._create_interactive_notification(
385@@ -170,20 +167,19 @@
386 body = "Frank Zappa\n+44 (0)7736 027340"
387 icon_path = self._get_icon_path('avatars/anna_olsson.png')
388 hints = [
389- (
390- "x-canonical-secondary-icon",
391- self._get_icon_path('applicationIcons/dialer-app.png')
392- ),
393+ ("x-canonical-secondary-icon", "incoming-call"),
394 ("x-canonical-snap-decisions", "true"),
395+ ("x-canonical-private-affirmative-tint", "true"),
396+ ("x-canonical-private-rejection-tint", "true"),
397 ]
398
399 actions = [
400 ('action_accept', 'Hold + Answer'),
401 ('action_decline_1', 'End + Answer'),
402 ('action_decline_2', 'Decline'),
403- ('action_decline_3', 'messages:I missed your call - can you call me now?'),
404- ('action_decline_4', 'messages:I\'m running late. I\'m on my way.'),
405- ('action_decline_5', 'messages:I\'m busy at the moment. I\'ll call later.'),
406+ ('action_decline_3', 'message:I missed your call - can you call me now?'),
407+ ('action_decline_4', 'message:I\'m running late. I\'m on my way.'),
408+ ('action_decline_5', 'message:I\'m busy at the moment. I\'ll call later.'),
409 ('action_decline_6', 'edit:Custom'),
410 ]
411
412@@ -204,13 +200,53 @@
413 notification.pointing_device.click_object(
414 notification.select_single(objectName="combobutton_dropdown"))
415 self.assertThat(
416- notification.select_single(objectName="button2").expanded,
417+ notification.select_single(objectName="notify_button2").expanded,
418 Eventually(Equals(True)))
419 time.sleep(2)
420 notification.pointing_device.click_object(
421- notification.select_single(objectName="button4"))
422+ notification.select_single(objectName="notify_button4"))
423 self.assert_notification_action_id_was_called("action_decline_4")
424
425+
426+ def test_sd_one_over_two_layout(self):
427+ """Snap-decision with three actions should use one-over two button layout."""
428+ unity_proxy = self.launch_unity()
429+ unlock_unity(unity_proxy)
430+
431+ summary = "Theatre at Ferria Stadium"
432+ body = "at Ferria Stadium in Bilbao, Spain\n07578545317"
433+ hints = [
434+ ("x-canonical-snap-decisions", "true"),
435+ ("x-canonical-non-shaped-icon", "true"),
436+ ("x-canonical-private-affirmative-tint", "true")
437+ ]
438+
439+ actions = [
440+ ('action_accept', 'Ok'),
441+ ('action_decline_1', 'Snooze'),
442+ ('action_decline_2', 'View'),
443+ ]
444+
445+ self._create_interactive_notification(
446+ summary,
447+ body,
448+ None,
449+ "NORMAL",
450+ actions,
451+ hints
452+ )
453+
454+ # verify and interact with the triggered snap-decision notification
455+ notify_list = self._get_notifications_list()
456+ get_notification = lambda: notify_list.wait_select_single(
457+ 'Notification', objectName='notification1')
458+ notification = get_notification()
459+ self._assert_notification(
460+ notification, summary, body, False, False, 1.0)
461+ notification.pointing_device.click_object(
462+ notification.select_single(objectName="notify_oot_button0"))
463+ self.assert_notification_action_id_was_called("action_accept")
464+
465 def test_modal_sd_without_greeter(self):
466 """Snap-decision should block input to shell without greeter."""
467 unity_proxy = self.launch_unity()
468@@ -222,6 +258,8 @@
469 hints = [
470 ("x-canonical-snap-decisions", "true"),
471 ("x-canonical-non-shaped-icon", "true"),
472+ ("x-canonical-private-affirmative-tint", "true"),
473+ ("x-canonical-private-rejection-tint", "true"),
474 ]
475
476 actions = [
477@@ -253,7 +291,7 @@
478 self._assert_notification(
479 notification, summary, body, True, False, 1.0)
480 notification.pointing_device.click_object(
481- notification.select_single(objectName="button0"))
482+ notification.select_single(objectName="notify_button0"))
483 self.assert_notification_action_id_was_called("action_accept")
484
485 def test_modal_sd_with_greeter(self):
486@@ -266,6 +304,8 @@
487 hints = [
488 ("x-canonical-snap-decisions", "true"),
489 ("x-canonical-non-shaped-icon", "true"),
490+ ("x-canonical-private-affirmative-tint", "true"),
491+ ("x-canonical-private-rejection-tint", "true"),
492 ]
493
494 actions = [
495@@ -296,7 +336,7 @@
496 self._assert_notification(
497 notification, summary, body, True, False, 1.0)
498 notification.pointing_device.click_object(
499- notification.select_single(objectName="button0"))
500+ notification.select_single(objectName="notify_button0"))
501 self.assert_notification_action_id_was_called("action_accept")
502
503 def _create_interactive_notification(
504@@ -438,10 +478,7 @@
505 "join me and Anna?"
506 icon_path = self._get_icon_path('avatars/anna_olsson.png')
507 hints = [
508- (
509- "x-canonical-secondary-icon",
510- self._get_icon_path('applicationIcons/dialer-app.png')
511- )
512+ ("x-canonical-secondary-icon", "message")
513 ]
514
515 notification = shell.create_ephemeral_notification(
516@@ -474,17 +511,13 @@
517 notify_list = self._get_notifications_list()
518
519 summary = "Upload of image completed"
520- hints = [
521- (
522- "x-canonical-secondary-icon",
523- self._get_icon_path('applicationIcons/facebook.png')
524- )
525- ]
526+ icon_path = self._get_icon_path('applicationIcons/facebook.png')
527+ hints=[]
528
529 notification = shell.create_ephemeral_notification(
530 summary,
531 None,
532- None,
533+ icon_path,
534 hints,
535 "NORMAL",
536 )
537@@ -497,8 +530,8 @@
538 notification(),
539 summary,
540 None,
541+ True,
542 False,
543- True,
544 1.0
545 )
546
547@@ -683,7 +716,7 @@
548 body = 'This bubble uses the icon-title-body layout with a ' \
549 'secondary icon.'
550 icon_path = self._get_icon_path('avatars/anna_olsson.png')
551- hint_icon = self._get_icon_path('applicationIcons/dialer-app.png')
552+ hint_icon = 'dialer'
553
554 notification = shell.create_ephemeral_notification(
555 summary,
556@@ -718,72 +751,3 @@
557 self.assertThat(get_notification, Eventually(NotEquals(None)))
558 self._assert_notification(
559 get_notification(), summary, body, False, False, 1.0)
560-
561- def test_append_hint(self):
562- """Notification has to accumulate body-text using append-hint."""
563- unity_proxy = self.launch_unity()
564- unlock_unity(unity_proxy)
565-
566- notify_list = self._get_notifications_list()
567-
568- summary = 'Cole Raby'
569- body = 'Hey Bro Coly!'
570- icon_path = self._get_icon_path('avatars/amanda.png')
571- body_sum = body
572- notification = shell.create_ephemeral_notification(
573- summary,
574- body,
575- icon_path,
576- hints=[('x-canonical-append', 'true')]
577- )
578-
579- notification.show()
580-
581- get_notification = lambda: notify_list.wait_select_single(
582- 'Notification', objectName='notification1')
583-
584- notification = get_notification()
585- self._assert_notification(
586- notification,
587- summary,
588- body_sum,
589- True,
590- False,
591- 1.0
592- )
593-
594- bodies = [
595- 'What\'s up dude?',
596- 'Did you watch the air-race in Oshkosh last week?',
597- 'Phil owned the place like no one before him!',
598- 'Did really everything in the race work according to regulations?',
599- 'Somehow I think to remember Burt Williams did cut corners and '
600- 'was not punished for this.',
601- 'Hopefully the referees will watch the videos of the race.',
602- 'Burt could get fined with US$ 50000 for that rule-violation :)'
603- ]
604-
605- for new_body in bodies:
606- body = new_body
607- body_sum += '\n' + body
608- notification = shell.create_ephemeral_notification(
609- summary,
610- body,
611- icon_path,
612- hints=[('x-canonical-append', 'true')]
613- )
614- notification.show()
615-
616- get_notification = lambda: notify_list.wait_select_single(
617- 'Notification',
618- objectName='notification1'
619- )
620- notification = get_notification()
621- self._assert_notification(
622- notification,
623- summary,
624- body_sum,
625- True,
626- False,
627- 1.0
628- )
629
630=== modified file 'tests/qmltests/Notifications/tst_Notifications.qml'
631--- tests/qmltests/Notifications/tst_Notifications.qml 2014-06-27 14:46:23 +0000
632+++ tests/qmltests/Notifications/tst_Notifications.qml 2014-09-05 10:04:40 +0000
633@@ -64,7 +64,7 @@
634 function addSnapDecisionNotification() {
635 var n = {
636 type: Notification.SnapDecision,
637- hints: {"x-canonical-private-button-tint": "true"},
638+ hints: {"x-canonical-private-affirmative-tint": "true"},
639 summary: "Tom Ato",
640 body: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.",
641 icon: "../graphics/avatars/funky.png",
642@@ -79,6 +79,22 @@
643 mockModel.append(n)
644 }
645
646+ function add2over1SnapDecisionNotification() {
647+ var n = {
648+ type: Notification.SnapDecision,
649+ hints: {"x-canonical-private-affirmative-tint": "true",},
650+ summary: "Theatre at Ferria Stadium",
651+ body: "at Ferria Stadium in Bilbao, Spain\n07578545317",
652+ icon: "",
653+ secondaryIcon: "",
654+ actions: [{ id: "ok_id", label: "Ok"},
655+ { id: "snooze_id", label: "Snooze"},
656+ { id: "view_id", label: "View"}]
657+ }
658+
659+ mockModel.append(n)
660+ }
661+
662 function addEphemeralNotification() {
663 var n = {
664 type: Notification.Ephemeral,
665@@ -183,6 +199,12 @@
666
667 Button {
668 width: parent.width
669+ text: "add a 2over1 snap-decision"
670+ onClicked: add2over1SnapDecisionNotification()
671+ }
672+
673+ Button {
674+ width: parent.width
675 text: "add an ephemeral"
676 onClicked: addEphemeralNotification()
677 }
678@@ -229,7 +251,7 @@
679 {
680 tag: "Snap Decision with secondary icon and button-tint",
681 type: Notification.SnapDecision,
682- hints: {"x-canonical-private-button-tint": "true"},
683+ hints: {"x-canonical-private-affirmative-tint": "true"},
684 summary: "Tom Ato",
685 body: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.",
686 icon: "../graphics/avatars/funky.png",
687@@ -250,9 +272,30 @@
688 hasSound: false
689 },
690 {
691+ tag: "2-over-1 Snap Decision with button-tint",
692+ type: Notification.SnapDecision,
693+ hints: {"x-canonical-private-affirmative-tint": "true"},
694+ summary: "Theatre at Ferria Stadium",
695+ body: "at Ferria Stadium in Bilbao, Spain\n07578545317",
696+ icon: "",
697+ secondaryIcon: "",
698+ actions: [{ id: "ok_id", label: "Ok"},
699+ { id: "snooze_id", label: "Snooze"},
700+ { id: "view_id", label: "View"}],
701+ summaryVisible: true,
702+ bodyVisible: true,
703+ iconVisible: false,
704+ shapedIcon: false,
705+ nonShapedIcon: false,
706+ secondaryIconVisible: false,
707+ buttonRowVisible: false,
708+ buttonTinted: true,
709+ hasSound: false
710+ },
711+ {
712 tag: "Ephemeral notification - icon-summary layout",
713 type: Notification.Ephemeral,
714- hints: {"x-canonical-private-button-tint": "false"},
715+ hints: {"x-canonical-private-affirmative-tint": "false"},
716 summary: "Photo upload completed",
717 body: "",
718 icon: "",
719@@ -271,7 +314,7 @@
720 {
721 tag: "Ephemeral notification - check suppression of secondary icon for icon-summary layout",
722 type: Notification.Ephemeral,
723- hints: {"x-canonical-private-button-tint": "false",
724+ hints: {"x-canonical-private-affirmative-tint": "false",
725 "sound-file": "dummy.ogg",
726 "suppress-sound": "true"},
727 summary: "New comment successfully published",
728@@ -293,7 +336,7 @@
729 {
730 tag: "Interactive notification",
731 type: Notification.Interactive,
732- hints: {"x-canonical-private-button-tint": "false",
733+ hints: {"x-canonical-private-affirmative-tint": "false",
734 "sound-file": "dummy.ogg"},
735 summary: "Interactive notification",
736 body: "This is a notification that can be clicked",
737@@ -313,7 +356,7 @@
738 {
739 tag: "Snap Decision without secondary icon and no button-tint",
740 type: Notification.SnapDecision,
741- hints: {"x-canonical-private-button-tint": "false",
742+ hints: {"x-canonical-private-affirmative-tint": "false",
743 "sound-file": "dummy.ogg"},
744 summary: "Bro Coly",
745 body: "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
746@@ -334,7 +377,7 @@
747 {
748 tag: "Ephemeral notification",
749 type: Notification.Ephemeral,
750- hints: {"x-canonical-private-button-tint": "false",
751+ hints: {"x-canonical-private-affirmative-tint": "false",
752 "sound-file": "dummy.ogg"},
753 summary: "Cole Raby",
754 body: "I did not expect it to be that late.",
755@@ -354,9 +397,8 @@
756 {
757 tag: "Ephemeral notification with non-shaped icon",
758 type: Notification.Ephemeral,
759- hints: {"x-canonical-private-button-tint": "false",
760- "x-canonical-non-shaped-icon": "true",
761- "sound-file": "dummy.ogg"},
762+ hints: {"x-canonical-private-affirmative-tint": "false",
763+ "x-canonical-non-shaped-icon": "true"},
764 summary: "Contacts",
765 body: "Synchronised contacts-database with cloud-storage.",
766 icon: "../graphics/applicationIcons/contacts-app.png",
767@@ -370,7 +412,7 @@
768 secondaryIconVisible: false,
769 buttonRowVisible: false,
770 buttonTinted: false,
771- hasSound: true
772+ hasSound: false
773 }
774 ]
775 }
776@@ -437,8 +479,8 @@
777 tryCompare(audioItem, "playbackState", data.hasSound ? Audio.PlayingState : Audio.StoppedState)
778
779 if(data.buttonRowVisible) {
780- var buttonCancel = findChild(buttonRow, "button1")
781- var buttonAccept = findChild(buttonRow, "button0")
782+ var buttonCancel = findChild(buttonRow, "notify_button1")
783+ var buttonAccept = findChild(buttonRow, "notify_button0")
784
785 // only test the left/cancel-button if two actions have been passed in
786 if (data.actions.length == 2) {
787@@ -448,7 +490,7 @@
788 }
789
790 // check the tinting of the positive/right button
791- verify(buttonAccept.gradient === data.buttonTinted ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient, "button has the wrong color-tint")
792+ verify(buttonAccept.color === data.buttonTinted ? "#3fb24f" : "#dddddd", "button has the wrong color-tint")
793
794 // click the positive/right button
795 tryCompareFunction(function() { mouseClick(buttonAccept, buttonAccept.width / 2, buttonAccept.height / 2); return actionSpy.signalArguments.length > 0; }, true);
796@@ -458,19 +500,19 @@
797
798 // check if there's a ComboButton created due to more actions being passed
799 if (data.actions.length > 2) {
800- var comboButton = findChild(notification, "button2")
801+ var comboButton = findChild(notification, "notify_button2")
802 tryCompareFunction(function() { return comboButton.expanded == false; }, true);
803
804 // click to expand
805 tryCompareFunction(function() { mouseClick(comboButton, comboButton.width - comboButton.__styleInstance.dropDownWidth / 2, comboButton.height / 2); return comboButton.expanded == true; }, true);
806
807 // try clicking on choices in expanded comboList
808- var choiceButton1 = findChild(notification, "button3")
809+ var choiceButton1 = findChild(notification, "notify_button3")
810 tryCompareFunction(function() { mouseClick(choiceButton1, choiceButton1.width / 2, choiceButton1.height / 2); return actionSpy.signalArguments.length > 0; }, true);
811 compare(actionSpy.signalArguments[0][0], data.actions[3]["id"], "got wrong id choice action 1")
812 actionSpy.clear()
813
814- var choiceButton2 = findChild(notification, "button4")
815+ var choiceButton2 = findChild(notification, "notify_button4")
816 tryCompareFunction(function() { mouseClick(choiceButton2, choiceButton2.width / 2, choiceButton2.height / 2); return actionSpy.signalArguments.length > 0; }, true);
817 compare(actionSpy.signalArguments[0][0], data.actions[4]["id"], "got wrong id choice action 2")
818 actionSpy.clear()

Subscribers

People subscribed via source and target branches