on xenial help sign in
Fixed object-name collisions that caused notification AP-tests to fail... did some visual updates to notification AP-tests... added notification AP-test for the new over-over-two button layout case.
6487085Mirco Müller
qml/Notifications/Notification.qml+5−5
@@ -343,7 +343,7 @@ Item {
343 id: oneOverTwoButtonTop
343 id: oneOverTwoButtonTop
344
344
345 Button {
345 Button {
346− objectName: "button" + index
346+ objectName: "notify_oot_button" + index
347 width: oneOverTwoCase.width
347 width: oneOverTwoCase.width
348 text: oneOverTwoLoaderTop.actionLabel
348 text: oneOverTwoLoaderTop.actionLabel
349 color: notification.hints["x-canonical-private-affirmative-tint"] == "true" ? green : sdDarkGrey
349 color: notification.hints["x-canonical-private-affirmative-tint"] == "true" ? green : sdDarkGrey
@@ -371,7 +371,7 @@ Item {
371 id: oneOverTwoButtonBottom
371 id: oneOverTwoButtonBottom
372
372
373 Button {
373 Button {
374− objectName: "button" + index
374+ objectName: "notify_oot_button" + index
375 width: oneOverTwoCase.width / 2 - spacing * 2
375 width: oneOverTwoCase.width / 2 - spacing * 2
376 text: oneOverTwoLoaderBottom.actionLabel
376 text: oneOverTwoLoaderBottom.actionLabel
377 color: index == 1 && notification.hints["x-canonical-private-rejection-tint"] == "true" ? red : sdDarkGrey
377 color: index == 1 && notification.hints["x-canonical-private-rejection-tint"] == "true" ? red : sdDarkGrey
@@ -411,7 +411,7 @@ Item {
411 id: actionButton
411 id: actionButton
412
412
413 Button {
413 Button {
414− objectName: "button" + index
414+ objectName: "notify_button" + index
415 width: buttonRow.width / 2 - spacing*2
415 width: buttonRow.width / 2 - spacing*2
416 text: loader.actionLabel
416 text: loader.actionLabel
417 color: {
417 color: {
@@ -435,7 +435,7 @@ Item {
435 ComboButton {
435 ComboButton {
436 id: comboButton
436 id: comboButton
437
437
438− objectName: "button2"
438+ objectName: "notify_button2"
439 width: parent.width
439 width: parent.width
440 anchors {
440 anchors {
441 left: parent.left
441 left: parent.left
@@ -478,7 +478,7 @@ Item {
478 MouseArea {
478 MouseArea {
479 id: comboInputArea
479 id: comboInputArea
480
480
481− objectName: "button" + index
481+ objectName: "notify_button" + index
482 width: comboButton.width
482 width: comboButton.width
483 height: comboIcon.height + units.gu(2)
483 height: comboIcon.height + units.gu(2)
484
484
tests/autopilot/unity8/shell/tests/test_notifications.py+68−28
@@ -135,10 +135,7 @@ class InteractiveNotificationBase(NotificationsBase):
135 actions = [("action_id", "dummy")]
135 actions = [("action_id", "dummy")]
136 hints = [
136 hints = [
137 ("x-canonical-switch-to-application", "true"),
137 ("x-canonical-switch-to-application", "true"),
138− (
139− "x-canonical-secondary-icon",
138+ ("x-canonical-secondary-icon","dialer")
140− self._get_icon_path('applicationIcons/dialer-app.png')
141− )
142 ]
139 ]
143
140
144 self._create_interactive_notification(
141 self._create_interactive_notification(
@@ -170,20 +167,19 @@ class InteractiveNotificationBase(NotificationsBase):
170 body = "Frank Zappa\n+44 (0)7736 027340"
167 body = "Frank Zappa\n+44 (0)7736 027340"
171 icon_path = self._get_icon_path('avatars/anna_olsson.png')
168 icon_path = self._get_icon_path('avatars/anna_olsson.png')
172 hints = [
169 hints = [
173− (
174− "x-canonical-secondary-icon",
170+ ("x-canonical-secondary-icon", "incoming-call"),
175− self._get_icon_path('applicationIcons/dialer-app.png')
176− ),
177 ("x-canonical-snap-decisions", "true"),
171 ("x-canonical-snap-decisions", "true"),
172+ ("x-canonical-private-affirmative-tint", "true"),
173+ ("x-canonical-private-rejection-tint", "true"),
178 ]
174 ]
179
175
180 actions = [
176 actions = [
181 ('action_accept', 'Hold + Answer'),
177 ('action_accept', 'Hold + Answer'),
182 ('action_decline_1', 'End + Answer'),
178 ('action_decline_1', 'End + Answer'),
183 ('action_decline_2', 'Decline'),
179 ('action_decline_2', 'Decline'),
184− ('action_decline_3', 'messages:I missed your call - can you call me now?'),
180+ ('action_decline_3', 'message:I missed your call - can you call me now?'),
185− ('action_decline_4', 'messages:I\'m running late. I\'m on my way.'),
181+ ('action_decline_4', 'message:I\'m running late. I\'m on my way.'),
186− ('action_decline_5', 'messages:I\'m busy at the moment. I\'ll call later.'),
182+ ('action_decline_5', 'message:I\'m busy at the moment. I\'ll call later.'),
187 ('action_decline_6', 'edit:Custom'),
183 ('action_decline_6', 'edit:Custom'),
188 ]
184 ]
189
185
@@ -204,13 +200,60 @@ class InteractiveNotificationBase(NotificationsBase):
204 notification.pointing_device.click_object(
200 notification.pointing_device.click_object(
205 notification.select_single(objectName="combobutton_dropdown"))
201 notification.select_single(objectName="combobutton_dropdown"))
206 self.assertThat(
202 self.assertThat(
207− notification.select_single(objectName="button2").expanded,
203+ notification.select_single(objectName="notify_button2").expanded,
208 Eventually(Equals(True)))
204 Eventually(Equals(True)))
209 time.sleep(2)
205 time.sleep(2)
210 notification.pointing_device.click_object(
206 notification.pointing_device.click_object(
211− notification.select_single(objectName="button4"))
207+ notification.select_single(objectName="notify_button4"))
212 self.assert_notification_action_id_was_called("action_decline_4")
208 self.assert_notification_action_id_was_called("action_decline_4")
213
209
210+
211+ def test_sd_one_over_two_layout(self):
212+ """Snap-decision with three actions should use one-over two button layout."""
213+ unity_proxy = self.launch_unity()
214+ unlock_unity(unity_proxy)
215+
216+ summary = "Theatre at Ferria Stadium"
217+ body = "at Ferria Stadium in Bilbao, Spain\n07578545317"
218+ hints = [
219+ ("x-canonical-snap-decisions", "true"),
220+ ("x-canonical-non-shaped-icon", "true"),
221+ ("x-canonical-private-affirmative-tint", "true")
222+ ]
223+
224+ actions = [
225+ ('action_accept', 'Ok'),
226+ ('action_decline_1', 'Snooze'),
227+ ('action_decline_2', 'View'),
228+ ]
229+
230+ self._create_interactive_notification(
231+ summary,
232+ body,
233+ None,
234+ "NORMAL",
235+ actions,
236+ hints
237+ )
238+
239+ # verify that we cannot reveal the launcher (no longer interact with
240+ # the shell)
241+ time.sleep(1)
242+ self.main_window.show_dash_swiping()
243+ launcher = self.main_window.get_launcher()
244+ self.assertThat(launcher.shown, Eventually(Equals(False)))
245+
246+ # verify and interact with the triggered snap-decision notification
247+ notify_list = self._get_notifications_list()
248+ get_notification = lambda: notify_list.wait_select_single(
249+ 'Notification', objectName='notification1')
250+ notification = get_notification()
251+ self._assert_notification(
252+ notification, summary, body, False, False, 1.0)
253+ notification.pointing_device.click_object(
254+ notification.select_single(objectName="notify_oot_button0"))
255+ self.assert_notification_action_id_was_called("action_accept")
256+
214 def test_modal_sd_without_greeter(self):
257 def test_modal_sd_without_greeter(self):
215 """Snap-decision should block input to shell without greeter."""
258 """Snap-decision should block input to shell without greeter."""
216 unity_proxy = self.launch_unity()
259 unity_proxy = self.launch_unity()
@@ -222,6 +265,8 @@ class InteractiveNotificationBase(NotificationsBase):
222 hints = [
265 hints = [
223 ("x-canonical-snap-decisions", "true"),
266 ("x-canonical-snap-decisions", "true"),
224 ("x-canonical-non-shaped-icon", "true"),
267 ("x-canonical-non-shaped-icon", "true"),
268+ ("x-canonical-private-affirmative-tint", "true"),
269+ ("x-canonical-private-rejection-tint", "true"),
225 ]
270 ]
226
271
227 actions = [
272 actions = [
@@ -253,7 +298,7 @@ class InteractiveNotificationBase(NotificationsBase):
253 self._assert_notification(
298 self._assert_notification(
254 notification, summary, body, True, False, 1.0)
299 notification, summary, body, True, False, 1.0)
255 notification.pointing_device.click_object(
300 notification.pointing_device.click_object(
256− notification.select_single(objectName="button0"))
301+ notification.select_single(objectName="notify_button0"))
257 self.assert_notification_action_id_was_called("action_accept")
302 self.assert_notification_action_id_was_called("action_accept")
258
303
259 def test_modal_sd_with_greeter(self):
304 def test_modal_sd_with_greeter(self):
@@ -266,6 +311,8 @@ class InteractiveNotificationBase(NotificationsBase):
266 hints = [
311 hints = [
267 ("x-canonical-snap-decisions", "true"),
312 ("x-canonical-snap-decisions", "true"),
268 ("x-canonical-non-shaped-icon", "true"),
313 ("x-canonical-non-shaped-icon", "true"),
314+ ("x-canonical-private-affirmative-tint", "true"),
315+ ("x-canonical-private-rejection-tint", "true"),
269 ]
316 ]
270
317
271 actions = [
318 actions = [
@@ -296,7 +343,7 @@ class InteractiveNotificationBase(NotificationsBase):
296 self._assert_notification(
343 self._assert_notification(
297 notification, summary, body, True, False, 1.0)
344 notification, summary, body, True, False, 1.0)
298 notification.pointing_device.click_object(
345 notification.pointing_device.click_object(
299− notification.select_single(objectName="button0"))
346+ notification.select_single(objectName="notify_button0"))
300 self.assert_notification_action_id_was_called("action_accept")
347 self.assert_notification_action_id_was_called("action_accept")
301
348
302 def _create_interactive_notification(
349 def _create_interactive_notification(
@@ -438,10 +485,7 @@ class EphemeralNotificationsTests(NotificationsBase):
438 "join me and Anna?"
485 "join me and Anna?"
439 icon_path = self._get_icon_path('avatars/anna_olsson.png')
486 icon_path = self._get_icon_path('avatars/anna_olsson.png')
440 hints = [
487 hints = [
441− (
442− "x-canonical-secondary-icon",
488+ ("x-canonical-secondary-icon", "message")
443− self._get_icon_path('applicationIcons/dialer-app.png')
444− )
445 ]
489 ]
446
490
447 notification = shell.create_ephemeral_notification(
491 notification = shell.create_ephemeral_notification(
@@ -474,17 +518,13 @@ class EphemeralNotificationsTests(NotificationsBase):
474 notify_list = self._get_notifications_list()
518 notify_list = self._get_notifications_list()
475
519
476 summary = "Upload of image completed"
520 summary = "Upload of image completed"
477− hints = [
478− (
479− "x-canonical-secondary-icon",
480− self._get_icon_path('applicationIcons/facebook.png')
521+ icon_path = self._get_icon_path('applicationIcons/facebook.png')
481− )
522+ hints=[]
482− ]
483
523
484 notification = shell.create_ephemeral_notification(
524 notification = shell.create_ephemeral_notification(
485 summary,
525 summary,
486 None,
526 None,
487− None,
527+ icon_path,
488 hints,
528 hints,
489 "NORMAL",
529 "NORMAL",
490 )
530 )
@@ -497,8 +537,8 @@ class EphemeralNotificationsTests(NotificationsBase):
497 notification(),
537 notification(),
498 summary,
538 summary,
499 None,
539 None,
500− False,
501 True,
540 True,
541+ False,
502 1.0
542 1.0
503 )
543 )
504
544
@@ -683,7 +723,7 @@ class EphemeralNotificationsTests(NotificationsBase):
683 body = 'This bubble uses the icon-title-body layout with a ' \
723 body = 'This bubble uses the icon-title-body layout with a ' \
684 'secondary icon.'
724 'secondary icon.'
685 icon_path = self._get_icon_path('avatars/anna_olsson.png')
725 icon_path = self._get_icon_path('avatars/anna_olsson.png')
686− hint_icon = self._get_icon_path('applicationIcons/dialer-app.png')
726+ hint_icon = 'dialer'
687
727
688 notification = shell.create_ephemeral_notification(
728 notification = shell.create_ephemeral_notification(
689 summary,
729 summary,