def test_buffer(): sound = Sound() assert sound.buffer is None sound_buffer = SoundBuffer() resources = pathlib.Path(__file__).parent.parent.absolute() / 'resources' sound_buffer.load_from_file(str(resources / 'canary.wav')) sound.buffer = sound_buffer assert sound.buffer is sound_buffer
def test_playing_offset(): sound = Sound() assert isinstance(sound.playing_offset, Time) assert sound.playing_offset.as_seconds() == 0 sound_buffer = SoundBuffer() resources = pathlib.Path(__file__).parent.parent.absolute() / 'resources' sound_buffer.load_from_file(str(resources / 'canary.wav')) sound.buffer = sound_buffer sound.loop = True sound.play() sound.playing_offset = seconds(0.5) assert type(sound.playing_offset) is Time
def test_status(): sound = Sound() assert sound.status == SoundSource.Status.Stopped
def test_construction(): sound = Sound() assert isinstance(sound, SoundSource) assert isinstance(sound, Sound)
def test_attenuation(): sound = Sound() assert type(sound.attenuation) is float sound.attenuation = 2
def test_min_distance(): sound = Sound() assert type(sound.min_distance) is float sound.min_distance = 2
def test_relative_to_listener(): sound = Sound() assert type(sound.relative_to_listener) is bool sound.relative_to_listener = True
def test_position(): sound = Sound() assert type(sound.position) is Vector3f sound.position = Vector3f(1, 2, 4)
def test_volume(): sound = Sound() assert type(sound.volume) is float sound.volume = 80
def test_pitch(): sound = Sound() assert type(sound.pitch) is float sound.pitch = 2
def test_loop(): sound = Sound() assert type(sound.loop) is bool sound.loop = True