tor-browser

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

constant-source-basic.html (2344B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>Basic ConstantSourceNode Tests</title>
      5    <script src="/resources/testharness.js"></script>
      6    <script src="/resources/testharnessreport.js"></script>
      7    <script src="../../resources/start-stop-exceptions.js"></script>
      8  </head>
      9  <body>
     10    <script>
     11      const context = new AudioContext();
     12 
     13      test(() => {
     14        const node = new ConstantSourceNode(context);
     15        verifyNodeDefaults(node);
     16      }, `ConstantSourceNode constructor creates a valid node `+
     17          `with correct defaults`);
     18 
     19      test(() => {
     20        const node = new ConstantSourceNode(context);
     21        testStartStop_W3CTH(node);
     22      }, `ConstantSourceNode start()/stop() should throw correct `+
     23          `exceptions per spec`);
     24 
     25      test(() => {
     26        const node = context.createConstantSource();
     27        assert_true(node instanceof ConstantSourceNode,
     28            'Factory should return a ConstantSourceNode');
     29        verifyNodeDefaults(node);
     30      }, `context.createConstantSource() creates a ConstantSourceNode `+
     31          `with correct defaults`);
     32 
     33      test(() => {
     34        const node = context.createConstantSource();
     35        testStartStop_W3CTH(node);
     36      }, `context.createConstantSource() node start()/stop() should `+
     37          `throw correct exceptions per spec`);
     38 
     39      function verifyNodeDefaults(node) {
     40        assert_equals(node.numberOfInputs, 0, 'numberOfInputs should be 0');
     41        assert_equals(node.numberOfOutputs, 1, 'numberOfOutputs should be 1');
     42        assert_equals(node.channelCount, 2, 'channelCount should be 2');
     43        assert_equals(
     44            node.channelCountMode, 'max', 'channelCountMode should be "max"');
     45        assert_equals(
     46            node.channelInterpretation,
     47            'speakers',
     48            'channelInterpretation should be "speakers"');
     49 
     50        assert_equals(node.offset.value, 1, 'offset.value should be 1');
     51        assert_equals(
     52            node.offset.defaultValue, 1, 'offset.defaultValue should be 1');
     53        assert_equals(
     54            node.offset.minValue,
     55            Math.fround(-3.4028235e38),
     56            'offset.minValue should match spec');
     57        assert_equals(
     58            node.offset.maxValue,
     59            Math.fround(3.4028235e38),
     60            'offset.maxValue should match spec');
     61      }
     62    </script>
     63  </body>
     64 </html>