@@ -79,6 +79,33 @@ TEST_F(SoundTest, SetVolume)
7979 sound.setVolume (56.04 );
8080}
8181
82+ TEST_F (SoundTest, SetEffect)
83+ {
84+ Sound sound (" sound1" , " a" , " wav" );
85+
86+ // Pitch
87+ EXPECT_CALL (*m_player, setPitch (0.125 ));
88+ sound.setEffect (Sound::Effect::Pitch, -400 );
89+
90+ EXPECT_CALL (*m_player, setPitch (0.125 ));
91+ sound.setEffect (Sound::Effect::Pitch, -360 );
92+
93+ EXPECT_CALL (*m_player, setPitch (0.5 ));
94+ sound.setEffect (Sound::Effect::Pitch, -120 );
95+
96+ EXPECT_CALL (*m_player, setPitch (1 ));
97+ sound.setEffect (Sound::Effect::Pitch, 0 );
98+
99+ EXPECT_CALL (*m_player, setPitch (2 ));
100+ sound.setEffect (Sound::Effect::Pitch, 120 );
101+
102+ EXPECT_CALL (*m_player, setPitch (8 ));
103+ sound.setEffect (Sound::Effect::Pitch, 360 );
104+
105+ EXPECT_CALL (*m_player, setPitch (8 ));
106+ sound.setEffect (Sound::Effect::Pitch, 400 );
107+ }
108+
82109TEST_F (SoundTest, Start)
83110{
84111 Sound sound (" sound1" , " a" , " wav" );
@@ -137,6 +164,8 @@ TEST_F(SoundTest, Clone)
137164 EXPECT_CALL (*clonePlayer, loadCopy (m_player.get ())).WillOnce (Return (true ));
138165 EXPECT_CALL (*m_player, volume ()).WillOnce (Return (0.45 ));
139166 EXPECT_CALL (*clonePlayer, setVolume (0.45 ));
167+ EXPECT_CALL (*m_player, pitch ()).WillOnce (Return (1.25 ));
168+ EXPECT_CALL (*clonePlayer, setPitch (1.25 ));
140169 EXPECT_CALL (*clonePlayer, isLoaded ()).WillOnce (Return (true ));
141170 auto clone = sound->clone ();
142171 ASSERT_TRUE (clone);
@@ -152,6 +181,8 @@ TEST_F(SoundTest, Clone)
152181 EXPECT_CALL (*cloneClonePlayer, loadCopy (m_player.get ())).WillOnce (Return (true ));
153182 EXPECT_CALL (*clonePlayer, volume ()).WillOnce (Return (0.62 ));
154183 EXPECT_CALL (*cloneClonePlayer, setVolume (0.62 ));
184+ EXPECT_CALL (*clonePlayer, pitch ()).WillOnce (Return (0.5 ));
185+ EXPECT_CALL (*cloneClonePlayer, setPitch (0.5 ));
155186 EXPECT_CALL (*cloneClonePlayer, isLoaded ()).WillOnce (Return (true ));
156187 auto cloneClone = clone->clone ();
157188 ASSERT_TRUE (cloneClone);
@@ -162,6 +193,8 @@ TEST_F(SoundTest, Clone)
162193 EXPECT_CALL (*anotherClonePlayer, loadCopy).Times (0 );
163194 EXPECT_CALL (*clonePlayer, volume ()).WillOnce (Return (0.62 ));
164195 EXPECT_CALL (*anotherClonePlayer, setVolume (0.62 ));
196+ EXPECT_CALL (*clonePlayer, pitch ()).WillOnce (Return (2 ));
197+ EXPECT_CALL (*anotherClonePlayer, setPitch (2 ));
165198 EXPECT_CALL (*anotherClonePlayer, isLoaded ()).Times (0 );
166199 auto anotherClone = clone->clone ();
167200 ASSERT_TRUE (anotherClone);
0 commit comments