aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavi Garcia Mena <xavi.garcia.mena@canonical.com>2015-12-02 17:19:19 +0100
committerXavi Garcia Mena <xavi.garcia.mena@canonical.com>2015-12-02 17:19:19 +0100
commitc61e4c4f2c5e24f374c0d6e3c90c318443403c94 (patch)
tree014fb27c9dabbafecdb37707727c4f9a9182c3d0
parentd9a00604c1d8e3103444053da39a4af17230903b (diff)
downloadayatana-indicator-sound-c61e4c4f2c5e24f374c0d6e3c90c318443403c94.tar.gz
ayatana-indicator-sound-c61e4c4f2c5e24f374c0d6e3c90c318443403c94.tar.bz2
ayatana-indicator-sound-c61e4c4f2c5e24f374c0d6e3c90c318443403c94.zip
Changes after review. Method to increment sync counter and integration test changed
-rw-r--r--src/service.vala8
-rw-r--r--tests/integration/test-indicator.cpp7
2 files changed, 9 insertions, 6 deletions
diff --git a/src/service.vala b/src/service.vala
index 3ac6b89..923aba2 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -43,7 +43,7 @@ public class IndicatorSound.Service: Object {
warn_notification.closed.connect((n) => {
n.clear_actions();
waiting_user_approve_warn=false;
- volume_sync_action.set_state(new Variant.uint64 (++volume_sync_number_));
+ increment_volume_sync_action();
});
BusWatcher.watch_namespace (GLib.BusType.SESSION,
"org.freedesktop.Notifications",
@@ -639,7 +639,7 @@ public class IndicatorSound.Service: Object {
warn_notification.add_action ("cancel", _("Cancel"), (n, a) => {
_pre_warn_volume = null;
waiting_user_approve_warn = false;
- volume_sync_action.set_state(new Variant.uint64 (++volume_sync_number_));
+ increment_volume_sync_action();
});
waiting_user_approve_warn = true;
show_notification(warn_notification);
@@ -832,6 +832,10 @@ public class IndicatorSound.Service: Object {
return volume_sync_action;
}
+ void increment_volume_sync_action () {
+ volume_sync_action.set_state(new Variant.uint64 (++volume_sync_number_));
+ }
+
uint export_actions = 0;
Variant action_state_for_player (MediaPlayer player, bool show_track = true) {
diff --git a/tests/integration/test-indicator.cpp b/tests/integration/test-indicator.cpp
index 54c56b5..f36a764 100644
--- a/tests/integration/test-indicator.cpp
+++ b/tests/integration/test-indicator.cpp
@@ -786,9 +786,8 @@ TEST_F(TestIndicator, PhoneNotificationWarningVolume)
// check the sync value before cancelling the dialog
bool isValid;
- qlonglong syncValue = getVolumeSyncValue(&isValid);
+ qlonglong syncValueBeforeCancel = getVolumeSyncValue(&isValid);
EXPECT_TRUE(isValid);
- EXPECT_EQ(0, syncValue);
// cancel the dialog
pressNotificationButton(idNotification, "cancel");
@@ -811,9 +810,9 @@ TEST_F(TestIndicator, PhoneNotificationWarningVolume)
).match());
// verify that the sync value is increased
- syncValue = getVolumeSyncValue(&isValid);
+ qlonglong syncValueAfterCancel = getVolumeSyncValue(&isValid);
EXPECT_TRUE(isValid);
- EXPECT_EQ(1, syncValue);
+ EXPECT_NE(syncValueBeforeCancel, syncValueAfterCancel);
// try again...
notificationsSpy.clear();