예제 #1
0
def test_create_manager():

    SampleManager.create_manager("sfx", "tests/configurations/smp_ok.json")

    manager = SampleManager.get_manager("sfx")
    assert manager is not None
    assert len(manager.samples.keys()) > 0
예제 #2
0
def test_play_sample_loop_end_fade():

    manager = SampleManager.create_manager("test",
                                           "tests/configurations/smp_ok.json")
    assert manager is not None
    assert len(manager.samples.keys()) > 0

    sound = manager.get_sample("engine_max")
    sound.play(loops=100)
    sound.stop(fadeout_ms=5000)
    time.sleep(3)
예제 #3
0
def test_play_all_samples():

    manager = SampleManager.create_manager("test",
                                           "tests/configurations/smp_ok.json")
    assert manager is not None
    assert len(manager.samples.keys()) > 0

    for sample_name, sound in manager.samples.items():
        logger.debug(f"Playing sample {sample_name}")
        sound.play()
        time.sleep(1)
예제 #4
0
def test_faulty_conf_manager():

    with pytest.raises(ValueError) as ex:
        SampleManager.create_manager("nah",
                                     "tests/configurations/smp_nah.json")

    with pytest.raises(ValueError) as ex:
        SampleManager.create_manager("buggy",
                                     "tests/configurations/smp_buggy.json")

    with pytest.raises(ValueError) as ex:
        manager = SampleManager("tests/configurations/smp_nah.json")

    with pytest.raises(ValueError) as ex:
        manager = SampleManager("tests/configurations/smp_buggy.json")
예제 #5
0
def test_unknown_manager():

    with pytest.raises(ValueError) as ex:
        manager = SampleManager.get_manager("nah")