aboutsummaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/indicator-sound-test-base.cpp15
-rw-r--r--tests/integration/test-indicator.cpp63
2 files changed, 67 insertions, 11 deletions
diff --git a/tests/integration/indicator-sound-test-base.cpp b/tests/integration/indicator-sound-test-base.cpp
index 8242fb6..1cea780 100644
--- a/tests/integration/indicator-sound-test-base.cpp
+++ b/tests/integration/indicator-sound-test-base.cpp
@@ -456,17 +456,14 @@ QVariant IndicatorSoundTestBase::waitPropertyChanged(QString property)
signal_spy_volume_changed_->wait();
if (signal_spy_volume_changed_->count())
{
- QList<QVariant> arguments = signal_spy_volume_changed_->takeFirst();
+ QList<QVariant> arguments = signal_spy_volume_changed_->takeLast();
if (arguments.size() == 3 && static_cast<QMetaType::Type>(arguments.at(1).type()) == QMetaType::QVariantMap)
{
- QVariantMap map = arguments.at(1).toMap();
- QMapIterator<QString, QVariant> iter(map);
- while (iter.hasNext()) {
- iter.next();
- if (iter.key() == property)
- {
- return iter.value();
- }
+ QMap<QString, QVariant> map = arguments.at(1).toMap();
+ QMap<QString, QVariant>::iterator iter = map.find(property);
+ if (iter != map.end())
+ {
+ return iter.value();
}
}
}
diff --git a/tests/integration/test-indicator.cpp b/tests/integration/test-indicator.cpp
index 33a27af..6dbc73d 100644
--- a/tests/integration/test-indicator.cpp
+++ b/tests/integration/test-indicator.cpp
@@ -925,9 +925,7 @@ TEST_F(TestIndicator, DesktopMprisPlayersPlaybackControls)
.string_attribute("x-canonical-type", "com.canonical.unity.media-player")
)
.item(mh::MenuItemMatcher()
- .string_attribute("x-canonical-previous-action","indicator.previous.testplayer3.desktop")
.string_attribute("x-canonical-play-action","indicator.play.testplayer3.desktop")
- .string_attribute("x-canonical-next-action","indicator.next.testplayer3.desktop")
.string_attribute("x-canonical-type","com.canonical.unity.playback-item")
)
)
@@ -935,6 +933,67 @@ TEST_F(TestIndicator, DesktopMprisPlayersPlaybackControls)
.label("Sound Settingsā€¦")
)
).match());
+
+ // check that the last running player is the one we expect
+ QVariant lastPlayerRunning = waitLastRunningPlayerChanged();
+ EXPECT_TRUE(lastPlayerRunning.type() == QVariant::String);
+ EXPECT_EQ(lastPlayerRunning.toString(), "testplayer3.desktop");
+
+ // restart the indicator to simulate a new user session
+ ASSERT_NO_THROW(startIndicator());
+
+ // check that player 3 is the only one with playback controls
+ // as it was the last one being stopped
+ EXPECT_MATCHRESULT(mh::MenuMatcher(desktopParameters())
+ .item(mh::MenuItemMatcher()
+ .action("indicator.root")
+ .string_attribute("x-canonical-type", "com.canonical.indicator.root")
+ .string_attribute("x-canonical-secondary-action", "indicator.mute")
+ .mode(mh::MenuItemMatcher::Mode::all)
+ .submenu()
+ .item(mh::MenuItemMatcher()
+ .section()
+ .item(mh::MenuItemMatcher().checkbox()
+ .label("Mute")
+ )
+ .item(volumeSlider(INITIAL_VOLUME, "Volume"))
+ )
+ .item(mh::MenuItemMatcher()
+ .section()
+ .item(mh::MenuItemMatcher()
+ .action("indicator.testplayer3.desktop")
+ .label("TestPlayer3")
+ .themed_icon("icon", {"testplayer"})
+ .string_attribute("x-canonical-type", "com.canonical.unity.media-player")
+ )
+ .item(mh::MenuItemMatcher()
+ .string_attribute("x-canonical-play-action","indicator.play.testplayer3.desktop")
+ .string_attribute("x-canonical-type","com.canonical.unity.playback-item")
+ )
+ )
+ .item(mh::MenuItemMatcher()
+ .section()
+ .item(mh::MenuItemMatcher()
+ .action("indicator.testplayer1.desktop")
+ .label("TestPlayer1")
+ .themed_icon("icon", {"testplayer"})
+ .string_attribute("x-canonical-type", "com.canonical.unity.media-player")
+ )
+ )
+ .item(mh::MenuItemMatcher()
+ .section()
+ .item(mh::MenuItemMatcher()
+ .action("indicator.testplayer2.desktop")
+ .label("TestPlayer2")
+ .themed_icon("icon", {"testplayer"})
+ .string_attribute("x-canonical-type", "com.canonical.unity.media-player")
+ )
+ )
+ .item(mh::MenuItemMatcher()
+ .label("Sound Settingsā€¦")
+ )
+ ).match());
+
}
TEST_F(TestIndicator, DesktopMprisPlayerButtonsState)