Merge lp:~xavi-garcia-mena/indicator-sound/re-add-integration-tests into lp:indicator-sound/15.10

Proposed by Xavi Garcia
Status: Merged
Approved by: Xavi Garcia
Approved revision: 515
Merged at revision: 519
Proposed branch: lp:~xavi-garcia-mena/indicator-sound/re-add-integration-tests
Merge into: lp:indicator-sound/15.10
Prerequisite: lp:~xavi-garcia-mena/indicator-sound/restore-osd-notifications
Diff against target: 270 lines (+73/-37)
8 files modified
AUTHORS (+1/-0)
debian/changelog (+7/-6)
debian/control (+11/-0)
src/CMakeLists.txt (+1/-2)
src/service.vala (+5/-2)
src/volume-control-pulse.vala (+41/-22)
src/volume-control.vala (+4/-1)
tests/CMakeLists.txt (+3/-4)
To merge this branch: bzr merge lp:~xavi-garcia-mena/indicator-sound/re-add-integration-tests
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
Xavi Garcia Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+281292@code.launchpad.net

This proposal supersedes a proposal from 2015-11-11.

Commit message

This branch re-adds the integration tests using gmenuharness.

  * Added OSD notifications to show output source when the volume or
    source change (LP: #1382548, LP: #1415480, LP: #1484589)

  * debian/control:
    Added the following build dependencies:
    - cmake-extras (>= 0.4),
    - google-mock (>= 1.6.0+svn437),
    - libqtdbusmock1-dev (>= 0.3),
    - libqtdbustest1-dev,
    - libunity-api-dev,
    - pulseaudio,
    - qt5-default,
    - qtbase5-dev,
    - qtbase5-dev-tools,
    - qtdeclarative5-dev,
    - qtdeclarative5-dev-tools
  * Added gmenuharness library for integration tests support.
    New Files:
    - src/gmenuharness/CMakeLists.txt
    - src/gmenuharness/MatchResult.cpp
    - src/gmenuharness/MatchUtils.cpp
    - src/gmenuharness/MenuItemMatcher.cpp
    - src/gmenuharness/MenuMatcher.cpp
    - include/unity/gmenuharness/MatchResult.h
    - include/unity/gmenuharness/MatchUtils.h
    - include/unity/gmenuharness/MenuItemMatcher.h
    - include/unity/gmenuharness/MenuMatcher.h
  * Added integration tests using gmenuharness
    New Files:
    - tests/dbus-types/CMakeLists.txt
    - tests/dbus-types/com.ubuntu.AccountsService.Sound.xml
    - tests/dbus-types/dbus-types.h
    - tests/dbus-types/org.PulseAudio.Ext.StreamRestore1.xml
    - tests/dbus-types/org.freedesktop.Accounts.xml
    - tests/dbus-types/org.freedesktop.DBus.Properties.xml
    - tests/dbus-types/org.freedesktop.Notifications.xml
    - tests/dbus-types/org.gtk.Actions.xml
    - tests/dbus-types/pulseaudio-volume.cpp
    - tests/dbus-types/pulseaudio-volume.h
    - tests/integration/CMakeLists.txt
    - tests/integration/indicator-sound-test-base.cpp
    - tests/integration/indicator-sound-test-base.h
    - tests/integration/main.cpp
    - tests/integration/test-indicator.cpp
    - tests/integration/touch-stream-restore.table
    - tests/integration/utils/dbus-pulse-volume.cpp
    - tests/integration/utils/dbus-pulse-volume.h
    - tests/integration/utils/get-volume.cpp
    - tests/integration/utils/set-volume.cpp
    - tests/service-mocks/CMakeLists.txt
    - tests/service-mocks/DBusPropertiesNotifier.cpp
    - tests/service-mocks/DBusPropertiesNotifier.h
    - tests/service-mocks/accounts-mock/AccountsDefs.h
    - tests/service-mocks/accounts-mock/AccountsMock.cpp
    - tests/service-mocks/accounts-mock/AccountsMock.h
    - tests/service-mocks/accounts-mock/AccountsServiceSoundMock.cpp
    - tests/service-mocks/accounts-mock/AccountsServiceSoundMock.h
    - tests/service-mocks/accounts-mock/CMakeLists.txt
    - tests/service-mocks/accounts-mock/com.ubuntu.AccountsService.Sound.Mock.xml
    - tests/service-mocks/accounts-mock/main.cpp
    - tests/service-mocks/accounts-mock/org.freedesktop.Accounts.Mock.xml
    - tests/service-mocks/media-player-mpris-mock/CMakeLists.txt
    - tests/service-mocks/media-player-mpris-mock/MediaPlayerMprisDefs.h
    - tests/service-mocks/media-player-mpris-mock/MediaPlayerMprisMock.cpp
    - tests/service-mocks/media-player-mpris-mock/MediaPlayerMprisMock.h
    - tests/service-mocks/media-player-mpris-mock/applications/testplayer1.desktop
    - tests/service-mocks/media-player-mpris-mock/main.cpp
    - tests/service-mocks/media-player-mpris-mock/org.mpris.MediaPlayer2.Player.xml
    - tests/service-mocks/media-player-mpris-mock/org.mpris.MediaPlayer2.xml
    - tests/service-mocks/media-player-mpris-mock/player-update.cpp

Description of the change

This branch re-adds the integration tests using gmenuharness.

I'm approving myself as it was already approved previously as branch:
lp:~xavi-garcia-mena/indicator-sound/remove-warning-message-in-volume-notification

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Xavi Garcia (xavi-garcia-mena) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
515. By Xavi Garcia

Conflicts resolved with restored branch

Revision history for this message
Xavi Garcia (xavi-garcia-mena) wrote :

Approving myself as it as already reviewed and approved

review: Approve
516. By Xavi Garcia

removed extra line in debian/changelog

517. By Xavi Garcia

sync debian/changelog with pre-requisite branch

518. By Xavi Garcia

Rolling back to release 516

519. By Xavi Garcia

sync changelog with previous branch

520. By Xavi Garcia

re-added new stuff

521. By Xavi Garcia

remove changed in debian/changelog

522. By Xavi Garcia

[ Xavi Garcia ]
  * Added OSD notifications to show output source when the volume or
    source change (LP: #1382548, LP: #1415480, LP: #1484589)

  * debian/control:
    Added the following build dependencies:
    - cmake-extras (>= 0.4),
    - google-mock (>= 1.6.0+svn437),
    - libqtdbusmock1-dev (>= 0.3),
    - libqtdbustest1-dev,
    - libunity-api-dev,
    - pulseaudio,
    - qt5-default,
    - qtbase5-dev,
    - qtbase5-dev-tools,
    - qtdeclarative5-dev,
    - qtdeclarative5-dev-tools
  * Added gmenuharness library for integration tests support.
    New Files:
    - src/gmenuharness/CMakeLists.txt
    - src/gmenuharness/MatchResult.cpp
    - src/gmenuharness/MatchUtils.cpp
    - src/gmenuharness/MenuItemMatcher.cpp
    - src/gmenuharness/MenuMatcher.cpp
    - include/unity/gmenuharness/MatchResult.h
    - include/unity/gmenuharness/MatchUtils.h
    - include/unity/gmenuharness/MenuItemMatcher.h
    - include/unity/gmenuharness/MenuMatcher.h
  * Added integration tests using gmenuharness
    New Files:
    - tests/dbus-types/CMakeLists.txt
    - tests/dbus-types/com.ubuntu.AccountsService.Sound.xml
    - tests/dbus-types/dbus-types.h
    - tests/dbus-types/org.PulseAudio.Ext.StreamRestore1.xml
    - tests/dbus-types/org.freedesktop.Accounts.xml
    - tests/dbus-types/org.freedesktop.DBus.Properties.xml
    - tests/dbus-types/org.freedesktop.Notifications.xml
    - tests/dbus-types/org.gtk.Actions.xml
    - tests/dbus-types/pulseaudio-volume.cpp
    - tests/dbus-types/pulseaudio-volume.h
    - tests/integration/CMakeLists.txt
    - tests/integration/indicator-sound-test-base.cpp
    - tests/integration/indicator-sound-test-base.h
    - tests/integration/main.cpp
    - tests/integration/test-indicator.cpp
    - tests/integration/touch-stream-restore.table
    - tests/integration/utils/dbus-pulse-volume.cpp
    - tests/integration/utils/dbus-pulse-volume.h
    - tests/integration/utils/get-volume.cpp
    - tests/integration/utils/set-volume.cpp
    - tests/service-mocks/CMakeLists.txt
    - tests/service-mocks/DBusPropertiesNotifier.cpp
    - tests/service-mocks/DBusPropertiesNotifier.h
    - tests/service-mocks/accounts-mock/AccountsDefs.h
    - tests/service-mocks/accounts-mock/AccountsMock.cpp
    - tests/service-mocks/accounts-mock/AccountsMock.h
    - tests/service-mocks/accounts-mock/AccountsServiceSoundMock.cpp
    - tests/service-mocks/accounts-mock/AccountsServiceSoundMock.h
    - tests/service-mocks/accounts-mock/CMakeLists.txt
    - tests/service-mocks/accounts-mock/com.ubuntu.AccountsService.Sound.Mock.xml
    - tests/service-mocks/accounts-mock/main.cpp
    - tests/service-mocks/accounts-mock/org.freedesktop.Accounts.Mock.xml
    - tests/service-mocks/media-player-mpris-mock/CMakeLists.txt
    - tests/service-mocks/media-player-mpris-mock/MediaPlayerMprisDefs.h
    - tests/service-mocks/media-player-mpris-mock/MediaPlayerMprisMock.cpp
    - tests/service-mocks/media-player-mpris-mock/MediaPlayerMprisMock.h
    - tests/service-mocks/media-player-mpris-mock/applications/testplayer1.desktop
    - tests/service-mocks/media-player-mpris-mock/main.cpp
    - tests/service-mocks/media-player-mpris-mock/org.mpris.MediaPlayer2.Player.xml
    - tests/service-mocks/media-player-mpris-mock/org.mpris.MediaPlayer2.xml
    - tests/service-mocks/media-player-mpris-mock/player-update.cpp

Revision history for this message
Charles Kerr (charlesk) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'AUTHORS'
2--- AUTHORS 2012-11-16 13:48:06 +0000
3+++ AUTHORS 2016-01-05 13:50:19 +0000
4@@ -1,3 +1,4 @@
5 Charles Kerr <charles.kerr@canonical.com>
6 Ted Gould <ted@canonical.com>
7 Cody Russell <crussell@canonical.com>
8+Xavi Garcia <xavi.garcia.mena@canonical.com>
9
10=== modified file 'debian/changelog'
11--- debian/changelog 2016-01-05 13:50:18 +0000
12+++ debian/changelog 2015-12-23 14:20:45 +0000
13@@ -1,4 +1,3 @@
14-<<<<<<< TREE
15 indicator-sound (12.10.2+16.04.20151223.1-0ubuntu1) xenial; urgency=medium
16
17 [ Xavi Garcia Mena ]
18@@ -30,14 +29,16 @@
19 indicator-sound (12.10.2+16.04.20151103.2-0ubuntu1) xenial; urgency=medium
20
21 [ Xavi Garcia ]
22-=======
23-indicator-sound (12.10.2+15.10.20151019-0ubuntu2) UNRELEASED; urgency=medium
24-
25->>>>>>> MERGE-SOURCE
26 * Added OSD notifications to show output source when the volume or
27 source change (LP: #1382548, LP: #1415480, LP: #1484589)
28
29- -- Xavi Garcia <xavi.garcia.mena@canonical.com> Tue, 03 Nov 2015 12:29:19 +0100
30+ [ CI Train Bot ]
31+ * New rebuild forced.
32+
33+ [ Timo Jyrinki ]
34+ * Note: this release was reverted on 20151223, ignore this changelog entry.
35+
36+ -- Xavi Garcia <xavi.garcia.mena@canonical.com> Tue, 03 Nov 2015 17:47:10 +0000
37
38 indicator-sound (12.10.2+15.10.20151019-0ubuntu1) wily; urgency=medium
39
40
41=== modified file 'debian/control'
42--- debian/control 2015-11-03 16:21:43 +0000
43+++ debian/control 2016-01-05 13:50:19 +0000
44@@ -5,11 +5,13 @@
45 XSBC-Original-Maintainer: Conor Curran <conor.curran@canonical.com>
46 Build-Depends: debhelper (>= 9.0),
47 cmake,
48+ cmake-extras (>= 0.4),
49 dbus,
50 dbus-test-runner (>> 14.04.0+14.04.20150120.1),
51 dh-translations,
52 gir1.2-accountsservice-1.0,
53 gnome-common,
54+ google-mock (>= 1.6.0+svn437),
55 gsettings-ubuntu-schemas,
56 autotools-dev,
57 valac (>= 0.20),
58@@ -18,13 +20,22 @@
59 libgirepository1.0-dev,
60 libglib2.0-dev (>= 2.22.3),
61 libgtest-dev,
62+ libqtdbusmock1-dev (>= 0.3),
63+ libqtdbustest1-dev,
64+ libunity-api-dev,
65 liburl-dispatcher1-dev,
66 libpulse-dev (>= 1:4.0-0ubuntu21),
67 libpulse-mainloop-glib0 (>= 0.9.18),
68 libnotify-dev,
69 libgee-dev,
70 libxml2-dev,
71+ pulseaudio,
72 python3-dbusmock,
73+ qt5-default,
74+ qtbase5-dev,
75+ qtbase5-dev-tools,
76+ qtdeclarative5-dev,
77+ qtdeclarative5-dev-tools,
78 Standards-Version: 3.9.4
79 Homepage: https://launchpad.net/indicator-sound
80 # If you aren't a member of ~indicator-applet-developers but need to upload
81
82=== modified file 'src/CMakeLists.txt'
83--- src/CMakeLists.txt 2016-01-05 13:50:18 +0000
84+++ src/CMakeLists.txt 2016-01-05 13:50:19 +0000
85@@ -207,5 +207,4 @@
86 RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/indicator-sound/
87 )
88
89-# Disable integration tests
90-# add_subdirectory(gmenuharness)
91+add_subdirectory(gmenuharness)
92
93=== modified file 'src/service.vala'
94--- src/service.vala 2016-01-05 13:50:18 +0000
95+++ src/service.vala 2016-01-05 13:50:19 +0000
96@@ -40,7 +40,7 @@
97 warn_notification.set_hint ("x-canonical-non-shaped-icon", "true");
98 warn_notification.set_hint ("x-canonical-snap-decisions", "true");
99 warn_notification.set_hint ("x-canonical-private-affirmative-tint", "true");
100- warn_notification.closed.connect((n) => { n.clear_actions(); });
101+ warn_notification.closed.connect((n) => { n.clear_actions(); waiting_user_approve_warn=false; });
102 BusWatcher.watch_namespace (GLib.BusType.SESSION,
103 "org.freedesktop.Notifications",
104 () => { debug("Notifications name appeared"); },
105@@ -609,7 +609,10 @@
106 var warn = loud
107 && this.notify_server_supports_actions
108 && !this.volume_control.high_volume_approved;
109-
110+ if (waiting_user_approve_warn && volume_control.below_warning_volume) {
111+ volume_control.set_warning_volume();
112+ close_notification(warn_notification);
113+ }
114 if (warn) {
115 close_notification(info_notification);
116 if (_pre_warn_volume == null) {
117
118=== modified file 'src/volume-control-pulse.vala'
119--- src/volume-control-pulse.vala 2016-01-05 13:50:18 +0000
120+++ src/volume-control-pulse.vala 2016-01-05 13:50:19 +0000
121@@ -140,40 +140,45 @@
122
123 VolumeControl.ActiveOutput ret_output = VolumeControl.ActiveOutput.SPEAKERS;
124 /* Check if the current active port is headset/headphone */
125- /* There is not easy way to check if the port is a headset/headphone besides
126- * checking for the port name. On touch (with the pulseaudio droid element)
127- * the headset/headphone port is called 'output-headset' and 'output-headphone'.
128- * On the desktop this is usually called 'analog-output-headphones' */
129+ /* There is not easy way to check if the port is a headset/headphone besides
130+ * checking for the port name. On touch (with the pulseaudio droid element)
131+ * the headset/headphone port is called 'output-headset' and 'output-headphone'.
132+ * On the desktop this is usually called 'analog-output-headphones' */
133+
134+ // first of all check if we are in call mode
135+ if (sink.active_port != null && sink.active_port.name == "output-speaker+wired_headphone") {
136+ return VolumeControl.ActiveOutput.CALL_MODE;
137+ }
138 // look if it's a headset/headphones
139 if (sink.name == "indicator_sound_test_headphones" ||
140 (sink.active_port != null &&
141 (sink.active_port.name.contains("headset") ||
142- sink.active_port.name.contains("headphone")))) {
143- _active_port_headphone = true;
144- // check if it's a bluetooth device
145- var device_bus = sink.proplist.gets ("device.bus");
146- if (device_bus != null && device_bus == "bluetooth") {
147- ret_output = VolumeControl.ActiveOutput.BLUETOOTH_HEADPHONES;
148- } else if (device_bus != null && device_bus == "usb") {
149- ret_output = VolumeControl.ActiveOutput.USB_HEADPHONES;
150- } else if (device_bus != null && device_bus == "hdmi") {
151- ret_output = VolumeControl.ActiveOutput.HDMI_HEADPHONES;
152- } else {
153- ret_output = VolumeControl.ActiveOutput.HEADPHONES;
154- }
155+ sink.active_port.name.contains("headphone")))) {
156+ _active_port_headphone = true;
157+ // check if it's a bluetooth device
158+ var device_bus = sink.proplist.gets ("device.bus");
159+ if (device_bus != null && device_bus == "bluetooth") {
160+ ret_output = VolumeControl.ActiveOutput.BLUETOOTH_HEADPHONES;
161+ } else if (device_bus != null && device_bus == "usb") {
162+ ret_output = VolumeControl.ActiveOutput.USB_HEADPHONES;
163+ } else if (device_bus != null && device_bus == "hdmi") {
164+ ret_output = VolumeControl.ActiveOutput.HDMI_HEADPHONES;
165+ } else {
166+ ret_output = VolumeControl.ActiveOutput.HEADPHONES;
167+ }
168 } else {
169 // speaker
170 _active_port_headphone = false;
171 var device_bus = sink.proplist.gets ("device.bus");
172- if (device_bus != null && device_bus == "bluetooth") {
173- ret_output = VolumeControl.ActiveOutput.BLUETOOTH_SPEAKER;
174- } else if (device_bus != null && device_bus == "usb") {
175+ if (device_bus != null && device_bus == "bluetooth") {
176+ ret_output = VolumeControl.ActiveOutput.BLUETOOTH_SPEAKER;
177+ } else if (device_bus != null && device_bus == "usb") {
178 ret_output = VolumeControl.ActiveOutput.USB_SPEAKER;
179 } else if (device_bus != null && device_bus == "hdmi") {
180 ret_output = VolumeControl.ActiveOutput.HDMI_SPEAKER;
181 } else {
182 ret_output = VolumeControl.ActiveOutput.SPEAKERS;
183- }
184+ }
185 }
186
187 return ret_output;
188@@ -253,7 +258,9 @@
189
190 // check if the output has changed, if so... emit a signal
191 VolumeControl.ActiveOutput active_output_now = active_output;
192- if (active_output_now != active_output_before) {
193+ if (active_output_now != active_output_before &&
194+ (active_output_now != VolumeControl.ActiveOutput.CALL_MODE &&
195+ active_output_before != VolumeControl.ActiveOutput.CALL_MODE)) {
196 this.active_output_changed (active_output_now);
197 if (active_output_now == VolumeControl.ActiveOutput.SPEAKERS) {
198 _high_volume_approved = false;
199@@ -738,6 +745,10 @@
200 get { return this._high_volume; }
201 private set { this._high_volume = value; }
202 }
203+ public override bool below_warning_volume {
204+ get { return this._volume.volume < this._warning_volume_norms; }
205+ private set { }
206+ }
207 private void init_high_volume() {
208 _settings.changed["warning-volume-enabled"].connect(() => update_high_volume_cache());
209 _settings.changed["warning-volume-decibels"].connect(() => update_high_volume_cache());
210@@ -779,6 +790,14 @@
211 }
212 }
213
214+ public override void set_warning_volume() {
215+ var vol = new VolumeControl.Volume();
216+ vol.volume = _warning_volume_norms;
217+ vol.reason = _volume.reason;
218+ debug("Setting warning level volume from %f down to %f", _volume.volume, vol.volume);
219+ volume = vol;
220+ }
221+
222 /** HIGH VOLUME APPROVED PROPERTY **/
223
224 private bool _high_volume_approved = false;
225
226=== modified file 'src/volume-control.vala'
227--- src/volume-control.vala 2016-01-05 13:50:18 +0000
228+++ src/volume-control.vala 2016-01-05 13:50:19 +0000
229@@ -36,7 +36,8 @@
230 USB_SPEAKER,
231 USB_HEADPHONES,
232 HDMI_SPEAKER,
233- HDMI_HEADPHONES
234+ HDMI_HEADPHONES,
235+ CALL_MODE
236 }
237
238 public class Volume : Object {
239@@ -48,6 +49,7 @@
240 public virtual bool ready { get { return false; } set { } }
241 public virtual bool active_mic { get { return false; } set { } }
242 public virtual bool high_volume { get { return false; } protected set { } }
243+ public virtual bool below_warning_volume { get { return false; } protected set { } }
244 public virtual bool mute { get { return false; } }
245 public virtual bool is_playing { get { return false; } }
246 public virtual VolumeControl.ActiveOutput active_output { get { return VolumeControl.ActiveOutput.SPEAKERS; } }
247@@ -59,6 +61,7 @@
248 public virtual bool high_volume_approved { get { return false; } protected set { } }
249 public virtual void approve_high_volume() { }
250 public virtual void clamp_to_high_volume() { }
251+ public virtual void set_warning_volume() { }
252
253 public abstract void set_mute (bool mute);
254
255
256=== modified file 'tests/CMakeLists.txt'
257--- tests/CMakeLists.txt 2016-01-05 13:50:18 +0000
258+++ tests/CMakeLists.txt 2016-01-05 13:50:19 +0000
259@@ -281,7 +281,6 @@
260 indicator-test
261 )
262
263-# Disable integration tests
264-# add_subdirectory(integration)
265-# add_subdirectory(dbus-types)
266-# add_subdirectory(service-mocks)
267+add_subdirectory(integration)
268+add_subdirectory(dbus-types)
269+add_subdirectory(service-mocks)
270\ No newline at end of file

Subscribers

People subscribed via source and target branches