Files
Triforce-Source/tests/test_sdl_audio_library.py
ruckus7382sfgsgdf 4fa4f9188b Triforce v0.8.0
Evil HD (SMAA Ultra, 16x filtering, full textures, ambient occlusion with bounce light, sunlight shafts, foliage drawn 4x as far, the remastered texture pack's loader and the launcher's download of it), FSR 3.1 frame generation for every GPU, Intel XeSS, FSR 4 model choice, ReShade presets, Auto (this PC), HUD placement, the options menu in 13 languages, a second input for every control, hold to toggle, DualSense speaker and haptics, NFC from the player's own dumps, the above-60 fps game fixes, the Debug tab's flight and Inventory fixes, the launcher's full settings, and over 250 fixes.
2026-11-25 10:21:32 -06:00

43 lines
1.9 KiB
Python

"""The sound, the window and the controllers load one SDL, the one beside the executable before the system's."""
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
SDL = ROOT / "host" / "hos_sdl.c"
POSIX = ROOT / "host" / "posix" / "win32_posix.c"
class SdlAudioLibraryTests(unittest.TestCase):
def test_the_bundled_sdl_first(self):
text = SDL.read_text(encoding="utf-8")
start = text.index("static HMODULE load_one")
fn = text[start:text.index("\n}", start)]
self.assertLess(fn.index("GetModuleFileNameA"), fn.index("LoadLibraryA(dll)"))
def test_sdl3_before_sdl2(self):
text = SDL.read_text(encoding="utf-8")
start = text.index("int hos_sdl_load(void)")
fn = text[start:text.index("\n}", start)]
self.assertLess(fn.index('load_one("SDL3.dll")'), fn.index('load_one("SDL2.dll")'))
def test_audio_takes_the_same_sdl(self):
text = POSIX.read_text(encoding="utf-8")
start = text.index("MMRESULT waveOutOpen")
fn = text[start:text.index("MMRESULT waveOutPrepareHeader", start)]
self.assertIn("hos_sdl_audio_open_device(", fn)
self.assertNotIn("LoadLibraryA", fn)
def test_audio_device_buffer_matches_audio_frame_quantum(self):
text = SDL.read_text(encoding="utf-8")
start = text.index("void *hos_sdl_audio_open_device(")
fn = text[start:text.index("\n}", start)]
self.assertIn('const char *env_samples = getenv("SDL_AUDIO_DEVICE_SAMPLE_FRAMES");', fn)
self.assertIn('frames > 0 ? frames : 480', fn)
self.assertIn('if (!env_samples) hos_sdl_hint("SDL_AUDIO_DEVICE_SAMPLE_FRAMES", samples);', fn)
self.assertIn('if (!env_samples) hos_sdl_hint("SDL_AUDIO_DEVICE_SAMPLE_FRAMES", NULL);', fn)
self.assertIn('env_samples && atoi(env_samples) > 0 ? atoi(env_samples) : frames > 0 ? frames : 512', fn)
if __name__ == "__main__":
raise SystemExit(unittest.main(verbosity=1))