From 508573fe629b4fd65f011548712029e999763b62 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 13 Dec 2025 03:09:01 +0100 Subject: [PATCH] Add failing tests for SDL_mixer They don't compile because of missing friendly overloads. --- SDL3-CS.Tests/TestMixer.cs | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 SDL3-CS.Tests/TestMixer.cs diff --git a/SDL3-CS.Tests/TestMixer.cs b/SDL3-CS.Tests/TestMixer.cs new file mode 100644 index 0000000..262007a --- /dev/null +++ b/SDL3-CS.Tests/TestMixer.cs @@ -0,0 +1,41 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using static SDL.SDL3_mixer; +using static SDL.SDL3; + +namespace SDL.Tests +{ + [TestFixture] + public class TestMixer + { + [Test] + public unsafe void TestBasic() + { + SDL_Init(0); + + bool init = MIX_Init(); + + try + { + Assert.That(init, Is.True, SDL_GetError); + Assert.That(MIX_Version(), Is.EqualTo(SDL_MIXER_VERSION)); + + Assume.That(MIX_GetNumAudioDecoders() > 0); + string? name = MIX_GetAudioDecoder(0); + Assert.That(name, Is.Not.Null, SDL_GetError); + + Assume.That(@"C:\Windows\Media\Windows Logon.wav", Does.Exist); + var decoder = MIX_CreateAudioDecoder(@"C:\Windows\Media\Windows Logon.wav", 0); + Assert.That(decoder != null, SDL_GetError); + MIX_DestroyAudioDecoder(decoder); + } + finally + { + MIX_Quit(); + SDL_Quit(); + } + } + } +}