mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-06 13:30:00 +00:00
test(libSceAudioOut): cover mute and unmute restoring the volume
Muting at 100, at 90 and at 0 keeps the volume, and unmuting returns it.
This commit is contained in:
1 parent
67cb5a3301
commit
a5a8a4ba74
1 file changed
+26
@@ -13,6 +13,7 @@ void require(bool condition, const char* message) {
|
||||
void defaultState() {
|
||||
HostVolume state;
|
||||
require(state.Volume() == 100, "the volume starts at 100");
|
||||
require(!state.Muted(), "the host volume starts unmuted");
|
||||
}
|
||||
|
||||
void stepsDown() {
|
||||
@@ -46,6 +47,29 @@ void stepsStopAtMaximum() {
|
||||
require(state.Volume() == 100, "the volume never goes above 100");
|
||||
}
|
||||
|
||||
void muteKeepsVolume() {
|
||||
HostVolume state;
|
||||
state.VolumeDown();
|
||||
state.VolumeDown();
|
||||
require(state.Volume() == 90, "two steps down give 90");
|
||||
require(state.ToggleMute(), "muting changes the state");
|
||||
require(state.Muted() && state.Volume() == 90, "muting leaves the volume alone");
|
||||
require(state.ToggleMute(), "unmuting changes the state");
|
||||
require(!state.Muted() && state.Volume() == 90, "unmuting restores the volume that was set");
|
||||
}
|
||||
|
||||
void muteAtZeroAndMaximum() {
|
||||
HostVolume state;
|
||||
state.ToggleMute();
|
||||
require(state.Volume() == 100, "muting at 100 keeps 100");
|
||||
state.ToggleMute();
|
||||
for (int step = 0; step < 20; ++step) state.VolumeDown();
|
||||
state.ToggleMute();
|
||||
require(state.Muted() && state.Volume() == 0, "muting at 0 keeps 0");
|
||||
state.ToggleMute();
|
||||
require(!state.Muted() && state.Volume() == 0, "unmuting at 0 leaves 0");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main() try {
|
||||
@@ -54,6 +78,8 @@ int main() try {
|
||||
stepsStopAtZero();
|
||||
stepsUp();
|
||||
stepsStopAtMaximum();
|
||||
muteKeepsVolume();
|
||||
muteAtZeroAndMaximum();
|
||||
std::puts("host volume tests passed");
|
||||
return 0;
|
||||
} catch (const std::exception& error) {
|
||||
|
||||
Reference in new issue
Block a user