Skip to content

Commit 72925be

Browse files
Added tests for GetFftSizeAsync and SetFftSizeAsync
1 parent 632f262 commit 72925be

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/IntegrationTests/AudioNodeTests/AnalyserNodeTest.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,42 @@ public async Task GetByteTimeDomainDataAsync_ShouldPopulateBuffer()
9696
byte tenthElement = await buffer.AtAsync(bufferLength - 1);
9797
_ = tenthElement.Should().NotBe(0);
9898
}
99+
100+
[Test]
101+
[TestCase(32ul)]
102+
[TestCase(64ul)]
103+
public async Task GetFftSizeAsync_ShouldRetrieveFftSize(ulong fftSize)
104+
{
105+
// Arrange
106+
await using AudioContext context = await GetAudioContextAsync();
107+
108+
await using AnalyserNode node = await AnalyserNode.CreateAsync(JSRuntime, context, new()
109+
{
110+
FftSize = fftSize
111+
});
112+
113+
// Act
114+
ulong readFftSize = await node.GetFftSizeAsync();
115+
116+
// Assert
117+
_ = readFftSize.Should().Be(fftSize);
118+
}
119+
120+
[Test]
121+
[TestCase(32ul)]
122+
[TestCase(64ul)]
123+
public async Task SetFftSizeAsync_ShouldUpdateFftSize(ulong fftSize)
124+
{
125+
// Arrange
126+
await using AudioContext context = await GetAudioContextAsync();
127+
128+
await using AnalyserNode node = await AnalyserNode.CreateAsync(JSRuntime, context);
129+
130+
// Act
131+
await node.SetFftSizeAsync(fftSize);
132+
133+
// Assert
134+
ulong readFftSize = await node.GetFftSizeAsync();
135+
_ = readFftSize.Should().Be(fftSize);
136+
}
99137
}

0 commit comments

Comments
 (0)