-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
349 additions
and
22 deletions.
There are no files selected for viewing
Submodule LibAtem
updated
11 files
103 changes: 103 additions & 0 deletions
103
LibAtem.MockTests/AudioRouting/TestAudioRoutingOutput.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
using BMDSwitcherAPI; | ||
using LibAtem.Commands.AudioRouting; | ||
using LibAtem.MockTests.SdkState; | ||
using LibAtem.MockTests.Util; | ||
using LibAtem.State; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace LibAtem.MockTests.AudioRouting | ||
{ | ||
[Collection("ServerClientPool")] | ||
public class TestAudioRoutingOutput | ||
{ | ||
private readonly ITestOutputHelper _output; | ||
private readonly AtemServerClientPool _pool; | ||
|
||
public TestAudioRoutingOutput(ITestOutputHelper output, AtemServerClientPool pool) | ||
{ | ||
_output = output; | ||
_pool = pool; | ||
} | ||
|
||
private static Dictionary<uint, IBMDSwitcherAudioRoutingOutput> GetRoutableOutputs(AtemMockServerWrapper helper) | ||
{ | ||
var res = new Dictionary<uint, IBMDSwitcherAudioRoutingOutput>(); | ||
|
||
var outputIterator = AtemSDKConverter.CastSdk<IBMDSwitcherAudioRoutingOutputIterator>(helper.SdkClient.SdkSwitcher.CreateIterator); | ||
var outputsList = AtemSDKConverter.ToList<IBMDSwitcherAudioRoutingOutput>(outputIterator.Next); | ||
|
||
foreach (var output in outputsList) | ||
{ | ||
output.GetId(out uint id); | ||
res[id] = output; | ||
} | ||
|
||
return res; | ||
} | ||
|
||
[Fact] | ||
public void TestSourceId() | ||
{ | ||
var handler = CommandGenerator.CreateAutoCommandHandler<AudioRoutingOutputSetCommand, AudioRoutingOutputGetCommand>("SourceId"); | ||
AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.AudioRouting, helper => | ||
{ | ||
Dictionary<uint, IBMDSwitcherAudioRoutingOutput> allOutputs = GetRoutableOutputs(helper); | ||
List<uint> chosenIds = Randomiser.SelectionOfGroup(allOutputs.Keys.ToList()).ToList(); | ||
foreach (var outputId in chosenIds) | ||
{ | ||
IBMDSwitcherAudioRoutingOutput output = allOutputs[outputId]; | ||
Assert.NotNull(output); | ||
AtemState stateBefore = helper.Helper.BuildLibState(); | ||
Assert.NotNull(stateBefore.AudioRouting); | ||
for (int i = 0; i < 5; i++) | ||
{ | ||
uint sourceId = Randomiser.RangeInt(65535); | ||
stateBefore.AudioRouting.Outputs[outputId].SourceId = sourceId; | ||
helper.SendAndWaitForChange(stateBefore, () => | ||
{ | ||
output.SetSource(sourceId); | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
[Fact] | ||
public void TestName() | ||
{ | ||
var handler = CommandGenerator.CreateAutoCommandHandler<AudioRoutingOutputSetCommand, AudioRoutingOutputGetCommand>("Name"); | ||
AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.AudioRouting, helper => | ||
{ | ||
Dictionary<uint, IBMDSwitcherAudioRoutingOutput> allOutputs = GetRoutableOutputs(helper); | ||
List<uint> chosenIds = Randomiser.SelectionOfGroup(allOutputs.Keys.ToList()).ToList(); | ||
foreach (var outputId in chosenIds) | ||
{ | ||
IBMDSwitcherAudioRoutingOutput output = allOutputs[outputId]; | ||
Assert.NotNull(output); | ||
AtemState stateBefore = helper.Helper.BuildLibState(); | ||
Assert.NotNull(stateBefore.AudioRouting); | ||
for (int i = 0; i < 5; i++) | ||
{ | ||
string name = Randomiser.String(64); | ||
stateBefore.AudioRouting.Outputs[outputId].Name = name; | ||
helper.SendAndWaitForChange(stateBefore, () => | ||
{ | ||
output.SetName(name); | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
} |
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,72 @@ | ||
using BMDSwitcherAPI; | ||
using LibAtem.Commands.AudioRouting; | ||
using LibAtem.MockTests.SdkState; | ||
using LibAtem.MockTests.Util; | ||
using LibAtem.State; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace LibAtem.MockTests.AudioRouting | ||
{ | ||
[Collection("ServerClientPool")] | ||
public class TestAudioRoutingSource | ||
{ | ||
private readonly ITestOutputHelper _output; | ||
private readonly AtemServerClientPool _pool; | ||
|
||
public TestAudioRoutingSource(ITestOutputHelper output, AtemServerClientPool pool) | ||
{ | ||
_output = output; | ||
_pool = pool; | ||
} | ||
|
||
private static Dictionary<uint, IBMDSwitcherAudioRoutingSource> GetRoutableSources(AtemMockServerWrapper helper) | ||
{ | ||
var res = new Dictionary<uint, IBMDSwitcherAudioRoutingSource>(); | ||
|
||
var sourceIterator = AtemSDKConverter.CastSdk<IBMDSwitcherAudioRoutingSourceIterator>(helper.SdkClient.SdkSwitcher.CreateIterator); | ||
var sourceList = AtemSDKConverter.ToList<IBMDSwitcherAudioRoutingSource>(sourceIterator.Next); | ||
|
||
foreach (var source in sourceList) | ||
{ | ||
source.GetId(out uint id); | ||
res[id] = source; | ||
} | ||
|
||
return res; | ||
} | ||
|
||
[Fact] | ||
public void TestName() | ||
{ | ||
var handler = CommandGenerator.CreateAutoCommandHandler<AudioRoutingSourceSetCommand, AudioRoutingSourceGetCommand>("Name"); | ||
AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.AudioRouting, helper => | ||
{ | ||
Dictionary<uint, IBMDSwitcherAudioRoutingSource> allSources = GetRoutableSources(helper); | ||
List<uint> chosenIds = Randomiser.SelectionOfGroup(allSources.Keys.ToList()).ToList(); | ||
foreach (var sourceId in chosenIds) | ||
{ | ||
IBMDSwitcherAudioRoutingSource source = allSources[sourceId]; | ||
Assert.NotNull(source); | ||
AtemState stateBefore = helper.Helper.BuildLibState(); | ||
Assert.NotNull(stateBefore.AudioRouting); | ||
for (int i = 0; i < 5; i++) | ||
{ | ||
string name = Randomiser.String(64); | ||
stateBefore.AudioRouting.Sources[sourceId].Name = name; | ||
helper.SendAndWaitForChange(stateBefore, () => | ||
{ | ||
source.SetName(name); | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.