diff options
| author | Xavi Garcia Mena <xavi.garcia.mena@canonical.com> | 2016-03-17 10:06:24 +0000 |
|---|---|---|
| committer | CI Train Bot <ci-train-bot@canonical.com> | 2016-03-17 10:06:24 +0000 |
| commit | ce15e8ab1cc1fd37df3badad69da4e0ecc7b9318 (patch) | |
| tree | 26e355f5d1c702dc8a2b9e67702ace213e9054ec /tests/integration/test-indicator.cpp | |
| parent | e24fb23ad146190a7ba873abb620e2a6def0ad21 (diff) | |
| parent | 2acd4961a7e5af93f863503eca90f51d28e6603d (diff) | |
| download | ayatana-indicator-sound-ce15e8ab1cc1fd37df3badad69da4e0ecc7b9318.tar.gz ayatana-indicator-sound-ce15e8ab1cc1fd37df3badad69da4e0ecc7b9318.tar.bz2 ayatana-indicator-sound-ce15e8ab1cc1fd37df3badad69da4e0ecc7b9318.zip | |
Changed to code to get the root icon. Now it does not take into account the source output, as in fact that code was not differentiating between any particular case.
The code was added in the past in the case that we should differentiate between bluetooth, headphones, etc... but it was never used. Fixes: #1555831
Approved by: Charles Kerr
Diffstat (limited to 'tests/integration/test-indicator.cpp')
| -rw-r--r-- | tests/integration/test-indicator.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/integration/test-indicator.cpp b/tests/integration/test-indicator.cpp index eff1516..bb08c40 100644 --- a/tests/integration/test-indicator.cpp +++ b/tests/integration/test-indicator.cpp @@ -32,6 +32,68 @@ 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()); + + // check that the volume is set and give + // time to the indicator to start + EXPECT_MATCHRESULT(mh::MenuMatcher(phoneParameters()) + .item(mh::MenuItemMatcher() + .action("indicator.root") + .string_attribute("x-canonical-type", "com.canonical.indicator.root") + .string_attribute("x-canonical-scroll-action", "indicator.scroll") + .string_attribute("x-canonical-secondary-action", "indicator.mute") + .string_attribute("submenu-action", "indicator.indicator-shown") + .mode(mh::MenuItemMatcher::Mode::all) + .submenu() + .item(mh::MenuItemMatcher() + .section() + .item(silentModeSwitch(false)) + .item(volumeSlider(INITIAL_VOLUME, "Volume")) + ) + .item(mh::MenuItemMatcher() + .label("Sound Settingsā¦") + .action("indicator.phone-settings") + ) + ).match()); + + 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; |
