Esempio n. 1
0
    def test_should_not_fade_out_music(self):
        self.audio_manager = AudioManager()

        try:
            self.audio_manager.fade_out_music(1)
            self.assertTrue(False)
        except:
            self.assertTrue(True)
Esempio n. 2
0
    def test_should_not_stop_music(self):
        self.audio_manager = AudioManager()

        try:
            self.audio_manager.stop_music()
            self.assertTrue(False)
        except:
            self.assertTrue(True)
Esempio n. 3
0
    def test_should_not_fade_out_sound(self):
        self.audio_manager = AudioManager()

        try:
            self.audio_manager.fade_out_sound('sound.wav', 1)
            self.assertTrue(False)
        except:
            self.assertTrue(True)
Esempio n. 4
0
    def test_should_not_play_music(self):
        self.audio_manager = AudioManager()

        try:
            self.audio_manager.play_music('doesnt_exist.mp3')
            self.assertTrue(False)
        except:
            self.assertTrue(True)
Esempio n. 5
0
    def test_should_play_sound(self):
        self.audio_manager = AudioManager()
        self.audio_manager.add_sound('sound.wav')

        try:
            self.audio_manager.play_sound('sound.wav')
            self.assertTrue(True)
        except:
            self.assertTrue(False)
Esempio n. 6
0
 def setUp(self):
     self.audio_manager = AudioManager()
Esempio n. 7
0
 def test_should_play_music(self):
     self.audio_manager = AudioManager()
     response = self.audio_manager.play_music('music.mp3')
     self.assertTrue(response)
Esempio n. 8
0
 def test_should_construct_music(self):
     self.audio_manager = AudioManager()
     self.assertTrue(self.audio_manager.music is None)
     self.assertTrue(not self.audio_manager.sounds)
Esempio n. 9
0
class AudioManagerTest(unittest.TestCase):

    def test_should_construct_music(self):
        self.audio_manager = AudioManager()
        self.assertTrue(self.audio_manager.music is None)
        self.assertTrue(not self.audio_manager.sounds)

    def test_should_play_music(self):
        self.audio_manager = AudioManager()
        response = self.audio_manager.play_music('music.mp3')
        self.assertTrue(response)

    def test_should_not_play_music(self):
        self.audio_manager = AudioManager()

        try:
            self.audio_manager.play_music('doesnt_exist.mp3')
            self.assertTrue(False)
        except:
            self.assertTrue(True)

    def test_should_stop_music(self):
        self.audio_manager = AudioManager()
        self.audio_manager.play_music('music.mp3')

        try:
            self.audio_manager.stop_music()
            self.assertTrue(True)
        except:
            self.assertTrue(False)

    def test_should_not_stop_music(self):
        self.audio_manager = AudioManager()

        try:
            self.audio_manager.stop_music()
            self.assertTrue(False)
        except:
            self.assertTrue(True)

    def test_should_fade_out_music(self):
        self.audio_manager = AudioManager()
        self.audio_manager.play_music('music.mp3')

        try:
            self.audio_manager.fade_out_music(1)
            self.assertTrue(True)
        except:
            self.assertTrue(False)

    def test_should_not_fade_out_music(self):
        self.audio_manager = AudioManager()

        try:
            self.audio_manager.fade_out_music(1)
            self.assertTrue(False)
        except:
            self.assertTrue(True)

    def test_should_add_sound(self):
        self.audio_manager = AudioManager()
        self.assertTrue(self.audio_manager.add_sound('sound.wav'))

    def test_should_play_sound(self):
        self.audio_manager = AudioManager()
        self.audio_manager.add_sound('sound.wav')

        try:
            self.audio_manager.play_sound('sound.wav')
            self.assertTrue(True)
        except:
            self.assertTrue(False)

    def test_should_not_play_sound(self):
        self.audio_manager = AudioManager()

        try:
            self.audio_manager.play_sound('doesnt_exist')
            self.assertTrue(False)
        except:
            self.assertTrue(True)

    def test_should_stop_sound(self):
        self.audio_manager = AudioManager()
        self.audio_manager.add_sound('sound.wav')
        self.audio_manager.play_sound('sound.wav')

        try:
            self.audio_manager.stop_sound('sound.wav')
            self.assertTrue(True)
        except:
            self.assertTrue(False)

    def test_should_not_stop_sound(self):
        self.audio_manager = AudioManager()

        try:
            self.audio_manager.fade_out_sound('sound.wav')
            self.assertTrue(False)
        except:
            self.assertTrue(True)

    def test_should_fade_out_sound(self):
        self.audio_manager = AudioManager()
        self.audio_manager.add_sound('sound.wav')
        self.audio_manager.play_sound('sound.wav')

        try:
            self.audio_manager.fade_out_sound('sound.wav', 1)
            self.assertTrue(False)
        except:
            self.assertTrue(True)

    def test_should_not_fade_out_sound(self):
        self.audio_manager = AudioManager()

        try:
            self.audio_manager.fade_out_sound('sound.wav', 1)
            self.assertTrue(False)
        except:
            self.assertTrue(True)
Esempio n. 10
0
 def test_should_add_sound(self):
     self.audio_manager = AudioManager()
     self.assertTrue(self.audio_manager.add_sound('sound.wav'))