summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-basic.html
blob: e176d6111e81fbff6ce75d63bec563bede61de6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html>
  <head>
    <title>
      realtimeanalyser-basic.html
    </title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script src="/webaudio/resources/audit-util.js"></script>
    <script src="/webaudio/resources/audit.js"></script>
  </head>
  <body>
    <script id="layout-test-code">
      let context = 0;

      let audit = Audit.createTaskRunner();

      audit.define('Basic AnalyserNode test', function(task, should) {
        context = new AudioContext();
        let analyser = context.createAnalyser();

        should(analyser.numberOfInputs, 'Number of inputs for AnalyserNode')
            .beEqualTo(1);

        should(analyser.numberOfOutputs, 'Number of outputs for AnalyserNode')
            .beEqualTo(1);

        should(analyser.minDecibels, 'Default minDecibels value')
            .beEqualTo(-100);

        should(analyser.maxDecibels, 'Default maxDecibels value')
            .beEqualTo(-30);

        should(
            analyser.smoothingTimeConstant,
            'Default smoothingTimeConstant value')
            .beEqualTo(0.8);

        let expectedValue = -50 - (1 / 3);
        analyser.minDecibels = expectedValue;

        should(analyser.minDecibels, 'node.minDecibels = ' + expectedValue)
            .beEqualTo(expectedValue);

        expectedValue = -40 - (1 / 3);
        analyser.maxDecibels = expectedValue;

        should(analyser.maxDecibels, 'node.maxDecibels = ' + expectedValue)
            .beEqualTo(expectedValue);

        task.done();
      });

      audit.run();
    </script>
  </body>
</html>