tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ctor-gain.html (1706B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>
      5      Test Constructor: Gain
      6    </title>
      7    <script src="/resources/testharness.js"></script>
      8    <script src="/resources/testharnessreport.js"></script>
      9    <script src="/webaudio/resources/audionodeoptions.js"></script>
     10  </head>
     11  <body>
     12    <script>
     13      const context = new AudioContext();
     14 
     15      test(() => {
     16        testInvalidConstructor_W3CTH('GainNode', context);
     17      }, 'GainNode: invalid constructor');
     18 
     19      test(() => {
     20        const prefix = 'node0';
     21        const node = testDefaultConstructor_W3CTH('GainNode', context, {
     22          prefix,
     23          numberOfInputs: 1,
     24          numberOfOutputs: 1,
     25          channelCount: 2,
     26          channelCountMode: 'max',
     27          channelInterpretation: 'speakers'
     28        });
     29 
     30        testDefaultAttributes_W3CTH(
     31            node,
     32            prefix,
     33            [{ name: 'gain', value: 1 }]);
     34      }, 'GainNode: default constructor and default attributes');
     35 
     36      test(() => {
     37        testAudioNodeOptions_W3CTH(context, 'GainNode');
     38      }, 'GainNode: AudioNodeOptions are applied');
     39 
     40      test(() => {
     41        const options = { gain: -2 };
     42        const node = new GainNode(context, options);
     43        assert_true(node instanceof GainNode, 'instanceof GainNode');
     44        assert_equals(node.gain.value, options.gain, 'node.gain.value');
     45        assert_equals(node.channelCount, 2, 'node.channelCount');
     46        assert_equals(node.channelCountMode, 'max', 'node.channelCountMode');
     47        assert_equals(
     48            node.channelInterpretation,
     49            'speakers',
     50            'node.channelInterpretation');
     51      }, 'GainNode: constructor with options');
     52    </script>
     53  </body>
     54 </html>