| 2621 | }); |
| 2622 | |
| 2623 | const validateVolumeParameter = value => { |
| 2624 | // `PlaySoundOnChannel` has an optional "expression" parameter (Volume, |
| 2625 | // PARAM4) defaulting to "100". |
| 2626 | const action = new gd.Instruction(); |
| 2627 | action.setType('PlaySoundOnChannel'); |
| 2628 | action.setParametersCount(6); |
| 2629 | action.setParameter(4, value); |
| 2630 | const result = gd.InstructionValidator.validateParameter( |
| 2631 | gd.JsPlatform.get(), |
| 2632 | projectScopedContainers, |
| 2633 | action, |
| 2634 | gd.MetadataProvider.getActionMetadata( |
| 2635 | gd.JsPlatform.get(), |
| 2636 | 'PlaySoundOnChannel' |
| 2637 | ), |
| 2638 | 4 |
| 2639 | ); |
| 2640 | const isValid = result.isValid(); |
| 2641 | action.delete(); |
| 2642 | return isValid; |
| 2643 | }; |
| 2644 | |
| 2645 | it('considers an optional parameter left empty as valid', function () { |
| 2646 | // The default value is used when generating the code, so it must not be |