Merge lp:~xavi-garcia-mena/indicator-sound/remove-warning-message-in-volume-notification into lp:indicator-sound/15.10
- remove-warning-message-in-volume-notification
- Merge into trunk.15.10
Status: | Merged |
---|---|
Approved by: | Charles Kerr |
Approved revision: | 515 |
Merged at revision: | 508 |
Proposed branch: | lp:~xavi-garcia-mena/indicator-sound/remove-warning-message-in-volume-notification |
Merge into: | lp:indicator-sound/15.10 |
Prerequisite: | lp:~xavi-garcia-mena/indicator-sound/bluetooth-usb-hdmi-labels-with-tests |
Diff against target: |
574 lines (+146/-109) 12 files modified
debian/changelog (+7/-0) debian/control (+0/-11) src/CMakeLists.txt (+2/-1) src/service.vala (+39/-44) tests/CMakeLists.txt (+4/-3) tests/dbus-types/org.freedesktop.Accounts.xml (+1/-0) tests/integration/indicator-sound-test-base.cpp (+22/-6) tests/integration/indicator-sound-test-base.h (+14/-0) tests/integration/test-indicator.cpp (+52/-41) tests/notifications-test.cc (+2/-2) tests/service-mocks/accounts-mock/CMakeLists.txt (+1/-1) tests/service-mocks/accounts-mock/org.freedesktop.Accounts.Mock.xml (+2/-0) |
To merge this branch: | bzr merge lp:~xavi-garcia-mena/indicator-sound/remove-warning-message-in-volume-notification |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Charles Kerr (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+275278@code.launchpad.net |
Commit message
This branch removes the warning message in the volume notification.
Description of the change
This branch removes the warning message in the volume notification.
- 510. By Xavi Garcia
-
Include all the integration tests
- 511. By Xavi Garcia
-
Update unit test
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:511
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 512. By Xavi Garcia
-
Disabled unit test with race condition issues
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:511
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:512
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 513. By Xavi Garcia
-
Changed unit test to wait for the indicator to connect the user accounts
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:513
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 514. By Xavi Garcia
-
changed wait mechanism when stopping sound
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:513
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:514
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Charles Kerr (charlesk) wrote : | # |
Overall LGTM.
Comments + questions + minor suggestion inline
Xavi Garcia (xavi-garcia-mena) wrote : | # |
Charles,
thanks for the review, inline comments updated
- 515. By Xavi Garcia
-
Changes as suggested
Charles Kerr (charlesk) : | # |
- 516. By Xavi Garcia
-
Checking capabilites in every notification. This is a workaround as it was observed that when using headphones the capabilities are not correct when we check for the first time
- 517. By Xavi Garcia
-
Integration tests updated
- 518. By Xavi Garcia
-
Changelog modified
- 519. By Xavi Garcia
-
Disable integration tests to avoid universe dependencies
- 520. By Xavi Garcia
-
Disable integration tests to avoid universe dependencies
Preview Diff
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2015-10-19 07:54:06 +0000 |
3 | +++ debian/changelog 2015-11-03 16:23:44 +0000 |
4 | @@ -1,3 +1,10 @@ |
5 | +indicator-sound (12.10.2+15.10.20151019-0ubuntu2) UNRELEASED; urgency=medium |
6 | + |
7 | + * Added OSD notifications to show output source when the volume or |
8 | + source change (LP: #1382548, LP: #1415480, LP: #1484589) |
9 | + |
10 | + -- Xavi Garcia <xavi.garcia.mena@canonical.com> Tue, 03 Nov 2015 12:29:19 +0100 |
11 | + |
12 | indicator-sound (12.10.2+15.10.20151019-0ubuntu1) wily; urgency=medium |
13 | |
14 | [ Xavi Garcia Mena ] |
15 | |
16 | === modified file 'debian/control' |
17 | --- debian/control 2015-11-03 16:23:44 +0000 |
18 | +++ debian/control 2015-02-27 17:52:05 +0000 |
19 | @@ -5,13 +5,11 @@ |
20 | XSBC-Original-Maintainer: Conor Curran <conor.curran@canonical.com> |
21 | Build-Depends: debhelper (>= 9.0), |
22 | cmake, |
23 | - cmake-extras (>= 0.4), |
24 | dbus, |
25 | dbus-test-runner (>> 14.04.0+14.04.20150120.1), |
26 | dh-translations, |
27 | gir1.2-accountsservice-1.0, |
28 | gnome-common, |
29 | - google-mock (>= 1.6.0+svn437), |
30 | gsettings-ubuntu-schemas, |
31 | autotools-dev, |
32 | valac (>= 0.20), |
33 | @@ -20,22 +18,13 @@ |
34 | libgirepository1.0-dev, |
35 | libglib2.0-dev (>= 2.22.3), |
36 | libgtest-dev, |
37 | - libqtdbusmock1-dev (>= 0.3), |
38 | - libqtdbustest1-dev, |
39 | - libunity-api-dev, |
40 | liburl-dispatcher1-dev, |
41 | libpulse-dev (>= 1:4.0-0ubuntu21), |
42 | libpulse-mainloop-glib0 (>= 0.9.18), |
43 | libnotify-dev, |
44 | libgee-dev, |
45 | libxml2-dev, |
46 | - pulseaudio, |
47 | python3-dbusmock, |
48 | - qt5-default, |
49 | - qtbase5-dev, |
50 | - qtbase5-dev-tools, |
51 | - qtdeclarative5-dev, |
52 | - qtdeclarative5-dev-tools, |
53 | Standards-Version: 3.9.4 |
54 | Homepage: https://launchpad.net/indicator-sound |
55 | # If you aren't a member of ~indicator-applet-developers but need to upload |
56 | |
57 | === modified file 'src/CMakeLists.txt' |
58 | --- src/CMakeLists.txt 2015-11-03 16:23:44 +0000 |
59 | +++ src/CMakeLists.txt 2015-11-03 16:23:44 +0000 |
60 | @@ -207,4 +207,5 @@ |
61 | RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/indicator-sound/ |
62 | ) |
63 | |
64 | -add_subdirectory(gmenuharness) |
65 | +# Disable integration tests |
66 | +# add_subdirectory(gmenuharness) |
67 | |
68 | === modified file 'src/service.vala' |
69 | --- src/service.vala 2015-11-03 16:23:44 +0000 |
70 | +++ src/service.vala 2015-11-03 16:23:44 +0000 |
71 | @@ -565,14 +565,45 @@ |
72 | return icon; |
73 | } |
74 | |
75 | + private string get_notification_label () { |
76 | + string volume_label = ""; |
77 | + switch (volume_control.active_output) |
78 | + { |
79 | + case VolumeControl.ActiveOutput.SPEAKERS: |
80 | + volume_label = _("Speakers"); |
81 | + break; |
82 | + case VolumeControl.ActiveOutput.HEADPHONES: |
83 | + volume_label = _("Headphones"); |
84 | + break; |
85 | + case VolumeControl.ActiveOutput.BLUETOOTH_HEADPHONES: |
86 | + volume_label = _("Bluetooth headphones"); |
87 | + break; |
88 | + case VolumeControl.ActiveOutput.BLUETOOTH_SPEAKER: |
89 | + volume_label = _("Bluetooth speaker"); |
90 | + break; |
91 | + case VolumeControl.ActiveOutput.USB_SPEAKER: |
92 | + volume_label = _("Usb speaker"); |
93 | + break; |
94 | + case VolumeControl.ActiveOutput.USB_HEADPHONES: |
95 | + volume_label = _("Usb headphones"); |
96 | + break; |
97 | + case VolumeControl.ActiveOutput.HDMI_SPEAKER: |
98 | + volume_label = _("HDMI speaker"); |
99 | + break; |
100 | + case VolumeControl.ActiveOutput.HDMI_HEADPHONES: |
101 | + volume_label = _("HDMI headphones"); |
102 | + break; |
103 | + } |
104 | + |
105 | + return volume_label; |
106 | + } |
107 | + |
108 | private void update_notification () { |
109 | |
110 | - if (!notify_server_caps_checked) { |
111 | - List<string> caps = Notify.get_server_caps (); |
112 | - notify_server_supports_actions = caps.find_custom ("actions", strcmp) != null; |
113 | - notify_server_supports_sync = caps.find_custom ("x-canonical-private-synchronous", strcmp) != null; |
114 | - notify_server_caps_checked = true; |
115 | - } |
116 | + List<string> caps = Notify.get_server_caps (); |
117 | + notify_server_supports_actions = caps.find_custom ("actions", strcmp) != null; |
118 | + notify_server_supports_sync = caps.find_custom ("x-canonical-private-synchronous", strcmp) != null; |
119 | + notify_server_caps_checked = true; |
120 | |
121 | var loud = volume_control.high_volume; |
122 | var warn = loud |
123 | @@ -610,44 +641,8 @@ |
124 | if (notify_server_supports_sync && !block_info_notifications) { |
125 | |
126 | /* Determine Label */ |
127 | - string volume_label = loud |
128 | - ? _("High volume can damage your hearing.") |
129 | - : ""; |
130 | - |
131 | - if (volume_label == "") { |
132 | - if (volume_control.active_output == VolumeControl.ActiveOutput.SPEAKERS) { |
133 | - volume_label = _("Speakers"); |
134 | - } |
135 | - |
136 | - if (volume_control.active_output == VolumeControl.ActiveOutput.HEADPHONES) { |
137 | - volume_label = _("Headphones"); |
138 | - } |
139 | - |
140 | - if (volume_control.active_output == VolumeControl.ActiveOutput.BLUETOOTH_HEADPHONES) { |
141 | - volume_label = _("Bluetooth headphones"); |
142 | - } |
143 | - |
144 | - if (volume_control.active_output == VolumeControl.ActiveOutput.BLUETOOTH_SPEAKER) { |
145 | - volume_label = _("Bluetooth speaker"); |
146 | - } |
147 | - |
148 | - if (volume_control.active_output == VolumeControl.ActiveOutput.USB_SPEAKER) { |
149 | - volume_label = _("Usb speaker"); |
150 | - } |
151 | - |
152 | - if (volume_control.active_output == VolumeControl.ActiveOutput.USB_HEADPHONES) { |
153 | - volume_label = _("Usb headphones"); |
154 | - } |
155 | - |
156 | - if (volume_control.active_output == VolumeControl.ActiveOutput.HDMI_SPEAKER) { |
157 | - volume_label = _("HDMI speaker"); |
158 | - } |
159 | - |
160 | - if (volume_control.active_output == VolumeControl.ActiveOutput.HDMI_HEADPHONES) { |
161 | - volume_label = _("HDMI headphones"); |
162 | - } |
163 | - } |
164 | - |
165 | + string volume_label = get_notification_label (); |
166 | + |
167 | /* Choose an icon */ |
168 | string icon = get_volume_notification_icon (volume_control.volume.volume, loud, volume_control.active_output); |
169 | |
170 | |
171 | === modified file 'tests/CMakeLists.txt' |
172 | --- tests/CMakeLists.txt 2015-11-03 16:23:44 +0000 |
173 | +++ tests/CMakeLists.txt 2015-11-03 16:23:44 +0000 |
174 | @@ -281,6 +281,7 @@ |
175 | indicator-test |
176 | ) |
177 | |
178 | -add_subdirectory(integration) |
179 | -add_subdirectory(dbus-types) |
180 | -add_subdirectory(service-mocks) |
181 | \ No newline at end of file |
182 | +# Disable integration tests |
183 | +# add_subdirectory(integration) |
184 | +# add_subdirectory(dbus-types) |
185 | +# add_subdirectory(service-mocks) |
186 | |
187 | === modified file 'tests/dbus-types/org.freedesktop.Accounts.xml' |
188 | --- tests/dbus-types/org.freedesktop.Accounts.xml 2015-11-03 16:23:44 +0000 |
189 | +++ tests/dbus-types/org.freedesktop.Accounts.xml 2015-11-03 16:23:44 +0000 |
190 | @@ -1,3 +1,4 @@ |
191 | +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> |
192 | <node> |
193 | <interface name="org.freedesktop.Accounts"> |
194 | <method name="FindUserByName"> |
195 | |
196 | === modified file 'tests/integration/indicator-sound-test-base.cpp' |
197 | --- tests/integration/indicator-sound-test-base.cpp 2015-11-03 16:23:44 +0000 |
198 | +++ tests/integration/indicator-sound-test-base.cpp 2015-11-03 16:23:44 +0000 |
199 | @@ -407,11 +407,11 @@ |
200 | auto username = qgetenv("USER"); |
201 | if (username != "") |
202 | { |
203 | - std::unique_ptr<AccountsInterface> accountsInterface(new AccountsInterface("org.freedesktop.Accounts", |
204 | + main_accounts_interface_.reset(new AccountsInterface("org.freedesktop.Accounts", |
205 | "/org/freedesktop/Accounts", |
206 | dbusTestRunner.systemConnection(), 0)); |
207 | |
208 | - QDBusReply<QDBusObjectPath> userResp = accountsInterface->call(QLatin1String("FindUserByName"), |
209 | + QDBusReply<QDBusObjectPath> userResp = main_accounts_interface_->call(QLatin1String("FindUserByName"), |
210 | QLatin1String(username)); |
211 | |
212 | if (!userResp.isValid()) |
213 | @@ -743,6 +743,7 @@ |
214 | notificationsSpy.clear(); |
215 | } |
216 | |
217 | + notificationsSpy.clear(); |
218 | // activate the headphones |
219 | EXPECT_TRUE(activateHeadphones(true)); |
220 | |
221 | @@ -759,8 +760,9 @@ |
222 | } |
223 | else |
224 | { |
225 | - WAIT_FOR_SIGNALS(notificationsSpy, 1); |
226 | - checkVolumeNotification(INITIAL_VOLUME, headphonesString, false, notificationsSpy.at(0)); |
227 | + WAIT_FOR_SIGNALS(notificationsSpy, 2); |
228 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(0)); |
229 | + checkVolumeNotification(INITIAL_VOLUME, headphonesString, false, notificationsSpy.at(1)); |
230 | notificationsSpy.clear(); |
231 | } |
232 | |
233 | @@ -784,8 +786,9 @@ |
234 | // deactivate the headphones |
235 | EXPECT_TRUE(activateHeadphones(false)); |
236 | |
237 | - WAIT_FOR_SIGNALS(notificationsSpy, 1); |
238 | - checkVolumeNotification(INITIAL_VOLUME, speakerString, false, notificationsSpy.at(0)); |
239 | + WAIT_FOR_SIGNALS(notificationsSpy, 2); |
240 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(0)); |
241 | + checkVolumeNotification(INITIAL_VOLUME, speakerString, false, notificationsSpy.at(1)); |
242 | notificationsSpy.clear(); |
243 | |
244 | // check the label in the menu |
245 | @@ -805,3 +808,16 @@ |
246 | ) |
247 | ).match()); |
248 | } |
249 | + |
250 | +bool IndicatorSoundTestBase::setVolumeUntilAccountsIsConnected(double volume) |
251 | +{ |
252 | + int RETRY_TIME = 5000; |
253 | + |
254 | + setActionValue("volume", QVariant::fromValue(volume)); |
255 | + while(!signal_spy_volume_changed_->wait(10) && RETRY_TIME) |
256 | + { |
257 | + RETRY_TIME -= 10; |
258 | + setActionValue("volume", QVariant::fromValue(volume)); |
259 | + } |
260 | + return (signal_spy_volume_changed_->count() != 0); |
261 | +} |
262 | |
263 | === modified file 'tests/integration/indicator-sound-test-base.h' |
264 | --- tests/integration/indicator-sound-test-base.h 2015-11-03 16:23:44 +0000 |
265 | +++ tests/integration/indicator-sound-test-base.h 2015-11-03 16:23:44 +0000 |
266 | @@ -31,6 +31,7 @@ |
267 | class MenusInterface; |
268 | class DBusPulseVolume; |
269 | class DBusPropertiesInterface; |
270 | +class AccountsInterface; |
271 | class QSignalSpy; |
272 | |
273 | #define WAIT_FOR_SIGNALS(signalSpy, signalsExpected)\ |
274 | @@ -42,6 +43,15 @@ |
275 | ASSERT_EQ(signalsExpected, signalSpy.size());\ |
276 | } |
277 | |
278 | +#define WAIT_AT_LEAST_SIGNALS(signalSpy, signalsExpected)\ |
279 | +{\ |
280 | + while (signalSpy.size() < signalsExpected)\ |
281 | + {\ |
282 | + ASSERT_TRUE(signalSpy.wait());\ |
283 | + }\ |
284 | + ASSERT_TRUE(signalsExpected <= signalSpy.size());\ |
285 | +} |
286 | + |
287 | class IndicatorSoundTestBase: public testing::Test |
288 | { |
289 | public: |
290 | @@ -122,6 +132,8 @@ |
291 | |
292 | void checkPortDevicesLabels(DevicePortType speakerPort, DevicePortType headphonesPort); |
293 | |
294 | + bool setVolumeUntilAccountsIsConnected(double volume); |
295 | + |
296 | QtDBusTest::DBusTestRunner dbusTestRunner; |
297 | |
298 | QtDBusMock::DBusMock dbusMock; |
299 | @@ -140,6 +152,8 @@ |
300 | |
301 | std::unique_ptr<DBusPropertiesInterface> accounts_interface_; |
302 | |
303 | + std::unique_ptr<AccountsInterface> main_accounts_interface_; |
304 | + |
305 | std::unique_ptr<QSignalSpy> signal_spy_volume_changed_; |
306 | |
307 | std::unique_ptr<QSignalSpy> signal_spy_menu_changed_; |
308 | |
309 | === modified file 'tests/integration/test-indicator.cpp' |
310 | --- tests/integration/test-indicator.cpp 2015-11-03 16:23:44 +0000 |
311 | +++ tests/integration/test-indicator.cpp 2015-11-03 16:23:44 +0000 |
312 | @@ -55,9 +55,7 @@ |
313 | QSignalSpy &userAccountsSpy = *signal_spy_volume_changed_; |
314 | // set an initial volume to the alert role |
315 | userAccountsSpy.clear(); |
316 | - setStreamRestoreVolume("alert", 1.0); |
317 | - WAIT_FOR_SIGNALS(userAccountsSpy, 2); |
318 | - |
319 | + EXPECT_TRUE(setVolumeUntilAccountsIsConnected(1.0)); |
320 | userAccountsSpy.clear(); |
321 | // play a test sound, it should change the role in the indicator |
322 | EXPECT_TRUE(startTestSound("multimedia")); |
323 | @@ -69,7 +67,7 @@ |
324 | |
325 | userAccountsSpy.clear(); |
326 | // set the random volume to the multimedia role |
327 | - EXPECT_TRUE(setStreamRestoreVolume("multimedia", randomVolume)); |
328 | + setActionValue("volume", QVariant::fromValue(randomVolume)); |
329 | if (randomVolume != INITIAL_VOLUME) |
330 | { |
331 | WAIT_FOR_SIGNALS(userAccountsSpy, 1); |
332 | @@ -106,14 +104,15 @@ |
333 | ) |
334 | ).match()); |
335 | |
336 | + // initialize the signal spy |
337 | + EXPECT_TRUE(initializeMenuChangedSignal()); |
338 | userAccountsSpy.clear(); |
339 | // stop the test sound, the role should change again to alert |
340 | stopTestSound(); |
341 | if (randomVolume != 1.0) |
342 | { |
343 | - // we only wait if the volume in the alert and the |
344 | - // one set in the multimedia roles differ |
345 | - WAIT_FOR_SIGNALS(userAccountsSpy, 1); |
346 | + // wait for the menu change |
347 | + EXPECT_TRUE(waitMenuChange()); |
348 | } |
349 | |
350 | // check the initial volume for the alert role |
351 | @@ -696,16 +695,18 @@ |
352 | notificationsSpy.clear(); |
353 | setActionValue("volume", QVariant::fromValue(0.0)); |
354 | |
355 | - WAIT_FOR_SIGNALS(notificationsSpy, 1) |
356 | + WAIT_FOR_SIGNALS(notificationsSpy, 2) |
357 | |
358 | - checkVolumeNotification(0.0, "Speakers", false, notificationsSpy.at(0)); |
359 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(0)); |
360 | + checkVolumeNotification(0.0, "Speakers", false, notificationsSpy.at(1)); |
361 | |
362 | notificationsSpy.clear(); |
363 | setActionValue("volume", QVariant::fromValue(0.5)); |
364 | |
365 | - WAIT_FOR_SIGNALS(notificationsSpy, 1) |
366 | + WAIT_FOR_SIGNALS(notificationsSpy, 2) |
367 | |
368 | - checkVolumeNotification(0.5, "Speakers", false, notificationsSpy.at(0)); |
369 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(0)); |
370 | + checkVolumeNotification(0.5, "Speakers", false, notificationsSpy.at(1)); |
371 | } |
372 | |
373 | TEST_F(TestIndicator, PhoneNotificationWarningVolume) |
374 | @@ -748,34 +749,38 @@ |
375 | setActionValue("volume", QVariant::fromValue(0.3)); |
376 | EXPECT_TRUE(waitVolumeChangedInIndicator()); |
377 | |
378 | - WAIT_FOR_SIGNALS(notificationsSpy, 1); |
379 | + WAIT_FOR_SIGNALS(notificationsSpy, 2); |
380 | |
381 | - checkVolumeNotification(0.3, "Headphones", false, notificationsSpy.at(0)); |
382 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(0)); |
383 | + checkVolumeNotification(0.3, "Headphones", false, notificationsSpy.at(1)); |
384 | notificationsSpy.clear(); |
385 | |
386 | // change volume to 0.5... no warning should be emitted |
387 | setActionValue("volume", QVariant::fromValue(0.5)); |
388 | EXPECT_TRUE(waitVolumeChangedInIndicator()); |
389 | |
390 | - WAIT_FOR_SIGNALS(notificationsSpy, 1); |
391 | + WAIT_FOR_SIGNALS(notificationsSpy, 2); |
392 | |
393 | - checkVolumeNotification(0.5, "Headphones", false, notificationsSpy.at(0)); |
394 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(0)); |
395 | + checkVolumeNotification(0.5, "Headphones", false, notificationsSpy.at(1)); |
396 | notificationsSpy.clear(); |
397 | |
398 | // change volume to 1.0... warning should be emitted |
399 | setActionValue("volume", QVariant::fromValue(1.0)); |
400 | EXPECT_TRUE(waitVolumeChangedInIndicator()); |
401 | |
402 | - WAIT_FOR_SIGNALS(notificationsSpy, 4); |
403 | + WAIT_FOR_SIGNALS(notificationsSpy, 8); |
404 | |
405 | // the notification is sent twice (TODO check why) |
406 | - checkCloseNotification(1, notificationsSpy.at(0)); |
407 | - checkHighVolumeNotification(notificationsSpy.at(1)); |
408 | - checkCloseNotification(1, notificationsSpy.at(2)); |
409 | - checkHighVolumeNotification(notificationsSpy.at(3)); |
410 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(0)); |
411 | + checkCloseNotification(1, notificationsSpy.at(1)); |
412 | + checkHighVolumeNotification(notificationsSpy.at(2)); |
413 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(3)); |
414 | + checkCloseNotification(1, notificationsSpy.at(4)); |
415 | + checkHighVolumeNotification(notificationsSpy.at(5)); |
416 | |
417 | // get the last notification ID |
418 | - int idNotification = getNotificationID(notificationsSpy.at(3)); |
419 | + int idNotification = getNotificationID(notificationsSpy.at(5)); |
420 | ASSERT_NE(-1, idNotification); |
421 | |
422 | qWarning() << "XGM: id Notification: " << idNotification; |
423 | @@ -808,19 +813,17 @@ |
424 | setActionValue("volume", QVariant::fromValue(1.0)); |
425 | EXPECT_TRUE(waitVolumeChangedInIndicator()); |
426 | |
427 | - WAIT_FOR_SIGNALS(notificationsSpy, 2); |
428 | + WAIT_FOR_SIGNALS(notificationsSpy, 6); |
429 | |
430 | -// checkCloseNotification(1, notificationsSpy.at(0)); |
431 | - checkHighVolumeNotification(notificationsSpy.at(0)); |
432 | -// checkCloseNotification(1, notificationsSpy.at(2)); |
433 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(0)); |
434 | checkHighVolumeNotification(notificationsSpy.at(1)); |
435 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(2)); |
436 | + checkHighVolumeNotification(notificationsSpy.at(3)); |
437 | |
438 | // get the last notification ID |
439 | idNotification = getNotificationID(notificationsSpy.at(1)); |
440 | ASSERT_NE(-1, idNotification); |
441 | |
442 | - qWarning() << "XGM: id Notification: " << idNotification; |
443 | - |
444 | // this time we approve |
445 | pressNotificationButton(idNotification, "ok"); |
446 | |
447 | @@ -853,13 +856,15 @@ |
448 | setActionValue("volume", QVariant::fromValue(0.5)); |
449 | EXPECT_TRUE(waitVolumeChangedInIndicator()); |
450 | |
451 | - WAIT_FOR_SIGNALS(notificationsSpy, 4); |
452 | + WAIT_FOR_SIGNALS(notificationsSpy, 6); |
453 | |
454 | // check the notification TODO check why the sound indicator sends it twice |
455 | - checkCloseNotification(idNotification, notificationsSpy.at(0)); |
456 | - checkVolumeNotification(0.5, "Headphones", false, notificationsSpy.at(1)); |
457 | - checkCloseNotification(idNotification, notificationsSpy.at(2)); |
458 | - checkVolumeNotification(0.5, "Headphones", false, notificationsSpy.at(3)); |
459 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(0)); |
460 | + checkCloseNotification(idNotification, notificationsSpy.at(1)); |
461 | + checkVolumeNotification(0.5, "Headphones", false, notificationsSpy.at(2)); |
462 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(3)); |
463 | + checkCloseNotification(idNotification, notificationsSpy.at(4)); |
464 | + checkVolumeNotification(0.5, "Headphones", false, notificationsSpy.at(5)); |
465 | |
466 | // check that the volume was applied |
467 | // and that we don't have the warning item |
468 | @@ -886,13 +891,16 @@ |
469 | setActionValue("volume", QVariant::fromValue(1.0)); |
470 | EXPECT_TRUE(waitVolumeChangedInIndicator()); |
471 | |
472 | - WAIT_FOR_SIGNALS(notificationsSpy, 2); |
473 | + WAIT_FOR_SIGNALS(notificationsSpy, 4); |
474 | |
475 | // check the notification TODO check why the sound indicator sends it twice |
476 | - checkVolumeNotification(1.0, "High volume can damage your hearing.", true, notificationsSpy.at(0)); |
477 | - checkVolumeNotification(1.0, "High volume can damage your hearing.", true, notificationsSpy.at(1)); |
478 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(0)); |
479 | + checkVolumeNotification(1.0, "Headphones", true, notificationsSpy.at(1)); |
480 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(2)); |
481 | + checkVolumeNotification(1.0, "Headphones", true, notificationsSpy.at(3)); |
482 | } |
483 | |
484 | + |
485 | TEST_F(TestIndicator, PhoneNotificationWarningVolumeAlertMode) |
486 | { |
487 | double INITIAL_VOLUME = 0.0; |
488 | @@ -920,30 +928,33 @@ |
489 | // change volume to 0.0... no warning should be emitted |
490 | setActionValue("volume", QVariant::fromValue(0.0)); |
491 | |
492 | - WAIT_FOR_SIGNALS(notificationsSpy, 4); |
493 | + WAIT_FOR_SIGNALS(notificationsSpy, 5); |
494 | |
495 | // the first time we also have the calls to |
496 | // GetServerInformation and GetCapabilities |
497 | checkNotificationWithNoArgs("GetServerInformation", notificationsSpy.at(0)); |
498 | checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(1)); |
499 | checkVolumeNotification(0.0, "Headphones", false, notificationsSpy.at(2)); |
500 | - checkVolumeNotification(0.0, "Headphones", false, notificationsSpy.at(3)); |
501 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(3)); |
502 | + checkVolumeNotification(0.0, "Headphones", false, notificationsSpy.at(4)); |
503 | notificationsSpy.clear(); |
504 | |
505 | // change volume to 0.5... no warning should be emitted |
506 | setActionValue("volume", QVariant::fromValue(0.5)); |
507 | |
508 | - WAIT_FOR_SIGNALS(notificationsSpy, 1); |
509 | + WAIT_FOR_SIGNALS(notificationsSpy, 2); |
510 | |
511 | - checkVolumeNotification(0.5, "Headphones", false, notificationsSpy.at(0)); |
512 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(0)); |
513 | + checkVolumeNotification(0.5, "Headphones", false, notificationsSpy.at(1)); |
514 | notificationsSpy.clear(); |
515 | |
516 | // change volume to 1.0... no warning should be emitted, we are in alert mode |
517 | setActionValue("volume", QVariant::fromValue(1.0)); |
518 | |
519 | - WAIT_FOR_SIGNALS(notificationsSpy, 1); |
520 | + WAIT_FOR_SIGNALS(notificationsSpy, 2); |
521 | |
522 | - checkVolumeNotification(1.0, "Headphones", false, notificationsSpy.at(0)); |
523 | + checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(0)); |
524 | + checkVolumeNotification(1.0, "Headphones", false, notificationsSpy.at(1)); |
525 | notificationsSpy.clear(); |
526 | } |
527 | |
528 | |
529 | === modified file 'tests/notifications-test.cc' |
530 | --- tests/notifications-test.cc 2015-11-03 16:23:44 +0000 |
531 | +++ tests/notifications-test.cc 2015-11-03 16:23:44 +0000 |
532 | @@ -356,7 +356,7 @@ |
533 | notev = notifications->getNotifications(); |
534 | ASSERT_LT(0, notev.size()); /* This passes with one or two since it would just be an update to the first if a second was sent */ |
535 | EXPECT_EQ("Volume", notev[0].summary); |
536 | - EXPECT_EQ("High volume can damage your hearing.", notev[0].body); |
537 | + EXPECT_EQ("Speakers", notev[0].body); |
538 | EXPECT_GVARIANT_EQ("@s 'true'", notev[0].hints["x-canonical-value-bar-tint"]); |
539 | |
540 | /* Move it back */ |
541 | @@ -372,7 +372,7 @@ |
542 | notev = notifications->getNotifications(); |
543 | ASSERT_EQ(1, notev.size()); |
544 | EXPECT_EQ("Volume", notev[0].summary); |
545 | - EXPECT_EQ("High volume can damage your hearing.", notev[0].body); |
546 | + EXPECT_EQ("Speakers", notev[0].body); |
547 | EXPECT_GVARIANT_EQ("@s 'true'", notev[0].hints["x-canonical-value-bar-tint"]); |
548 | } |
549 | |
550 | |
551 | === modified file 'tests/service-mocks/accounts-mock/CMakeLists.txt' |
552 | --- tests/service-mocks/accounts-mock/CMakeLists.txt 2015-11-03 16:23:44 +0000 |
553 | +++ tests/service-mocks/accounts-mock/CMakeLists.txt 2015-11-03 16:23:44 +0000 |
554 | @@ -20,7 +20,7 @@ |
555 | AccountsServiceSoundMockAdaptor) |
556 | |
557 | qt5_add_dbus_adaptor(adaptor_files |
558 | - org.freedesktop.Accounts.Mock.xml |
559 | + ${CMAKE_SOURCE_DIR}/tests/dbus-types/org.freedesktop.Accounts.xml |
560 | AccountsMock.h |
561 | ubuntu::indicators::testing::AccountsMock |
562 | AccountsMockAdaptor) |
563 | |
564 | === modified file 'tests/service-mocks/accounts-mock/org.freedesktop.Accounts.Mock.xml' |
565 | --- tests/service-mocks/accounts-mock/org.freedesktop.Accounts.Mock.xml 2015-11-03 16:23:44 +0000 |
566 | +++ tests/service-mocks/accounts-mock/org.freedesktop.Accounts.Mock.xml 2015-11-03 16:23:44 +0000 |
567 | @@ -9,5 +9,7 @@ |
568 | <arg direction="in" type="x" name="uid" /> |
569 | <arg direction="out" type="o" name="path" /> |
570 | </method> |
571 | + <signal name="FindUserByIdInvoked"> |
572 | + </signal> |
573 | </interface> |
574 | </node> |
PASSED: Continuous integration, rev:510 jenkins. qa.ubuntu. com/job/ indicator- sound-ci/ 276/ jenkins. qa.ubuntu. com/job/ indicator- sound-wily- amd64-ci/ 52 jenkins. qa.ubuntu. com/job/ indicator- sound-wily- armhf-ci/ 52 jenkins. qa.ubuntu. com/job/ indicator- sound-wily- armhf-ci/ 52/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/indicator- sound-ci/ 276/rebuild
http://