Skip to content

Commit e88b667

Browse files
Test GetFloatFrequencyDataAsync
1 parent 1c2992f commit e88b667

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

tests/IntegrationTests/AudioNodeTests/AnalyserNodeTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ public async Task GetFloatFrequencyDataAsync_ShouldPopulateBuffer()
1515
// Arrange
1616
await using AudioContext context = await GetAudioContextAsync();
1717

18-
await using OscillatorNode oscillator = await OscillatorNode.CreateAsync(EvaluationContext.JSRuntime, context);
19-
await using AnalyserNode node = await AnalyserNode.CreateAsync(EvaluationContext.JSRuntime, context);
18+
await using OscillatorNode oscillator = await OscillatorNode.CreateAsync(JSRuntime, context);
19+
await using AnalyserNode node = await AnalyserNode.CreateAsync(JSRuntime, context);
2020
await oscillator.ConnectAsync(node);
2121
await oscillator.StartAsync();
2222

2323
int bufferLength = (int)await node.GetFrequencyBinCountAsync();
24-
await using Float32Array array = await Float32Array.CreateAsync(EvaluationContext.JSRuntime, bufferLength);
24+
await using Float32Array array = await Float32Array.CreateAsync(JSRuntime, bufferLength);
2525

2626
// Act
2727
await node.GetFloatFrequencyDataAsync(array);

tests/IntegrationTests/AudioNodeTests/AudioBufferSourceNodeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ public class AudioBufferSourceNodeTest : AudioNodeTest<AudioBufferSourceNode>
44
{
55
public override async Task<AudioBufferSourceNode> GetDefaultInstanceAsync()
66
{
7-
return await AudioBufferSourceNode.CreateAsync(EvaluationContext.JSRuntime, await GetAudioContextAsync());
7+
return await AudioBufferSourceNode.CreateAsync(JSRuntime, await GetAudioContextAsync());
88
}
99
}

tests/IntegrationTests/AudioNodeTests/AudioNodeWithAudioNodeOptions.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ namespace IntegrationTests.AudioNodeTests;
1111

1212
public override async Task<TAudioNode> GetDefaultInstanceAsync()
1313
{
14-
return await CreateAsync(EvaluationContext.JSRuntime, await GetAudioContextAsync(), null);
14+
return await CreateAsync(JSRuntime, await GetAudioContextAsync(), null);
1515
}
1616

1717
[Test]
1818
public async Task CreateAsync_WithEmptyOptions_Succeeds()
1919
{
2020
// Act
21-
await using TAudioNode node = await CreateAsync(EvaluationContext.JSRuntime, await GetAudioContextAsync(), new TAudioNodeOptions());
21+
await using TAudioNode node = await CreateAsync(JSRuntime, await GetAudioContextAsync(), new TAudioNodeOptions());
2222

2323
// Assert
2424
_ = node.Should().BeOfType<TAudioNode>();
@@ -28,8 +28,8 @@ public async Task CreateAsync_WithEmptyOptions_Succeeds()
2828
public async Task CreateAsync_WithEmptyOptions_HasSameChannelCountModeAsWhenNoOptionsAreUsed()
2929
{
3030
// Arrange
31-
await using TAudioNode emptyOptionsNode = await CreateAsync(EvaluationContext.JSRuntime, await GetAudioContextAsync(), new TAudioNodeOptions());
32-
await using TAudioNode noOptionsNode = await CreateAsync(EvaluationContext.JSRuntime, await GetAudioContextAsync(), null);
31+
await using TAudioNode emptyOptionsNode = await CreateAsync(JSRuntime, await GetAudioContextAsync(), new TAudioNodeOptions());
32+
await using TAudioNode noOptionsNode = await CreateAsync(JSRuntime, await GetAudioContextAsync(), null);
3333

3434
// Act
3535
ChannelCountMode emptyOptionsCountMode = await emptyOptionsNode.GetChannelCountModeAsync();
@@ -43,8 +43,8 @@ public async Task CreateAsync_WithEmptyOptions_HasSameChannelCountModeAsWhenNoOp
4343
public async Task CreateAsync_WithEmptyOptions_HasSameChannelInterpretationAsWhenNoOptionsAreUsed()
4444
{
4545
// Arrange
46-
await using TAudioNode emptyOptionsNode = await CreateAsync(EvaluationContext.JSRuntime, await GetAudioContextAsync(), new TAudioNodeOptions());
47-
await using TAudioNode noOptionsNode = await CreateAsync(EvaluationContext.JSRuntime, await GetAudioContextAsync(), null);
46+
await using TAudioNode emptyOptionsNode = await CreateAsync(JSRuntime, await GetAudioContextAsync(), new TAudioNodeOptions());
47+
await using TAudioNode noOptionsNode = await CreateAsync(JSRuntime, await GetAudioContextAsync(), null);
4848

4949
// Act
5050
ChannelInterpretation emptyOptionsChannelInterpretation = await emptyOptionsNode.GetChannelInterpretationAsync();
@@ -67,7 +67,7 @@ public async Task CreateAsync_WithDifferentChannelCountModes_SetsChannelCountMod
6767
// Act
6868
Func<Task<ChannelCountMode>> action = async () =>
6969
{
70-
await using TAudioNode node = await CreateAsync(EvaluationContext.JSRuntime, await GetAudioContextAsync(), options);
70+
await using TAudioNode node = await CreateAsync(JSRuntime, await GetAudioContextAsync(), options);
7171
return await node.GetChannelCountModeAsync();
7272
};
7373

@@ -95,7 +95,7 @@ public async Task CreateAsync_WithDifferentChannelInterpretations_SetsChannelInt
9595
// Act
9696
Func<Task<ChannelInterpretation>> action = async () =>
9797
{
98-
await using TAudioNode node = await CreateAsync(EvaluationContext.JSRuntime, await GetAudioContextAsync(), options);
98+
await using TAudioNode node = await CreateAsync(JSRuntime, await GetAudioContextAsync(), options);
9999
return await node.GetChannelInterpretationAsync();
100100
};
101101

tests/IntegrationTests/AudioNodeTests/ConstantSourceNodeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ public class ConstantSourceNodeTest : AudioNodeTest<ConstantSourceNode>
44
{
55
public override async Task<ConstantSourceNode> GetDefaultInstanceAsync()
66
{
7-
return await ConstantSourceNode.CreateAsync(EvaluationContext.JSRuntime, await GetAudioContextAsync());
7+
return await ConstantSourceNode.CreateAsync(JSRuntime, await GetAudioContextAsync());
88
}
99
}

tests/IntegrationTests/AudioNodeTests/IIRFilterNodeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public class IIRFilterNodeTest : AudioNodeTest<IIRFilterNode>
44
{
55
public override async Task<IIRFilterNode> GetDefaultInstanceAsync()
66
{
7-
return await IIRFilterNode.CreateAsync(EvaluationContext.JSRuntime, await GetAudioContextAsync(), new IIRFilterOptions()
7+
return await IIRFilterNode.CreateAsync(JSRuntime, await GetAudioContextAsync(), new IIRFilterOptions()
88
{
99
Feedforward = [1],
1010
Feedback = [1],

tests/IntegrationTests/AudioNodeTests/MediaElementAudioSourceNodeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class MediaElementAudioSourceNodeTest : AudioNodeTest<MediaElementAudioSo
88
public override async Task<MediaElementAudioSourceNode> GetDefaultInstanceAsync()
99
{
1010
IJSObjectReference element = await EvaluationContext.GetAudioElementAyns();
11-
return await MediaElementAudioSourceNode.CreateAsync(EvaluationContext.JSRuntime, await GetAudioContextAsync(), new MediaElementAudioSourceOptions()
11+
return await MediaElementAudioSourceNode.CreateAsync(JSRuntime, await GetAudioContextAsync(), new MediaElementAudioSourceOptions()
1212
{
1313
MediaElement = element
1414
});

tests/IntegrationTests/AudioNodeTests/MediaStreamAudioSourceNodeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public class MediaStreamAudioSourceNodeTest : AudioNodeTest<MediaStreamAudioSour
44
{
55
public override async Task<MediaStreamAudioSourceNode> GetDefaultInstanceAsync()
66
{
7-
return await MediaStreamAudioSourceNode.CreateAsync(EvaluationContext.JSRuntime, await GetAudioContextAsync(), new MediaStreamAudioSourceOptions()
7+
return await MediaStreamAudioSourceNode.CreateAsync(JSRuntime, await GetAudioContextAsync(), new MediaStreamAudioSourceOptions()
88
{
99
MediaStream = await EvaluationContext.GetMediaStream()
1010
});

tests/IntegrationTests/Infrastructure/BlazorTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected AudioContextEvaluationContext EvaluationContextCreator(IServiceProvide
2828
}
2929

3030
protected IJSRuntime JSRuntime => EvaluationContext.JSRuntime;
31-
protected async Task<AudioContext> GetAudioContextAsync() => await GetAudioContextAsync();
31+
protected async Task<AudioContext> GetAudioContextAsync() => await EvaluationContext.GetAudioContext();
3232

3333
protected IPlaywright PlaywrightInstance { get; set; }
3434
protected IBrowser Browser { get; set; }

0 commit comments

Comments
 (0)