diff options
| author | Xavi Garcia Mena <xavi.garcia.mena@canonical.com> | 2016-02-10 13:22:06 +0000 |
|---|---|---|
| committer | CI Train Bot <ci-train-bot@canonical.com> | 2016-02-10 13:22:06 +0000 |
| commit | cd1eb8bd1cb657a787d3d6fb8b2db26669581c72 (patch) | |
| tree | 8ab41e0d437047d35464a3c464c33cf037c35438 /tests/integration/indicator-sound-test-base.cpp | |
| parent | 3df5a15f0c7924214c1ae5fbaa5eca32b5c2cd54 (diff) | |
| parent | f1bdb863aea00a03acf9501432e2baa70dd9ee8b (diff) | |
| download | ayatana-indicator-sound-cd1eb8bd1cb657a787d3d6fb8b2db26669581c72.tar.gz ayatana-indicator-sound-cd1eb8bd1cb657a787d3d6fb8b2db26669581c72.tar.bz2 ayatana-indicator-sound-cd1eb8bd1cb657a787d3d6fb8b2db26669581c72.zip | |
This branch modifies the sound indicator on the desktop to only show the playback controls for those players that are active or (if any is running) the last one being active. Fixes: #1213907
Approved by: Charles Kerr, PS Jenkins bot
Diffstat (limited to 'tests/integration/indicator-sound-test-base.cpp')
| -rw-r--r-- | tests/integration/indicator-sound-test-base.cpp | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/tests/integration/indicator-sound-test-base.cpp b/tests/integration/indicator-sound-test-base.cpp index 91abf42..f61857e 100644 --- a/tests/integration/indicator-sound-test-base.cpp +++ b/tests/integration/indicator-sound-test-base.cpp @@ -192,16 +192,53 @@ bool IndicatorSoundTestBase::runProcess(QProcess& proc) bool IndicatorSoundTestBase::startTestMprisPlayer(QString const& playerName) { - testPlayer1.terminate(); - testPlayer1.start(MEDIA_PLAYER_MPRIS_BIN, QStringList() + if (!stopTestMprisPlayer(playerName)) + { + return false; + } + TestPlayer player; + player.name = playerName; + player.process.reset(new QProcess()); + player.process->start(MEDIA_PLAYER_MPRIS_BIN, QStringList() << playerName); - if (!testPlayer1.waitForStarted()) + if (!player.process->waitForStarted()) + { + qWarning() << "ERROR STARTING PLAYER " << playerName; return false; + } + testPlayers.push_back(player); return true; } +bool IndicatorSoundTestBase::stopTestMprisPlayer(QString const& playerName) +{ + bool terminateOK = true; + int index = findRunningTestMprisPlayer(playerName); + if (index != -1) + { + testPlayers[index].process->terminate(); + if (!testPlayers[index].process->waitForFinished()) + terminateOK = false; + testPlayers.remove(index); + } + + return terminateOK; +} + +int IndicatorSoundTestBase::findRunningTestMprisPlayer(QString const& playerName) +{ + for (int i = 0; i < testPlayers.size(); i++) + { + if (testPlayers.at(i).name == playerName) + { + return i; + } + } + return -1; +} + bool IndicatorSoundTestBase::setTestMprisPlayerProperty(QString const &testPlayer, QString const &property, bool value) { QProcess setProperty; |
