summaryrefslogtreecommitdiffhomepage
path: root/StarsEx/test/AudioConfig.cpp
blob: 8de3b6831f78529d85d695f548cf73a28b5199fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <gtest/gtest.h>

#include <AudioConfig.h>


TEST(StarsEx, AudioConfig)
{
	AudioConfig audio;  // as a side-effect constructor sets the static instance
	ASSERT_EQ(&audio, AudioConfig::GetInstance());
	audio.SetMenuMusic(100);
	ASSERT_EQ(0, AudioConfig::MenuMusic());
	audio.SetMasterVolume(50);
	ASSERT_EQ(-2500, AudioConfig::MenuMusic());
	audio.SetMusicVolume(50);
	ASSERT_EQ(-3750, AudioConfig::MenuMusic());
	audio.SetMenuMusic(0);
	ASSERT_EQ(-5000, AudioConfig::MenuMusic());
	audio.SetEfxVolume(100);
	ASSERT_EQ(-2500, AudioConfig::EfxVolume());
	audio.SetMasterVolume(100);
	ASSERT_EQ(0, AudioConfig::EfxVolume());
	audio.SetWorldVolume(20);
	ASSERT_EQ(-4000, AudioConfig::EfxVolume());
	audio.SetEfxVolume(50);
	ASSERT_EQ(-4500, AudioConfig::EfxVolume());
}