diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2016-01-05 13:13:41 -0600 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2016-01-05 13:13:41 -0600 |
commit | 7dcc73303a60aba6c636408fa22ccaed07baf64c (patch) | |
tree | b0b4a1fa061be766576e663ac67c63fd2b445563 /tests/integration/indicator-sound-test-base.cpp | |
parent | 3c528a11f39af91d2856aeac606fdaf8a6c6b673 (diff) | |
parent | 6f4f8c2b9caee08499a3a9ee3fd434c2b6a0f3ca (diff) | |
download | ayatana-indicator-sound-7dcc73303a60aba6c636408fa22ccaed07baf64c.tar.gz ayatana-indicator-sound-7dcc73303a60aba6c636408fa22ccaed07baf64c.tar.bz2 ayatana-indicator-sound-7dcc73303a60aba6c636408fa22ccaed07baf64c.zip |
adding lp:~xavi-garcia-mena/indicator-sound/action-sync-volume
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; +} |