35
TEST_F(TestIndicator, PhoneTestExternalMicInOut)
37
double INITIAL_VOLUME = 0.0;
39
ASSERT_NO_THROW(startAccountsService());
40
EXPECT_TRUE(clearGSettingsPlayers());
41
ASSERT_NO_THROW(startPulsePhone());
43
// initialize volumes in pulseaudio
44
EXPECT_TRUE(setStreamRestoreVolume("alert", INITIAL_VOLUME));
46
// start now the indicator, so it picks the new volumes
47
ASSERT_NO_THROW(startIndicator());
49
EXPECT_MATCHRESULT(mh::MenuMatcher(phoneParameters())
50
.item(mh::MenuItemMatcher()
51
.action("indicator.root")
52
.string_attribute("x-canonical-type", "com.canonical.indicator.root")
53
.string_attribute("x-canonical-scroll-action", "indicator.scroll")
54
.string_attribute("x-canonical-secondary-action", "indicator.mute")
55
.string_attribute("submenu-action", "indicator.indicator-shown")
56
.mode(mh::MenuItemMatcher::Mode::all)
58
.item(mh::MenuItemMatcher()
60
.item(silentModeSwitch(false))
61
.item(volumeSlider(INITIAL_VOLUME, "Volume"))
63
.item(mh::MenuItemMatcher()
64
.label("Sound Settings…")
65
.action("indicator.phone-settings")
69
EXPECT_TRUE(plugExternalMic(true));
71
// check that we have the mic slider now.
72
EXPECT_MATCHRESULT(mh::MenuMatcher(phoneParameters())
73
.item(mh::MenuItemMatcher()
74
.action("indicator.root")
75
.string_attribute("x-canonical-type", "com.canonical.indicator.root")
76
.string_attribute("x-canonical-scroll-action", "indicator.scroll")
77
.string_attribute("x-canonical-secondary-action", "indicator.mute")
78
.string_attribute("submenu-action", "indicator.indicator-shown")
79
.mode(mh::MenuItemMatcher::Mode::all)
81
.item(mh::MenuItemMatcher()
83
.item(silentModeSwitch(false))
84
.item(volumeSlider(INITIAL_VOLUME, "Volume"))
85
.item(micSlider(1.0, "Microphone Volume"))
87
.item(mh::MenuItemMatcher()
88
.label("Sound Settings…")
89
.action("indicator.phone-settings")
94
// unplug the external mic
95
EXPECT_TRUE(plugExternalMic(false));
97
// and check that there's no mic slider
98
EXPECT_MATCHRESULT(mh::MenuMatcher(phoneParameters())
99
.item(mh::MenuItemMatcher()
100
.action("indicator.root")
101
.string_attribute("x-canonical-type", "com.canonical.indicator.root")
102
.string_attribute("x-canonical-scroll-action", "indicator.scroll")
103
.string_attribute("x-canonical-secondary-action", "indicator.mute")
104
.string_attribute("submenu-action", "indicator.indicator-shown")
105
.mode(mh::MenuItemMatcher::Mode::all)
107
.item(mh::MenuItemMatcher()
109
.item(silentModeSwitch(false))
110
.item(volumeSlider(INITIAL_VOLUME, "Volume"))
112
.item(mh::MenuItemMatcher()
113
.label("Sound Settings…")
114
.action("indicator.phone-settings")
119
TEST_F(TestIndicator, DesktopTestExternalMicInOut)
121
double INITIAL_VOLUME = 0.0;
123
ASSERT_NO_THROW(startAccountsService());
124
EXPECT_TRUE(clearGSettingsPlayers());
125
ASSERT_NO_THROW(startPulseDesktop());
127
// initialize volumes in pulseaudio
128
EXPECT_FALSE(setStreamRestoreVolume("alert", INITIAL_VOLUME));
129
EXPECT_TRUE(setSinkVolume(INITIAL_VOLUME));
131
// start now the indicator, so it picks the new volumes
132
ASSERT_NO_THROW(startIndicator());
134
EXPECT_MATCHRESULT(mh::MenuMatcher(desktopParameters())
135
.item(mh::MenuItemMatcher()
136
.action("indicator.root")
137
.string_attribute("x-canonical-type", "com.canonical.indicator.root")
138
.string_attribute("x-canonical-secondary-action", "indicator.mute")
139
.mode(mh::MenuItemMatcher::Mode::all)
141
.item(mh::MenuItemMatcher()
143
.item(mh::MenuItemMatcher().checkbox()
146
.item(volumeSlider(INITIAL_VOLUME, "Volume"))
148
.item(mh::MenuItemMatcher()
149
.label("Sound Settings…")
153
EXPECT_TRUE(plugExternalMic(true));
155
EXPECT_MATCHRESULT(mh::MenuMatcher(desktopParameters())
156
.item(mh::MenuItemMatcher()
157
.action("indicator.root")
158
.string_attribute("x-canonical-type", "com.canonical.indicator.root")
159
.string_attribute("x-canonical-secondary-action", "indicator.mute")
160
.mode(mh::MenuItemMatcher::Mode::all)
162
.item(mh::MenuItemMatcher()
164
.item(mh::MenuItemMatcher().checkbox()
167
.item(volumeSlider(INITIAL_VOLUME, "Volume"))
168
.item(micSlider(1.0, "Microphone Volume"))
170
.item(mh::MenuItemMatcher()
171
.label("Sound Settings…")
175
EXPECT_TRUE(plugExternalMic(false));
177
EXPECT_MATCHRESULT(mh::MenuMatcher(desktopParameters())
178
.item(mh::MenuItemMatcher()
179
.action("indicator.root")
180
.string_attribute("x-canonical-type", "com.canonical.indicator.root")
181
.string_attribute("x-canonical-secondary-action", "indicator.mute")
182
.mode(mh::MenuItemMatcher::Mode::all)
184
.item(mh::MenuItemMatcher()
186
.item(mh::MenuItemMatcher().checkbox()
189
.item(volumeSlider(INITIAL_VOLUME, "Volume"))
191
.item(mh::MenuItemMatcher()
192
.label("Sound Settings…")
35
197
TEST_F(TestIndicator, DISABLED_PhoneChangeRoleVolume)
37
199
double INITIAL_VOLUME = 0.0;