File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
src/KristofferStrube.Blazor.WebAudio/Options
tests/IntegrationTests/AudioNodeTests Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,18 @@ public class DelayOptions : AudioNodeOptions
1111 /// <summary>
1212 /// The maximum delay time for the node. Time is in seconds and must be greater than <c>0</c> and less than <c>3</c> minutes (<c>180</c> seconds).
1313 /// </summary>
14+ /// <remarks>
15+ /// The default value is <c>1</c>.
16+ /// </remarks>
1417 [ JsonPropertyName ( "maxDelayTime" ) ]
1518 public double MaxDelayTime { get ; set ; } = 1 ;
1619
1720 /// <summary>
1821 /// The initial delay time for the node.
1922 /// </summary>
23+ /// <remarks>
24+ /// The default value is <c>0</c>.
25+ /// </remarks>
2026 [ JsonPropertyName ( "delayTime" ) ]
2127 public double DelayTime { get ; set ; } = 0 ;
2228}
Original file line number Diff line number Diff line change 1- using Microsoft . JSInterop ;
1+ using FluentAssertions ;
2+ using Microsoft . JSInterop ;
23
34namespace IntegrationTests . AudioNodeTests ;
45
56public class DelayNodeTest : AudioNodeWithAudioNodeOptions < DelayNode , DelayOptions >
67{
78 public override async Task < DelayNode > CreateAsync ( IJSRuntime jSRuntime , AudioContext context , DelayOptions ? options )
89 => await DelayNode . CreateAsync ( JSRuntime , AudioContext , options ) ;
10+
11+ [ Test ]
12+ [ TestCase ( 0 ) ]
13+ [ TestCase ( 10 ) ]
14+ public async Task GetDelayTimeAsync_ShouldRetrieveDelayTimeParameter ( float delayTime )
15+ {
16+ // Arrange
17+ await using DelayNode node = await DelayNode . CreateAsync ( JSRuntime , AudioContext , new ( )
18+ {
19+ DelayTime = delayTime ,
20+ MaxDelayTime = delayTime + 1 ,
21+ } ) ;
22+
23+ // Act
24+ await using AudioParam delayTimeParameter = await node . GetDelayTimeAsync ( ) ;
25+
26+ // Assert
27+ float readDelayTime = await delayTimeParameter . GetValueAsync ( ) ;
28+ _ = readDelayTime . Should ( ) . Be ( delayTime ) ;
29+
30+ await delayTimeParameter . SetValueAsync ( delayTime + 1 ) ;
31+ readDelayTime = await delayTimeParameter . GetValueAsync ( ) ;
32+ _ = readDelayTime . Should ( ) . Be ( delayTime + 1 ) ;
33+ }
934}
You can’t perform that action at this time.
0 commit comments