-
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(AudioSwitching): Fix issue for Windows 10 <= 1709 where the new a…
…udio API aren't available Fixes SOUNDSWITCH-GS
- Loading branch information
Showing
6 changed files
with
69 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using NUnit.Framework; | ||
using SoundSwitch.Audio.Manager.Interop.Client.Extended; | ||
using SoundSwitch.Audio.Manager.Interop.Client.Extended.Factory; | ||
|
||
namespace SoundSwitch.Audio.Manager.Tests; | ||
|
||
[TestFixture] | ||
public sealed class AudioPolicyConfigTests | ||
{ | ||
[Test] | ||
public void CreateAudioPolicyConfigTest() | ||
{ | ||
Assert.DoesNotThrow(() => | ||
{ | ||
AudioPolicyConfigFactory.Create(); | ||
}); | ||
} | ||
|
||
[Test] | ||
public void UnsupportedWindowsVersionTest() | ||
{ | ||
var audioPolicyConfig = AudioPolicyConfigFactory.Create(); | ||
if (Environment.OSVersion.Version.Major < 10 || Environment.OSVersion.Version.Build <= AudioPolicyConfigFactory.OS_1709_VERSION) | ||
Assert.True(audioPolicyConfig is UnsupportedAudioPolicyConfig, $"audioPolicyConfig should be {nameof(UnsupportedAudioPolicyConfig)} if not on Windows 10 versions above 1709"); | ||
else | ||
Assert.True(audioPolicyConfig is AudioPolicyConfig, $"audioPolicyConfig should be a valid {nameof(AudioPolicyConfig)}"); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
SoundSwitch.Audio.Manager.Tests/SoundSwitch.Audio.Manager.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0-windows</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" /> | ||
<PackageReference Include="NUnit" Version="3.13.2" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" /> | ||
<PackageReference Include="coverlet.collector" Version="3.1.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\SoundSwitch.Audio.Manager\SoundSwitch.Audio.Manager.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
1 change: 0 additions & 1 deletion
1
SoundSwitch.Audio.Manager/Interop/Client/Extended/AudioPolicyConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters