This commit is contained in:
@@ -11,6 +11,29 @@ TEST(AudioTest, FriendlyDeviceNameMapping) {
|
||||
EXPECT_EQ(mapToFriendlyDeviceName(""), "Default Audio Output");
|
||||
}
|
||||
|
||||
TEST(AudioTest, ResolvePlaybackDeviceNameHandlesSentinels) {
|
||||
// The sentinel and 0 mean "system default" and never correspond to a real
|
||||
// enumerated playback device, so they resolve to the empty (default) name.
|
||||
EXPECT_EQ(AudioManager::resolvePlaybackDeviceName(0), "");
|
||||
EXPECT_EQ(AudioManager::resolvePlaybackDeviceName(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK), "");
|
||||
}
|
||||
|
||||
TEST(AudioTest, GetPlaybackDevicesFallsBackWithIdZeroWhenNone) {
|
||||
AudioManager am;
|
||||
auto devices = am.getPlaybackDevices();
|
||||
// Headless hosts (CI) expose no playback devices, so expect the synthetic
|
||||
// fallback entry that carries id 0 (the "system default" marker).
|
||||
if (devices.empty()) {
|
||||
// No devices and no fallback would be a contract violation.
|
||||
FAIL() << "getPlaybackDevices() returned an empty list without fallback";
|
||||
}
|
||||
for (const auto& d : devices) {
|
||||
if (d.raw_name.empty()) {
|
||||
EXPECT_EQ(d.id, 0u);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(AudioTest, AudioManagerVolumeClamping) {
|
||||
radiantwave::config::ConfigManager config;
|
||||
std::string temp_path = (std::filesystem::temp_directory_path() / "test_rw_audio_cfg.yaml").string();
|
||||
|
||||
Reference in New Issue
Block a user