@@ -7,11 +7,9 @@ namespace IntegrationTests.AudioNodeTests;
77{
88 public abstract Task < TAudioNode > CreateAsync ( IJSRuntime jSRuntime , AudioContext context , TAudioNodeOptions ? options ) ;
99
10- public virtual TAudioNodeOptions ? CreateDefaultOptions ( ) => null ;
11-
1210 public override async Task < TAudioNode > GetDefaultInstanceAsync ( )
1311 {
14- return await CreateAsync ( EvaluationContext . JSRuntime , await EvaluationContext . GetAudioContext ( ) , CreateDefaultOptions ( ) ?? null ) ;
12+ return await CreateAsync ( EvaluationContext . JSRuntime , await EvaluationContext . GetAudioContext ( ) , null ) ;
1513 }
1614
1715 [ Test ]
@@ -20,7 +18,7 @@ public async Task CreateAsync_WithEmptyOptions_Succeeds()
2018 // Arrange
2119 AfterRenderAsync = async ( ) =>
2220 {
23- return await CreateAsync ( EvaluationContext . JSRuntime , await EvaluationContext . GetAudioContext ( ) , CreateDefaultOptions ( ) ?? new TAudioNodeOptions ( ) ) ;
21+ return await CreateAsync ( EvaluationContext . JSRuntime , await EvaluationContext . GetAudioContext ( ) , new TAudioNodeOptions ( ) ) ;
2422 } ;
2523
2624 // Act
@@ -30,4 +28,52 @@ public async Task CreateAsync_WithEmptyOptions_Succeeds()
3028 _ = EvaluationContext . Exception . Should ( ) . BeNull ( ) ;
3129 _ = EvaluationContext . Result . Should ( ) . BeOfType < TAudioNode > ( ) ;
3230 }
31+
32+ [ Test ]
33+ public async Task CreateAsync_WithEmptyOptions_HasSameChannelCountModeAsWhenNoOptionsAreUsed ( )
34+ {
35+ // Arrange
36+ AfterRenderAsync = async ( ) =>
37+ {
38+ await using TAudioNode emptyOptionsNode = await CreateAsync ( EvaluationContext . JSRuntime , await EvaluationContext . GetAudioContext ( ) , new TAudioNodeOptions ( ) ) ;
39+ await using TAudioNode noOptionsNode = await CreateAsync ( EvaluationContext . JSRuntime , await EvaluationContext . GetAudioContext ( ) , null ) ;
40+
41+ ChannelCountMode emptyOptionsCountMode = await emptyOptionsNode . GetChannelCountModeAsync ( ) ;
42+ ChannelCountMode noOptionsCountMode = await noOptionsNode . GetChannelCountModeAsync ( ) ;
43+
44+ return ( emptyOptionsCountMode , noOptionsCountMode ) ;
45+ } ;
46+
47+ // Act
48+ await OnAfterRerenderAsync ( ) ;
49+
50+ // Assert
51+ _ = EvaluationContext . Exception . Should ( ) . BeNull ( ) ;
52+ ( ChannelCountMode emptyOptionsCountMode , ChannelCountMode noOptionsCountMode ) = EvaluationContext . Result . Should ( ) . BeOfType < ( ChannelCountMode , ChannelCountMode ) > ( ) . Subject ;
53+ _ = emptyOptionsCountMode . Should ( ) . Be ( noOptionsCountMode ) ;
54+ }
55+
56+ [ Test ]
57+ public async Task CreateAsync_WithEmptyOptions_HasSameChannelInterpretationAsWhenNoOptionsAreUsed ( )
58+ {
59+ // Arrange
60+ AfterRenderAsync = async ( ) =>
61+ {
62+ await using TAudioNode emptyOptionsNode = await CreateAsync ( EvaluationContext . JSRuntime , await EvaluationContext . GetAudioContext ( ) , new TAudioNodeOptions ( ) ) ;
63+ await using TAudioNode noOptionsNode = await CreateAsync ( EvaluationContext . JSRuntime , await EvaluationContext . GetAudioContext ( ) , null ) ;
64+
65+ ChannelInterpretation emptyOptionsChannelInterpretation = await emptyOptionsNode . GetChannelInterpretationAsync ( ) ;
66+ ChannelInterpretation noOptionsChannelInterpretation = await noOptionsNode . GetChannelInterpretationAsync ( ) ;
67+
68+ return ( emptyOptionsChannelInterpretation , noOptionsChannelInterpretation ) ;
69+ } ;
70+
71+ // Act
72+ await OnAfterRerenderAsync ( ) ;
73+
74+ // Assert
75+ _ = EvaluationContext . Exception . Should ( ) . BeNull ( ) ;
76+ ( ChannelInterpretation emptyOptionsChannelInterpretation , ChannelInterpretation noOptionsChannelInterpretation ) = EvaluationContext . Result . Should ( ) . BeOfType < ( ChannelInterpretation , ChannelInterpretation ) > ( ) . Subject ;
77+ _ = emptyOptionsChannelInterpretation . Should ( ) . Be ( noOptionsChannelInterpretation ) ;
78+ }
3379}
0 commit comments