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.
commit6487085f7b5705723516375e8ee8d6f468feaca8 authorMirco Müller <mirco.mueller@ubuntu.com> dateMon 18 Aug 2014, 20:19 (12 years ago) parent8d85c38
2 files changed+73−33
qml/Notifications/Notification.qml+5−5 tests/autopilot/unity8/shell/tests/test_notifications.py+68−28
qml/Notifications/Notification.qml+5−5
@@ -343,7 +343,7 @@ Item {
343343 id: oneOverTwoButtonTop
344344
345345 Button {
346− objectName: "button" + index
346+ objectName: "notify_oot_button" + index
347347 width: oneOverTwoCase.width
348348 text: oneOverTwoLoaderTop.actionLabel
349349 color: notification.hints["x-canonical-private-affirmative-tint"] == "true" ? green : sdDarkGrey
@@ -371,7 +371,7 @@ Item {
371371 id: oneOverTwoButtonBottom
372372
373373 Button {
374− objectName: "button" + index
374+ objectName: "notify_oot_button" + index
375375 width: oneOverTwoCase.width / 2 - spacing * 2
376376 text: oneOverTwoLoaderBottom.actionLabel
377377 color: index == 1 && notification.hints["x-canonical-private-rejection-tint"] == "true" ? red : sdDarkGrey
@@ -411,7 +411,7 @@ Item {
411411 id: actionButton
412412
413413 Button {
414− objectName: "button" + index
414+ objectName: "notify_button" + index
415415 width: buttonRow.width / 2 - spacing*2
416416 text: loader.actionLabel
417417 color: {
@@ -435,7 +435,7 @@ Item {
435435 ComboButton {
436436 id: comboButton
437437
438− objectName: "button2"
438+ objectName: "notify_button2"
439439 width: parent.width
440440 anchors {
441441 left: parent.left
@@ -478,7 +478,7 @@ Item {
478478 MouseArea {
479479 id: comboInputArea
480480
481− objectName: "button" + index
481+ objectName: "notify_button" + index
482482 width: comboButton.width
483483 height: comboIcon.height + units.gu(2)
484484
tests/autopilot/unity8/shell/tests/test_notifications.py+68−28
@@ -135,10 +135,7 @@ class InteractiveNotificationBase(NotificationsBase):
135135 actions = [("action_id", "dummy")]
136136 hints = [
137137 ("x-canonical-switch-to-application", "true"),
138− (
139− "x-canonical-secondary-icon",
140− self._get_icon_path('applicationIcons/dialer-app.png')
141− )
138+ ("x-canonical-secondary-icon","dialer")
142139 ]
143140
144141 self._create_interactive_notification(
@@ -170,20 +167,19 @@ class InteractiveNotificationBase(NotificationsBase):
170167 body = "Frank Zappa\n+44 (0)7736 027340"
171168 icon_path = self._get_icon_path('avatars/anna_olsson.png')
172169 hints = [
173− (
174− "x-canonical-secondary-icon",
175− self._get_icon_path('applicationIcons/dialer-app.png')
176− ),
170+ ("x-canonical-secondary-icon", "incoming-call"),
177171 ("x-canonical-snap-decisions", "true"),
172+ ("x-canonical-private-affirmative-tint", "true"),
173+ ("x-canonical-private-rejection-tint", "true"),
178174 ]
179175
180176 actions = [
181177 ('action_accept', 'Hold + Answer'),
182178 ('action_decline_1', 'End + Answer'),
183179 ('action_decline_2', 'Decline'),
184− ('action_decline_3', 'messages:I missed your call - can you call me now?'),
185− ('action_decline_4', 'messages:I\'m running late. I\'m on my way.'),
186− ('action_decline_5', 'messages:I\'m busy at the moment. I\'ll call later.'),
180+ ('action_decline_3', 'message:I missed your call - can you call me now?'),
181+ ('action_decline_4', 'message:I\'m running late. I\'m on my way.'),
182+ ('action_decline_5', 'message:I\'m busy at the moment. I\'ll call later.'),
187183 ('action_decline_6', 'edit:Custom'),
188184 ]
189185
@@ -204,13 +200,60 @@ class InteractiveNotificationBase(NotificationsBase):
204200 notification.pointing_device.click_object(
205201 notification.select_single(objectName="combobutton_dropdown"))
206202 self.assertThat(
207− notification.select_single(objectName="button2").expanded,
203+ notification.select_single(objectName="notify_button2").expanded,
208204 Eventually(Equals(True)))
209205 time.sleep(2)
210206 notification.pointing_device.click_object(
211− notification.select_single(objectName="button4"))
207+ notification.select_single(objectName="notify_button4"))
212208 self.assert_notification_action_id_was_called("action_decline_4")
213209
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+
214257 def test_modal_sd_without_greeter(self):
215258 """Snap-decision should block input to shell without greeter."""
216259 unity_proxy = self.launch_unity()
@@ -222,6 +265,8 @@ class InteractiveNotificationBase(NotificationsBase):
222265 hints = [
223266 ("x-canonical-snap-decisions", "true"),
224267 ("x-canonical-non-shaped-icon", "true"),
268+ ("x-canonical-private-affirmative-tint", "true"),
269+ ("x-canonical-private-rejection-tint", "true"),
225270 ]
226271
227272 actions = [
@@ -253,7 +298,7 @@ class InteractiveNotificationBase(NotificationsBase):
253298 self._assert_notification(
254299 notification, summary, body, True, False, 1.0)
255300 notification.pointing_device.click_object(
256− notification.select_single(objectName="button0"))
301+ notification.select_single(objectName="notify_button0"))
257302 self.assert_notification_action_id_was_called("action_accept")
258303
259304 def test_modal_sd_with_greeter(self):
@@ -266,6 +311,8 @@ class InteractiveNotificationBase(NotificationsBase):
266311 hints = [
267312 ("x-canonical-snap-decisions", "true"),
268313 ("x-canonical-non-shaped-icon", "true"),
314+ ("x-canonical-private-affirmative-tint", "true"),
315+ ("x-canonical-private-rejection-tint", "true"),
269316 ]
270317
271318 actions = [
@@ -296,7 +343,7 @@ class InteractiveNotificationBase(NotificationsBase):
296343 self._assert_notification(
297344 notification, summary, body, True, False, 1.0)
298345 notification.pointing_device.click_object(
299− notification.select_single(objectName="button0"))
346+ notification.select_single(objectName="notify_button0"))
300347 self.assert_notification_action_id_was_called("action_accept")
301348
302349 def _create_interactive_notification(
@@ -438,10 +485,7 @@ class EphemeralNotificationsTests(NotificationsBase):
438485 "join me and Anna?"
439486 icon_path = self._get_icon_path('avatars/anna_olsson.png')
440487 hints = [
441− (
442− "x-canonical-secondary-icon",
443− self._get_icon_path('applicationIcons/dialer-app.png')
444− )
488+ ("x-canonical-secondary-icon", "message")
445489 ]
446490
447491 notification = shell.create_ephemeral_notification(
@@ -474,17 +518,13 @@ class EphemeralNotificationsTests(NotificationsBase):
474518 notify_list = self._get_notifications_list()
475519
476520 summary = "Upload of image completed"
477− hints = [
478− (
479− "x-canonical-secondary-icon",
480− self._get_icon_path('applicationIcons/facebook.png')
481− )
482− ]
521+ icon_path = self._get_icon_path('applicationIcons/facebook.png')
522+ hints=[]
483523
484524 notification = shell.create_ephemeral_notification(
485525 summary,
486526 None,
487− None,
527+ icon_path,
488528 hints,
489529 "NORMAL",
490530 )
@@ -497,8 +537,8 @@ class EphemeralNotificationsTests(NotificationsBase):
497537 notification(),
498538 summary,
499539 None,
500− False,
501540 True,
541+ False,
502542 1.0
503543 )
504544
@@ -683,7 +723,7 @@ class EphemeralNotificationsTests(NotificationsBase):
683723 body = 'This bubble uses the icon-title-body layout with a ' \
684724 'secondary icon.'
685725 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'
687727
688728 notification = shell.create_ephemeral_notification(
689729 summary,