diff options
author | Xavi Garcia Mena <xavi.garcia.mena@canonical.com> | 2016-03-16 15:00:47 +0100 |
---|---|---|
committer | Xavi Garcia Mena <xavi.garcia.mena@canonical.com> | 2016-03-16 15:00:47 +0100 |
commit | 2269139ef937dfd92c39cef15b5385b0070c7883 (patch) | |
tree | 7e13ff0824fca11512ce9c0df6914eafda23c7bd /tests/integration/test-indicator.cpp | |
parent | e24fb23ad146190a7ba873abb620e2a6def0ad21 (diff) | |
download | ayatana-indicator-sound-2269139ef937dfd92c39cef15b5385b0070c7883.tar.gz ayatana-indicator-sound-2269139ef937dfd92c39cef15b5385b0070c7883.tar.bz2 ayatana-indicator-sound-2269139ef937dfd92c39cef15b5385b0070c7883.zip |
Changed code to get root icon, tests added
Diffstat (limited to 'tests/integration/test-indicator.cpp')
-rw-r--r-- | tests/integration/test-indicator.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/integration/test-indicator.cpp b/tests/integration/test-indicator.cpp index eff1516..fb62d4e 100644 --- a/tests/integration/test-indicator.cpp +++ b/tests/integration/test-indicator.cpp @@ -32,6 +32,46 @@ class TestIndicator: public IndicatorSoundTestBase { }; +TEST_F(TestIndicator, PhoneCheckRootIcon) +{ + double INITIAL_VOLUME = 0.0; + + ASSERT_NO_THROW(startAccountsService()); + EXPECT_TRUE(clearGSettingsPlayers()); + ASSERT_NO_THROW(startPulsePhone()); + + // initialize volumes in pulseaudio + EXPECT_TRUE(setStreamRestoreVolume("alert", INITIAL_VOLUME)); + + // start now the indicator, so it picks the new volumes + ASSERT_NO_THROW(startIndicator()); + + QStringList mutedIcon = {"audio-volume-muted-panel", "audio-volume-muted", "audio-volume", "audio"}; + EXPECT_EQ(getRootIconValue(), mutedIcon); + + QStringList lowVolumeIcon = {"audio-volume-low-panel", "audio-volume-low", "audio-volume", "audio"}; + for( double volume = 0.1; volume <= 0.3; volume+=0.1) + { + EXPECT_TRUE(setStreamRestoreVolume("alert", volume)); + EXPECT_EQ(getRootIconValue(), lowVolumeIcon); + } + EXPECT_TRUE(setStreamRestoreVolume("alert", 0.4)); + + QStringList mediumVolumeIcon = {"audio-volume-medium-panel", "audio-volume-medium", "audio-volume", "audio"}; + for( double volume = 0.4; volume <= 0.7; volume+=0.1) + { + EXPECT_TRUE(setStreamRestoreVolume("alert", volume)); + EXPECT_EQ(getRootIconValue(), mediumVolumeIcon); + } + + QStringList highVolumeIcon = {"audio-volume-high-panel", "audio-volume-high", "audio-volume", "audio"}; + for( double volume = 0.8; volume <= 1.0; volume+=0.1) + { + EXPECT_TRUE(setStreamRestoreVolume("alert", volume)); + EXPECT_EQ(getRootIconValue(), highVolumeIcon); + } +} + TEST_F(TestIndicator, PhoneTestExternalMicInOut) { double INITIAL_VOLUME = 0.0; |