Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
def test_status():
    sound = Sound()

    assert sound.status == SoundSource.Status.Stopped
Ejemplo n.º 4
0
def test_construction():
    sound = Sound()

    assert isinstance(sound, SoundSource)
    assert isinstance(sound, Sound)
Ejemplo n.º 5
0
def test_attenuation():
    sound = Sound()

    assert type(sound.attenuation) is float
    sound.attenuation = 2
Ejemplo n.º 6
0
def test_min_distance():
    sound = Sound()

    assert type(sound.min_distance) is float
    sound.min_distance = 2
Ejemplo n.º 7
0
def test_relative_to_listener():
    sound = Sound()

    assert type(sound.relative_to_listener) is bool
    sound.relative_to_listener = True
Ejemplo n.º 8
0
def test_position():
    sound = Sound()

    assert type(sound.position) is Vector3f
    sound.position = Vector3f(1, 2, 4)
Ejemplo n.º 9
0
def test_volume():
    sound = Sound()

    assert type(sound.volume) is float
    sound.volume = 80
Ejemplo n.º 10
0
def test_pitch():
    sound = Sound()

    assert type(sound.pitch) is float
    sound.pitch = 2
Ejemplo n.º 11
0
def test_loop():
    sound = Sound()

    assert type(sound.loop) is bool
    sound.loop = True