aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/indicator-sound-test-base.cpp43
-rw-r--r--tests/integration/indicator-sound-test-base.h2
-rw-r--r--tests/integration/test-indicator.cpp40
3 files changed, 85 insertions, 0 deletions
diff --git a/tests/integration/indicator-sound-test-base.cpp b/tests/integration/indicator-sound-test-base.cpp
index 9225c1d..b8608f6 100644
--- a/tests/integration/indicator-sound-test-base.cpp
+++ b/tests/integration/indicator-sound-test-base.cpp
@@ -989,6 +989,49 @@ QVariantList IndicatorSoundTestBase::getActionValue(QString const &action)
return QVariantList();
}
+QStringList IndicatorSoundTestBase::getRootIconValue(bool *isValid)
+{
+ QString result = 0;
+
+ QVariantList varList = getActionValue("root");
+ if (isValid != nullptr)
+ {
+ *isValid = false;
+ }
+ if (varList.at(0).canConvert<QDBusArgument>())
+ {
+ const QDBusArgument dbusArg = qvariant_cast<QDBusArgument>(varList.at(0));
+ if (dbusArg.currentType() == QDBusArgument::MapType)
+ {
+ QVariantMap map;
+ dbusArg >> map;
+ QVariantMap::const_iterator iter = map.find("icon");
+ if (iter != map.end())
+ {
+ const QDBusArgument iconArg = qvariant_cast<QDBusArgument>((*iter));
+ if (iconArg.currentType() == QDBusArgument::StructureType)
+ {
+ QString name;
+ QVariant iconValue;
+ iconArg.beginStructure();
+ iconArg >> name;
+ iconArg >> iconValue;
+ if (name == "themed" && iconValue.type() == QVariant::StringList)
+ {
+ if (isValid != nullptr)
+ {
+ *isValid = true;
+ }
+ }
+ iconArg.endStructure();
+ return iconValue.toStringList();
+ }
+ }
+ }
+ }
+ return QStringList();
+}
+
qlonglong IndicatorSoundTestBase::getVolumeSyncValue(bool *isValid)
{
qlonglong result = 0;
diff --git a/tests/integration/indicator-sound-test-base.h b/tests/integration/indicator-sound-test-base.h
index 5b3545a..7942bd5 100644
--- a/tests/integration/indicator-sound-test-base.h
+++ b/tests/integration/indicator-sound-test-base.h
@@ -148,6 +148,8 @@ protected:
qlonglong getVolumeSyncValue(bool *isValid = nullptr);
+ QStringList getRootIconValue(bool *isValid = nullptr);
+
float getVolumeValue(bool *isValid = nullptr);
static QVariant waitPropertyChanged(QSignalSpy * signalSpy, QString property);
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;