Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo n.º 6
0
 def setUp(self):
     self.audio_manager = AudioManager()
Ejemplo n.º 7
0
 def test_should_play_music(self):
     self.audio_manager = AudioManager()
     response = self.audio_manager.play_music('music.mp3')
     self.assertTrue(response)
Ejemplo 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)
Ejemplo 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)
Ejemplo n.º 10
0
 def test_should_add_sound(self):
     self.audio_manager = AudioManager()
     self.assertTrue(self.audio_manager.add_sound('sound.wav'))