diff options
Diffstat (limited to 'tests/integration/indicator-sound-test-base.cpp')
-rw-r--r-- | tests/integration/indicator-sound-test-base.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/tests/integration/indicator-sound-test-base.cpp b/tests/integration/indicator-sound-test-base.cpp index f61857e..cf60868 100644 --- a/tests/integration/indicator-sound-test-base.cpp +++ b/tests/integration/indicator-sound-test-base.cpp @@ -448,13 +448,37 @@ bool IndicatorSoundTestBase::initializeMenuChangedSignal() return true; } -bool IndicatorSoundTestBase::waitVolumeChangedInIndicator() +QVariant IndicatorSoundTestBase::waitPropertyChanged(QSignalSpy *signalSpy, QString property) { - if (signal_spy_volume_changed_) + QVariant ret_val; + if (signalSpy) { - return signal_spy_volume_changed_->wait(); + signalSpy->wait(); + if (signalSpy->count()) + { + QList<QVariant> arguments = signalSpy->takeLast(); + if (arguments.size() == 3 && static_cast<QMetaType::Type>(arguments.at(1).type()) == QMetaType::QVariantMap) + { + QMap<QString, QVariant> map = arguments.at(1).toMap(); + QMap<QString, QVariant>::iterator iter = map.find(property); + if (iter != map.end()) + { + return iter.value(); + } + } + } } - return false; + return ret_val; +} +bool IndicatorSoundTestBase::waitVolumeChangedInIndicator() +{ + QVariant val = waitPropertyChanged(signal_spy_volume_changed_.get(), "Volume"); + return !val.isNull(); +} + +QVariant IndicatorSoundTestBase::waitLastRunningPlayerChanged() +{ + return waitPropertyChanged(signal_spy_volume_changed_.get(), "LastRunningPlayer"); } void IndicatorSoundTestBase::initializeAccountsInterface() |