Skip to content

Commit

Permalink
#5977: Check SoundManager behaviour when serving requests for files w…
Browse files Browse the repository at this point in the history
…ithout extensions
  • Loading branch information
codereader committed Jun 26, 2022
1 parent f2032df commit fbb3e81
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/SoundManager.cpp
Expand Up @@ -84,4 +84,15 @@ TEST_F(SoundManagerTest, GetWaveSoundFileDuration)
EXPECT_NEAR(duration, 0.096, 0.001) << "WAV file duration incorrect";
}

TEST_F(SoundManagerTest, GetSoundFileDurationWithoutExtension)
{
auto oggDuration = GlobalSoundManager().getSoundFileDuration("sound/test/jorge.ogg");
auto wavDuration = GlobalSoundManager().getSoundFileDuration("sound/test/jorge.wav");
EXPECT_GT(fabs(wavDuration - oggDuration), 0.05) << "The OGG file should have a different duration than the WAV file";

// This should find jorge.ogg before it falls back to jorge.wav
auto duration = GlobalSoundManager().getSoundFileDuration("sound/test/jorge");
EXPECT_NEAR(duration, oggDuration, 0.001) << "The OGG file should have been found, not the wav file";
}

}

0 comments on commit fbb3e81

Please sign in to comment.