diff options
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/indicator-sound-test-base.cpp | 24 | ||||
-rw-r--r-- | tests/integration/indicator-sound-test-base.h | 2 | ||||
-rw-r--r-- | tests/integration/test-indicator.cpp | 15 |
3 files changed, 31 insertions, 10 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..9224b73 100644 --- a/tests/integration/test-indicator.cpp +++ b/tests/integration/test-indicator.cpp @@ -32,7 +32,7 @@ class TestIndicator: public IndicatorSoundTestBase { }; -TEST_F(TestIndicator, PhoneChangeRoleVolume) +TEST_F(TestIndicator, DISABLED_PhoneChangeRoleVolume) { double INITIAL_VOLUME = 0.0; @@ -46,11 +46,11 @@ TEST_F(TestIndicator, PhoneChangeRoleVolume) // start now the indicator, so it picks the new volumes ASSERT_NO_THROW(startIndicator()); - // Generate a random volume + // Generate a random volume in the range [0...0.33] QTime now = QTime::currentTime(); qsrand(now.msec()); - int randInt = qrand() % 100; - double randomVolume = randInt / 100.0; + int randInt = qrand() % 33; + const double randomVolume = randInt / 100.0; QSignalSpy &userAccountsSpy = *signal_spy_volume_changed_; // set an initial volume to the alert role @@ -542,6 +542,7 @@ TEST_F(TestIndicator, DesktopChangeRoleVolume) { double INITIAL_VOLUME = 0.0; + EXPECT_TRUE(resetAllowAmplifiedVolume()); ASSERT_NO_THROW(startAccountsService()); ASSERT_NO_THROW(startPulseDesktop()); @@ -556,11 +557,11 @@ TEST_F(TestIndicator, DesktopChangeRoleVolume) // start now the indicator, so it picks the new volumes ASSERT_NO_THROW(startIndicator()); - // Generate a random volume + // Generate a random volume in the range [0...0.33] QTime now = QTime::currentTime(); qsrand(now.msec()); - int randInt = qrand() % 100; - double randomVolume = randInt / 100.0; + int randInt = qrand() % 33; + const double randomVolume = randInt / 100.0; // play a test sound, it should NOT change the role in the indicator EXPECT_TRUE(startTestSound("multimedia")); |