From d0c9ae776af81736a119de5172cc12336dfba96c Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Wed, 11 Nov 2015 12:48:43 +0100 Subject: Re-added integration tests using gmenuharness --- debian/changelog | 76 +++++++++++++++++++++++++++++++++++++++++++++++++--- debian/control | 11 ++++++++ src/CMakeLists.txt | 3 +-- tests/CMakeLists.txt | 7 +++-- 4 files changed, 88 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index d7ed9bd..b277aa2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,79 @@ -indicator-sound (12.10.2+15.10.20151019-0ubuntu2) UNRELEASED; urgency=medium +indicator-sound (12.10.2+15.10.20151019-0ubuntu3) UNRELEASED; urgency=medium + [ Xavi Garcia ] * Added OSD notifications to show output source when the volume or source change (LP: #1382548, LP: #1415480, LP: #1484589) - - -- Xavi Garcia Tue, 03 Nov 2015 12:29:19 +0100 + + * 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 + + + -- Xavi Garcia Wed, 11 Nov 2015 12:40:10 +0100 indicator-sound (12.10.2+15.10.20151019-0ubuntu1) wily; urgency=medium diff --git a/debian/control b/debian/control index 3585713..f170fcf 100644 --- a/debian/control +++ b/debian/control @@ -5,11 +5,13 @@ Maintainer: Ubuntu Desktop Team XSBC-Original-Maintainer: Conor Curran Build-Depends: debhelper (>= 9.0), cmake, + cmake-extras (>= 0.4), dbus, dbus-test-runner (>> 14.04.0+14.04.20150120.1), dh-translations, gir1.2-accountsservice-1.0, gnome-common, + google-mock (>= 1.6.0+svn437), gsettings-ubuntu-schemas, autotools-dev, valac (>= 0.20), @@ -18,13 +20,22 @@ Build-Depends: debhelper (>= 9.0), libgirepository1.0-dev, libglib2.0-dev (>= 2.22.3), libgtest-dev, + libqtdbusmock1-dev (>= 0.3), + libqtdbustest1-dev, + libunity-api-dev, liburl-dispatcher1-dev, libpulse-dev (>= 1:4.0-0ubuntu21), libpulse-mainloop-glib0 (>= 0.9.18), libnotify-dev, libgee-dev, libxml2-dev, + pulseaudio, python3-dbusmock, + qt5-default, + qtbase5-dev, + qtbase5-dev-tools, + qtdeclarative5-dev, + qtdeclarative5-dev-tools, Standards-Version: 3.9.4 Homepage: https://launchpad.net/indicator-sound # If you aren't a member of ~indicator-applet-developers but need to upload diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6c621ae..73a270c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -207,5 +207,4 @@ install( RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/indicator-sound/ ) -# Disable integration tests -# add_subdirectory(gmenuharness) +add_subdirectory(gmenuharness) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f77bcb1..adc08de 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -281,7 +281,6 @@ add_test(indcator-test indicator-test ) -# Disable integration tests -# add_subdirectory(integration) -# add_subdirectory(dbus-types) -# add_subdirectory(service-mocks) +add_subdirectory(integration) +add_subdirectory(dbus-types) +add_subdirectory(service-mocks) \ No newline at end of file -- cgit v1.2.3 From f06c2ddee06bce9ed8320d78a65fd6206db3e6f1 Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Thu, 19 Nov 2015 15:14:47 +0100 Subject: Fix issues with warning dialog --- src/service.vala | 6 ++++-- src/volume-control-pulse.vala | 4 ++++ src/volume-control.vala | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/service.vala b/src/service.vala index 12e2ac2..2b2d667 100644 --- a/src/service.vala +++ b/src/service.vala @@ -40,7 +40,7 @@ public class IndicatorSound.Service: Object { warn_notification.set_hint ("x-canonical-non-shaped-icon", "true"); warn_notification.set_hint ("x-canonical-snap-decisions", "true"); warn_notification.set_hint ("x-canonical-private-affirmative-tint", "true"); - warn_notification.closed.connect((n) => { n.clear_actions(); }); + warn_notification.closed.connect((n) => { n.clear_actions(); waiting_user_approve_warn=false; }); BusWatcher.watch_namespace (GLib.BusType.SESSION, "org.freedesktop.Notifications", () => { debug("Notifications name appeared"); }, @@ -609,7 +609,9 @@ public class IndicatorSound.Service: Object { var warn = loud && this.notify_server_supports_actions && !this.volume_control.high_volume_approved; - + if (waiting_user_approve_warn && volume_control.below_warning_volume) { + close_notification(warn_notification); + } if (warn) { close_notification(info_notification); if (_pre_warn_volume == null) { diff --git a/src/volume-control-pulse.vala b/src/volume-control-pulse.vala index 8122f26..45cf8a6 100644 --- a/src/volume-control-pulse.vala +++ b/src/volume-control-pulse.vala @@ -738,6 +738,10 @@ public class VolumeControlPulse : VolumeControl get { return this._high_volume; } private set { this._high_volume = value; } } + public override bool below_warning_volume { + get { return this._volume.volume < this._warning_volume_norms; } + private set { } + } private void init_high_volume() { _settings.changed["warning-volume-enabled"].connect(() => update_high_volume_cache()); _settings.changed["warning-volume-decibels"].connect(() => update_high_volume_cache()); diff --git a/src/volume-control.vala b/src/volume-control.vala index 8e615ea..632af08 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -48,6 +48,7 @@ public abstract class VolumeControl : Object public virtual bool ready { get { return false; } set { } } public virtual bool active_mic { get { return false; } set { } } public virtual bool high_volume { get { return false; } protected set { } } + public virtual bool below_warning_volume { get { return false; } protected set { } } public virtual bool mute { get { return false; } } public virtual bool is_playing { get { return false; } } public virtual VolumeControl.ActiveOutput active_output { get { return VolumeControl.ActiveOutput.SPEAKERS; } } -- cgit v1.2.3 From d7fa04a96f2d9eabfdcc56574895c0c9f5785231 Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Thu, 19 Nov 2015 17:06:59 +0100 Subject: restore warning level volume when warning dialog is cancelled --- src/service.vala | 1 + src/volume-control-pulse.vala | 8 ++++++++ src/volume-control.vala | 1 + 3 files changed, 10 insertions(+) diff --git a/src/service.vala b/src/service.vala index 2b2d667..985d434 100644 --- a/src/service.vala +++ b/src/service.vala @@ -610,6 +610,7 @@ public class IndicatorSound.Service: Object { && this.notify_server_supports_actions && !this.volume_control.high_volume_approved; if (waiting_user_approve_warn && volume_control.below_warning_volume) { + volume_control.set_warning_volume(); close_notification(warn_notification); } if (warn) { diff --git a/src/volume-control-pulse.vala b/src/volume-control-pulse.vala index 45cf8a6..83b10d5 100644 --- a/src/volume-control-pulse.vala +++ b/src/volume-control-pulse.vala @@ -783,6 +783,14 @@ public class VolumeControlPulse : VolumeControl } } + public override void set_warning_volume() { + var vol = new VolumeControl.Volume(); + vol.volume = _warning_volume_norms; + vol.reason = _volume.reason; + debug("Setting warning level volume from %f down to %f", _volume.volume, vol.volume); + volume = vol; + } + /** HIGH VOLUME APPROVED PROPERTY **/ private bool _high_volume_approved = false; diff --git a/src/volume-control.vala b/src/volume-control.vala index 632af08..9b59a18 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -60,6 +60,7 @@ public abstract class VolumeControl : Object public virtual bool high_volume_approved { get { return false; } protected set { } } public virtual void approve_high_volume() { } public virtual void clamp_to_high_volume() { } + public virtual void set_warning_volume() { } public abstract void set_mute (bool mute); -- cgit v1.2.3 From 9da17031233db5f7961f3dd7be69c8a3bc13bb27 Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Mon, 23 Nov 2015 12:30:01 +0100 Subject: Added a CALL mode and avoid sending output notifications when we have an incoming call --- src/volume-control-pulse.vala | 51 ++++++++++++++++++++++++------------------- src/volume-control.vala | 3 ++- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/volume-control-pulse.vala b/src/volume-control-pulse.vala index 83b10d5..66b6ba4 100644 --- a/src/volume-control-pulse.vala +++ b/src/volume-control-pulse.vala @@ -140,40 +140,45 @@ public class VolumeControlPulse : VolumeControl VolumeControl.ActiveOutput ret_output = VolumeControl.ActiveOutput.SPEAKERS; /* Check if the current active port is headset/headphone */ - /* There is not easy way to check if the port is a headset/headphone besides - * checking for the port name. On touch (with the pulseaudio droid element) - * the headset/headphone port is called 'output-headset' and 'output-headphone'. - * On the desktop this is usually called 'analog-output-headphones' */ + /* There is not easy way to check if the port is a headset/headphone besides + * checking for the port name. On touch (with the pulseaudio droid element) + * the headset/headphone port is called 'output-headset' and 'output-headphone'. + * On the desktop this is usually called 'analog-output-headphones' */ + + // first of all check if we are in call mode + if (sink.active_port != null && sink.active_port.name == "output-speaker+wired_headphone") { + return VolumeControl.ActiveOutput.CALL_MODE; + } // look if it's a headset/headphones if (sink.name == "indicator_sound_test_headphones" || (sink.active_port != null && (sink.active_port.name.contains("headset") || - sink.active_port.name.contains("headphone")))) { - _active_port_headphone = true; - // check if it's a bluetooth device - var device_bus = sink.proplist.gets ("device.bus"); - if (device_bus != null && device_bus == "bluetooth") { - ret_output = VolumeControl.ActiveOutput.BLUETOOTH_HEADPHONES; - } else if (device_bus != null && device_bus == "usb") { - ret_output = VolumeControl.ActiveOutput.USB_HEADPHONES; - } else if (device_bus != null && device_bus == "hdmi") { - ret_output = VolumeControl.ActiveOutput.HDMI_HEADPHONES; - } else { - ret_output = VolumeControl.ActiveOutput.HEADPHONES; - } + sink.active_port.name.contains("headphone")))) { + _active_port_headphone = true; + // check if it's a bluetooth device + var device_bus = sink.proplist.gets ("device.bus"); + if (device_bus != null && device_bus == "bluetooth") { + ret_output = VolumeControl.ActiveOutput.BLUETOOTH_HEADPHONES; + } else if (device_bus != null && device_bus == "usb") { + ret_output = VolumeControl.ActiveOutput.USB_HEADPHONES; + } else if (device_bus != null && device_bus == "hdmi") { + ret_output = VolumeControl.ActiveOutput.HDMI_HEADPHONES; + } else { + ret_output = VolumeControl.ActiveOutput.HEADPHONES; + } } else { // speaker _active_port_headphone = false; var device_bus = sink.proplist.gets ("device.bus"); - if (device_bus != null && device_bus == "bluetooth") { - ret_output = VolumeControl.ActiveOutput.BLUETOOTH_SPEAKER; - } else if (device_bus != null && device_bus == "usb") { + if (device_bus != null && device_bus == "bluetooth") { + ret_output = VolumeControl.ActiveOutput.BLUETOOTH_SPEAKER; + } else if (device_bus != null && device_bus == "usb") { ret_output = VolumeControl.ActiveOutput.USB_SPEAKER; } else if (device_bus != null && device_bus == "hdmi") { ret_output = VolumeControl.ActiveOutput.HDMI_SPEAKER; } else { ret_output = VolumeControl.ActiveOutput.SPEAKERS; - } + } } return ret_output; @@ -253,7 +258,9 @@ public class VolumeControlPulse : VolumeControl // check if the output has changed, if so... emit a signal VolumeControl.ActiveOutput active_output_now = active_output; - if (active_output_now != active_output_before) { + if (active_output_now != active_output_before && + (active_output_now != VolumeControl.ActiveOutput.CALL_MODE && + active_output_before != VolumeControl.ActiveOutput.CALL_MODE)) { this.active_output_changed (active_output_now); if (active_output_now == VolumeControl.ActiveOutput.SPEAKERS) { _high_volume_approved = false; diff --git a/src/volume-control.vala b/src/volume-control.vala index 9b59a18..30dcfcf 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -36,7 +36,8 @@ public abstract class VolumeControl : Object USB_SPEAKER, USB_HEADPHONES, HDMI_SPEAKER, - HDMI_HEADPHONES + HDMI_HEADPHONES, + CALL_MODE } public class Volume : Object { -- cgit v1.2.3