aboutsummaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authorcharles kerr <charlesk@canonical.com>2015-12-19 21:14:52 -0600
committercharles kerr <charlesk@canonical.com>2015-12-19 21:14:52 -0600
commit937b0acb33b3494d1ee6d34943a3d7ded0b3445b (patch)
tree8b463d5f635aa1daae37d3b586908ae3a4dbe104 /tests/integration
parent9e54db50c17504289792ee12e4d785a69f2742ec (diff)
downloadayatana-indicator-sound-937b0acb33b3494d1ee6d34943a3d7ded0b3445b.tar.gz
ayatana-indicator-sound-937b0acb33b3494d1ee6d34943a3d7ded0b3445b.tar.bz2
ayatana-indicator-sound-937b0acb33b3494d1ee6d34943a3d7ded0b3445b.zip
bugfix: ensure integration tests work regardless of com.ubuntu.sound gsettings' values
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/indicator-sound-test-base.cpp24
-rw-r--r--tests/integration/indicator-sound-test-base.h2
-rw-r--r--tests/integration/test-indicator.cpp1
3 files changed, 24 insertions, 3 deletions
diff --git a/tests/integration/indicator-sound-test-base.cpp b/tests/integration/indicator-sound-test-base.cpp
index 3b9c58d..91abf42 100644
--- a/tests/integration/indicator-sound-test-base.cpp
+++ b/tests/integration/indicator-sound-test-base.cpp
@@ -163,13 +163,31 @@ bool IndicatorSoundTestBase::clearGSettingsPlayers()
<< "com.canonical.indicator.sound"
<< "interested-media-players"
<< "[]");
- if (!clearPlayers.waitForStarted())
+
+ return runProcess(clearPlayers);
+}
+
+bool IndicatorSoundTestBase::resetAllowAmplifiedVolume()
+{
+ QProcess proc;
+
+ proc.start("gsettings", QStringList()
+ << "reset"
+ << "com.ubuntu.sound"
+ << "allow-amplified-volume");
+
+ return runProcess(proc);
+}
+
+bool IndicatorSoundTestBase::runProcess(QProcess& proc)
+{
+ if (!proc.waitForStarted())
return false;
- if (!clearPlayers.waitForFinished())
+ if (!proc.waitForFinished())
return false;
- return clearPlayers.exitCode() == 0;
+ return proc.exitCode() == 0;
}
bool IndicatorSoundTestBase::startTestMprisPlayer(QString const& playerName)
diff --git a/tests/integration/indicator-sound-test-base.h b/tests/integration/indicator-sound-test-base.h
index 67f347f..d9d3289 100644
--- a/tests/integration/indicator-sound-test-base.h
+++ b/tests/integration/indicator-sound-test-base.h
@@ -77,6 +77,8 @@ protected:
void startAccountsService();
bool clearGSettingsPlayers();
+ bool resetAllowAmplifiedVolume();
+ bool runProcess(QProcess&);
bool startTestMprisPlayer(QString const& playerName);
diff --git a/tests/integration/test-indicator.cpp b/tests/integration/test-indicator.cpp
index 1f357d7..dca0bb6 100644
--- a/tests/integration/test-indicator.cpp
+++ b/tests/integration/test-indicator.cpp
@@ -542,6 +542,7 @@ TEST_F(TestIndicator, DesktopChangeRoleVolume)
{
double INITIAL_VOLUME = 0.0;
+ EXPECT_TRUE(resetAllowAmplifiedVolume());
ASSERT_NO_THROW(startAccountsService());
ASSERT_NO_THROW(startPulseDesktop());