diff options
author | Xavi Garcia Mena <xavi.garcia.mena@canonical.com> | 2016-01-05 15:08:24 +0000 |
---|---|---|
committer | CI Train Bot <ci-train-bot@canonical.com> | 2016-01-05 15:08:24 +0000 |
commit | de52ce976216ffb25bfb2c3ff3729b6fcf2ec9f4 (patch) | |
tree | b0b4a1fa061be766576e663ac67c63fd2b445563 /tests/integration/indicator-sound-test-base.cpp | |
parent | e1feb61a02a1353b42fcd85ced8e0489c711a451 (diff) | |
parent | 6f4f8c2b9caee08499a3a9ee3fd434c2b6a0f3ca (diff) | |
download | ayatana-indicator-sound-de52ce976216ffb25bfb2c3ff3729b6fcf2ec9f4.tar.gz ayatana-indicator-sound-de52ce976216ffb25bfb2c3ff3729b6fcf2ec9f4.tar.bz2 ayatana-indicator-sound-de52ce976216ffb25bfb2c3ff3729b6fcf2ec9f4.zip |
Adds an action to signal the UI to sync the current volume when we are waiting for the user to confirm or reject the high volume notification. Fixes: #1512798, #1520548
Approved by: PS Jenkins bot, Charles Kerr, Nick Dedekind
Diffstat (limited to 'tests/integration/indicator-sound-test-base.cpp')
-rw-r--r-- | tests/integration/indicator-sound-test-base.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/integration/indicator-sound-test-base.cpp b/tests/integration/indicator-sound-test-base.cpp index 5005e2c..3b9c58d 100644 --- a/tests/integration/indicator-sound-test-base.cpp +++ b/tests/integration/indicator-sound-test-base.cpp @@ -821,3 +821,69 @@ bool IndicatorSoundTestBase::setVolumeUntilAccountsIsConnected(double volume) } return (signal_spy_volume_changed_->count() != 0); } + +QVariantList IndicatorSoundTestBase::getActionValue(QString const &action) +{ + if (!menu_interface_) + { + menu_interface_.reset(new MenusInterface("com.canonical.indicator.sound", + "/com/canonical/indicator/sound", + dbusTestRunner.sessionConnection(), 0)); + } + if (menu_interface_) + { + QDBusReply<DBusActionResult> resp = menu_interface_->call(QLatin1String("Describe"), + action); + if (!resp.isValid()) + { + qWarning() << "IndicatorSoundTestBase::getActionValue(): D-Bus error: " << resp.error().message(); + return QVariantList(); + } + else + { + return resp.value().getValue(); + } + } + + return QVariantList(); +} + +qlonglong IndicatorSoundTestBase::getVolumeSyncValue(bool *isValid) +{ + qlonglong result = 0; + + QVariantList varList = getActionValue("volume-sync"); + if (varList.size() == 1) + { + result = varList.at(0).toULongLong(isValid); + } + else + { + if (isValid) + { + *isValid = false; + } + } + + return result; +} + +float IndicatorSoundTestBase::getVolumeValue(bool *isValid) +{ + float result = 0.0; + + QVariantList varList = getActionValue("volume"); + if (varList.size() == 1) + { + result = varList.at(0).toFloat(isValid); + } + else + { + if (isValid) + { + *isValid = false; + } + } + + return result; +} |