diff options
Diffstat (limited to 'tests/integration/test-indicator.cpp')
-rw-r--r-- | tests/integration/test-indicator.cpp | 81 |
1 files changed, 52 insertions, 29 deletions
diff --git a/tests/integration/test-indicator.cpp b/tests/integration/test-indicator.cpp index 1607367..fccaf84 100644 --- a/tests/integration/test-indicator.cpp +++ b/tests/integration/test-indicator.cpp @@ -41,6 +41,7 @@ TEST_F(TestIndicator, PhoneChangeRoleVolume) // initialize volumes in pulseaudio EXPECT_TRUE(setStreamRestoreVolume("alert", INITIAL_VOLUME)); + EXPECT_TRUE(setStreamRestoreVolume("multimedia", INITIAL_VOLUME)); // start now the indicator, so it picks the new volumes ASSERT_NO_THROW(startIndicator()); @@ -79,7 +80,7 @@ TEST_F(TestIndicator, PhoneChangeRoleVolume) .item(mh::MenuItemMatcher() .section() .item(silentModeSwitch(false)) - .item(volumeSlider(randomVolume)) + .item(volumeSlider(randomVolume, "Volume")) ) ).match()); @@ -119,7 +120,7 @@ TEST_F(TestIndicator, PhoneChangeRoleVolume) .item(mh::MenuItemMatcher() .section() .item(silentModeSwitch(false)) - .item(volumeSlider(1.0)) + .item(volumeSlider(1.0, "Volume")) ) ).match()); @@ -164,7 +165,7 @@ TEST_F(TestIndicator, PhoneBasicInitialVolume) .item(mh::MenuItemMatcher() .section() .item(silentModeSwitch(false)) - .item(volumeSlider(INITIAL_VOLUME)) + .item(volumeSlider(INITIAL_VOLUME, "Volume")) ) .item(mh::MenuItemMatcher() .label("Sound Settings…") @@ -199,7 +200,7 @@ TEST_F(TestIndicator, PhoneAddMprisPlayer) .item(mh::MenuItemMatcher() .section() .item(silentModeSwitch(false)) - .item(volumeSlider(INITIAL_VOLUME)) + .item(volumeSlider(INITIAL_VOLUME, "Volume")) ) .item(mh::MenuItemMatcher() .label("Sound Settings…") @@ -229,7 +230,7 @@ TEST_F(TestIndicator, PhoneAddMprisPlayer) .item(mh::MenuItemMatcher() .section() .item(silentModeSwitch(false)) - .item(volumeSlider(INITIAL_VOLUME)) + .item(volumeSlider(INITIAL_VOLUME, "Volume")) ) .item(mh::MenuItemMatcher() .section() @@ -283,7 +284,7 @@ TEST_F(TestIndicator, DesktopBasicInitialVolume) .item(mh::MenuItemMatcher().checkbox() .label("Mute") ) - .item(volumeSlider(INITIAL_VOLUME)) + .item(volumeSlider(INITIAL_VOLUME, "Volume")) ) .item(mh::MenuItemMatcher() .section() @@ -337,7 +338,7 @@ TEST_F(TestIndicator, DesktopAddMprisPlayer) .item(mh::MenuItemMatcher().checkbox() .label("Mute") ) - .item(volumeSlider(INITIAL_VOLUME)) + .item(volumeSlider(INITIAL_VOLUME, "Volume")) ) .item(mh::MenuItemMatcher() .section() @@ -391,7 +392,7 @@ TEST_F(TestIndicator, DesktopMprisPlayerButtonsState) .item(mh::MenuItemMatcher().checkbox() .label("Mute") ) - .item(volumeSlider(INITIAL_VOLUME)) + .item(volumeSlider(INITIAL_VOLUME, "Volume")) ) .item(mh::MenuItemMatcher() .section() @@ -429,7 +430,7 @@ TEST_F(TestIndicator, DesktopMprisPlayerButtonsState) .item(mh::MenuItemMatcher().checkbox() .label("Mute") ) - .item(volumeSlider(INITIAL_VOLUME)) + .item(volumeSlider(INITIAL_VOLUME, "Volume")) ) .item(mh::MenuItemMatcher() .section() @@ -468,7 +469,7 @@ TEST_F(TestIndicator, DesktopMprisPlayerButtonsState) .item(mh::MenuItemMatcher().checkbox() .label("Mute") ) - .item(volumeSlider(INITIAL_VOLUME)) + .item(volumeSlider(INITIAL_VOLUME, "Volume")) ) .item(mh::MenuItemMatcher() .section() @@ -506,7 +507,7 @@ TEST_F(TestIndicator, DesktopMprisPlayerButtonsState) .item(mh::MenuItemMatcher().checkbox() .label("Mute") ) - .item(volumeSlider(INITIAL_VOLUME)) + .item(volumeSlider(INITIAL_VOLUME, "Volume")) ) .item(mh::MenuItemMatcher() .section() @@ -577,7 +578,7 @@ TEST_F(TestIndicator, DesktopChangeRoleVolume) .item(mh::MenuItemMatcher().checkbox() .label("Mute") ) - .item(volumeSlider(randomVolume)) + .item(volumeSlider(randomVolume, "Volume")) ) ).match()); @@ -615,7 +616,7 @@ TEST_F(TestIndicator, DesktopChangeRoleVolume) .item(mh::MenuItemMatcher() .section() .item(silentModeSwitch(false)) - .item(volumeSlider(randomVolume)) + .item(volumeSlider(randomVolume, "Volume")) ) ).match()); @@ -664,7 +665,7 @@ TEST_F(TestIndicator, PhoneNotificationVolume) .item(mh::MenuItemMatcher() .section() .item(silentModeSwitch(false)) - .item(volumeSlider(INITIAL_VOLUME)) + .item(volumeSlider(INITIAL_VOLUME, "Volume")) ) .item(mh::MenuItemMatcher() .label("Sound Settings…") @@ -681,21 +682,21 @@ TEST_F(TestIndicator, PhoneNotificationVolume) // GetServerInformation and GetCapabilities checkNotificationWithNoArgs("GetServerInformation", notificationsSpy.at(0)); checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(1)); - checkVolumeNotification(1.0, "", false, notificationsSpy.at(2)); + checkVolumeNotification(1.0, "Speakers", false, notificationsSpy.at(2)); notificationsSpy.clear(); setActionValue("volume", QVariant::fromValue(0.0)); WAIT_FOR_SIGNALS(notificationsSpy, 1) - checkVolumeNotification(0.0, "", false, notificationsSpy.at(0)); + checkVolumeNotification(0.0, "Speakers", false, notificationsSpy.at(0)); notificationsSpy.clear(); setActionValue("volume", QVariant::fromValue(0.5)); WAIT_FOR_SIGNALS(notificationsSpy, 1) - checkVolumeNotification(0.5, "", false, notificationsSpy.at(0)); + checkVolumeNotification(0.5, "Speakers", false, notificationsSpy.at(0)); } TEST_F(TestIndicator, PhoneNotificationWarningVolume) @@ -729,13 +730,14 @@ TEST_F(TestIndicator, PhoneNotificationWarningVolume) // change volume to 0.0... no warning should be emitted setActionValue("volume", QVariant::fromValue(0.0)); - WAIT_FOR_SIGNALS(notificationsSpy, 3); + WAIT_FOR_SIGNALS(notificationsSpy, 4); // the first time we also have the calls to // GetServerInformation and GetCapabilities checkNotificationWithNoArgs("GetServerInformation", notificationsSpy.at(0)); checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(1)); - checkVolumeNotification(0.0, "", false, notificationsSpy.at(2)); + checkVolumeNotification(0.0, "Headphones", false, notificationsSpy.at(2)); + checkVolumeNotification(0.0, "Headphones", false, notificationsSpy.at(3)); notificationsSpy.clear(); // change volume to 0.5... no warning should be emitted @@ -743,7 +745,7 @@ TEST_F(TestIndicator, PhoneNotificationWarningVolume) WAIT_FOR_SIGNALS(notificationsSpy, 1); - checkVolumeNotification(0.5, "", false, notificationsSpy.at(0)); + checkVolumeNotification(0.5, "Headphones", false, notificationsSpy.at(0)); notificationsSpy.clear(); // change volume to 1.0... warning should be emitted @@ -779,7 +781,7 @@ TEST_F(TestIndicator, PhoneNotificationWarningVolume) .item(mh::MenuItemMatcher() .section() .item(silentModeSwitch(false)) - .item(volumeSlider(0.74)) + .item(volumeSlider(0.74, "Volume (Headphones)")) ) ).match()); @@ -817,7 +819,7 @@ TEST_F(TestIndicator, PhoneNotificationWarningVolume) .item(mh::MenuItemMatcher() .section() .item(silentModeSwitch(false)) - .item(volumeSlider(1.0)) + .item(volumeSlider(1.0, "Volume (Headphones)")) .item(mh::MenuItemMatcher() .action("indicator.high-volume-warning-item") .label("High volume can damage your hearing.") @@ -835,8 +837,8 @@ TEST_F(TestIndicator, PhoneNotificationWarningVolume) WAIT_FOR_SIGNALS(notificationsSpy, 2); // check the notification TODO check why the sound indicator sends it twice - checkVolumeNotification(0.5, "", false, notificationsSpy.at(0)); - checkVolumeNotification(0.5, "", false, notificationsSpy.at(1)); + checkVolumeNotification(0.5, "Headphones", false, notificationsSpy.at(0)); + checkVolumeNotification(0.5, "Headphones", false, notificationsSpy.at(1)); // check that the volume was applied // and that we don't have the warning item @@ -852,7 +854,7 @@ TEST_F(TestIndicator, PhoneNotificationWarningVolume) .item(mh::MenuItemMatcher() .section() .item(silentModeSwitch(false)) - .item(volumeSlider(0.5)) + .item(volumeSlider(0.5, "Volume (Headphones)")) ) ).match()); @@ -896,13 +898,14 @@ TEST_F(TestIndicator, PhoneNotificationWarningVolumeAlertMode) // change volume to 0.0... no warning should be emitted setActionValue("volume", QVariant::fromValue(0.0)); - WAIT_FOR_SIGNALS(notificationsSpy, 3); + WAIT_FOR_SIGNALS(notificationsSpy, 4); // the first time we also have the calls to // GetServerInformation and GetCapabilities checkNotificationWithNoArgs("GetServerInformation", notificationsSpy.at(0)); checkNotificationWithNoArgs("GetCapabilities", notificationsSpy.at(1)); - checkVolumeNotification(0.0, "", false, notificationsSpy.at(2)); + checkVolumeNotification(0.0, "Headphones", false, notificationsSpy.at(2)); + checkVolumeNotification(0.0, "Headphones", false, notificationsSpy.at(3)); notificationsSpy.clear(); // change volume to 0.5... no warning should be emitted @@ -910,7 +913,7 @@ TEST_F(TestIndicator, PhoneNotificationWarningVolumeAlertMode) WAIT_FOR_SIGNALS(notificationsSpy, 1); - checkVolumeNotification(0.5, "", false, notificationsSpy.at(0)); + checkVolumeNotification(0.5, "Headphones", false, notificationsSpy.at(0)); notificationsSpy.clear(); // change volume to 1.0... no warning should be emitted, we are in alert mode @@ -918,8 +921,28 @@ TEST_F(TestIndicator, PhoneNotificationWarningVolumeAlertMode) WAIT_FOR_SIGNALS(notificationsSpy, 1); - checkVolumeNotification(1.0, "", false, notificationsSpy.at(0)); + checkVolumeNotification(1.0, "Headphones", false, notificationsSpy.at(0)); notificationsSpy.clear(); } +TEST_F(TestIndicator, PhoneNotificationHeadphoneSpeakerWiredLabels) +{ + checkPortDevicesLabels(WIRED, WIRED); +} + +TEST_F(TestIndicator, PhoneNotificationHeadphoneSpeakerBluetoothLabels) +{ + checkPortDevicesLabels(BLUETOOTH, BLUETOOTH); +} + +TEST_F(TestIndicator, PhoneNotificationHeadphoneSpeakerUSBLabels) +{ + checkPortDevicesLabels(USB, USB); +} + +TEST_F(TestIndicator, PhoneNotificationHeadphoneSpeakerHDMILabels) +{ + checkPortDevicesLabels(HDMI, HDMI); +} + } // namespace |