[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.22
[framework/web/webkit-efl.git] / LayoutTests / webaudio / panner-set-model.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3   <head>
4     <link rel="stylesheet" href="../fast/js/resources/js-test-style.css"/>
5     <script src="resources/audio-testing.js"></script>
6     <script src="../fast/js/resources/js-test-pre.js"></script>
7     <title>Test Panner setPanningModel values.</title>
8   </head>
9
10   <body>
11     <div id="description"></div>
12     <div id="console"></div>
13
14     <script>
15       description("Test if panningModel can be set and read.");
16
17       // Test to see if we panningModel is updated when we set it.
18       function runTest() {
19           if (window.layoutTestController) {
20               layoutTestController.dumpAsText();
21               layoutTestController.waitUntilDone();
22           }
23
24           window.jsTestIsAsync = true;
25
26           var context = new webkitAudioContext();
27           var success = true;
28           var panner = context.createPanner();
29
30           // Set the panning model and see if it can be read back
31           // correctly.
32           panner.panningModel = panner.EQUALPOWER;
33           if (panner.panningModel == 0) {
34               testPassed("Panner set to EQUALPOWER model and read correctly.");
35           } else {
36               testFailed("Panner model set to EQUALPOWER (0) but returned " + panner.panningModel);
37               success = false;
38           }
39       
40           panner.panningModel = panner.HRTF;
41           if (panner.panningModel == 1) {
42               testPassed("Panner set to HRTF model and read correctly.");
43           } else {
44               testFailed("Panner model set to HRTF (1) but returned " + panner.panningModel);
45               success = false;
46           }
47
48           // SOUNDFIELD should throw exception because it is not
49           // currently implemented.  (See https://bugs.webkit.org/show_bug.cgi?id=77367)
50           try {
51               panner.panningModel = panner.SOUNDFIELD;
52               testFailed("Setting panner model to SOUNDFIELD should throw exception because it is not implemented.");
53               success = false;
54           } catch(e) {
55               testPassed("Setting panner model to SOUNDFIELD correctly throws exception because it is not implemented.");
56           }
57
58           // Other invalid models should throw an exception.
59           try {
60               panner.panningModel = 99;
61               testFailed("Illegal panner model should throw exception.");
62               success = false;
63           } catch(e) {
64               testPassed("Illegal panner model correctly throws exception.");
65           }
66           
67           if (success) {
68               testPassed("Panning model tests passed.");
69           } else {
70               testFailed("Panning model tests failed.");
71           }
72
73           finishJSTest();
74       }
75
76       runTest();
77       successfullyParsed = true;
78
79     </script>
80
81     <script src="../fast/js/resources/js-test-post.js"></script>
82   </body>
83 </html>