summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webaudio/the-audio-api/the-stereopanner-interface/stereopannernode-basic.html
blob: 48bacb08c6dfb33e7d3b43e9dfda7c080bbf224d (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
<!DOCTYPE html>
<html>
  <head>
    <title>
      stereopannernode-basic.html
    </title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script src="../../resources/audit-util.js"></script>
    <script src="../../resources/audit.js"></script>
  </head>
  <body>
    <script id="layout-test-code">
      let audit = Audit.createTaskRunner();

      audit.define(
          {
            label: 'test',
            description:
                'Attributes and basic functionality of StereoPannerNode'
          },
          (task, should) => {

            let context = new AudioContext();
            let panner = context.createStereoPanner();

            should(panner.numberOfInputs, 'panner.numberOfInputs').beEqualTo(1);
            should(panner.numberOfOutputs, 'panner.numberOfOutputs')
                .beEqualTo(1);
            should(panner.pan.defaultValue, 'panner.pan.defaultValue')
                .beEqualTo(0.0);
            should(() => panner.pan.value = 1.0, 'panner.pan.value = 1.0')
                .notThrow();
            should(panner.pan.value, 'panner.pan.value').beEqualTo(1.0);

            should(() => panner.channelCount = 1, 'panner.channelCount = 1')
                .notThrow();
            should(() => panner.channelCount = 3, 'panner.channelCount = 3')
                .throw();
            should(
                () => panner.channelCountMode = 'explicit',
                'panner.channelCountMode = "explicit"')
                .notThrow();
            should(
                () => panner.channelCountMode = 'max',
                'panner.channelCountMode = "max"')
                .throw();

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