audioparam-default-value.window.js (869B)
1 'use strict'; 2 3 test(() => { 4 const context = new OfflineAudioContext(1, 1, 44100); 5 const gainNode = new GainNode(context); 6 assert_equals(gainNode.gain.defaultValue, 1, 7 'GainNode.gain.defaultValue should be 1.'); 8 }, 'AudioParam: defaultValue attribute value'); 9 10 test(() => { 11 const context = new OfflineAudioContext(1, 1, 44100); 12 const gainNode = new GainNode(context); 13 assert_readonly(gainNode.gain, 'defaultValue'); 14 }, 'AudioParam: defaultValue is a read-only attribute'); 15 16 test(() => { 17 const context = new OfflineAudioContext(1, 1, 44100); 18 const initialValue = -1; 19 const gainNode = new GainNode(context, { 20 gain: initialValue, 21 }); 22 assert_equals(gainNode.gain.value, initialValue, 23 'GainNode.gain.value should be initialized to the value ' + 24 'from the constructor.'); 25 }, 'AudioParam: value attribute is initialized correctly');