| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | 2 |
| 3 <!-- | 3 <!-- |
| 4 Create an oscillator of each type and verify that the type is set correctly. | 4 Create an oscillator of each type and verify that the type is set correctly. |
| 5 --> | 5 --> |
| 6 <html> | 6 <html> |
| 7 <head> | 7 <head> |
| 8 <script src="../../resources/js-test.js"></script> | 8 <script src="../../resources/testharness.js"></script> |
| 9 <script src="../../resources/testharnessreport.js"></script> |
| 9 <script src="../resources/audit-util.js"></script> | 10 <script src="../resources/audit-util.js"></script> |
| 10 <script src="../resources/audio-testing.js"></script> | 11 <script src="../resources/audio-testing.js"></script> |
| 11 </head> | 12 </head> |
| 12 | 13 |
| 13 <body> | 14 <body> |
| 14 <div id="description"></div> | |
| 15 <div id="console"></div> | |
| 16 | |
| 17 <script> | 15 <script> |
| 18 description("Basic test of setting Oscillator node types."); | |
| 19 | |
| 20 var sampleRate = 44100; | 16 var sampleRate = 44100; |
| 21 var renderLengthSeconds = 0.25; | 17 var renderLengthSeconds = 0.25; |
| 22 | 18 |
| 23 var oscTypes = ["sine", "square", "sawtooth", "triangle", "custom"]; | 19 var oscTypes = ["sine", "square", "sawtooth", "triangle", "custom"]; |
| 24 | 20 |
| 25 function runTest() | 21 function runTest() |
| 26 { | 22 { |
| 27 if (window.testRunner) { | |
| 28 testRunner.dumpAsText(); | |
| 29 testRunner.waitUntilDone(); | |
| 30 } | |
| 31 | |
| 32 window.jsTestIsAsync = true; | |
| 33 | |
| 34 // Create offline audio context. | 23 // Create offline audio context. |
| 35 var context = new OfflineAudioContext(2, sampleRate * renderLengthSeconds, s
ampleRate); | 24 var context = new OfflineAudioContext(2, sampleRate * renderLengthSeconds, s
ampleRate); |
| 36 var osc = context.createOscillator(); | 25 var osc = context.createOscillator(); |
| 37 | 26 |
| 38 // Set each possible oscillator type (except CUSTOM) and verify that the typ
e is correct. | 27 // Set each possible oscillator type (except CUSTOM) and verify that the typ
e is correct. |
| 39 // Here we're setting the type using WebIDL enum values which are strings. | 28 // Here we're setting the type using WebIDL enum values which are strings. |
| 40 for (var k = 0; k < oscTypes.length - 1; ++k) { | 29 for (var k = 0; k < oscTypes.length - 1; ++k) { |
| 41 osc.type = oscTypes[k]; | 30 osc.type = oscTypes[k]; |
| 42 Should("osc.type = '" + oscTypes[k] + "'", osc.type).beEqualTo(oscTypes[
k]); | 31 Should("osc.type = '" + oscTypes[k] + "'", osc.type).beEqualTo(oscTypes[
k]); |
| 43 } | 32 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 57 Should("osc.setPeriodicWave(wave)", function () { | 46 Should("osc.setPeriodicWave(wave)", function () { |
| 58 osc.setPeriodicWave(wave); | 47 osc.setPeriodicWave(wave); |
| 59 }).notThrow(); | 48 }).notThrow(); |
| 60 Should("osc.type", osc.type).beEqualTo("custom"); | 49 Should("osc.type", osc.type).beEqualTo("custom"); |
| 61 | 50 |
| 62 // Check that numerical values are no longer supported | 51 // Check that numerical values are no longer supported |
| 63 var oldType = osc.type; | 52 var oldType = osc.type; |
| 64 osc.type = 0; | 53 osc.type = 0; |
| 65 Should("osc.type = 0", osc.type).notBeEqualTo(0); | 54 Should("osc.type = 0", osc.type).notBeEqualTo(0); |
| 66 Should("osc.type", osc.type).beEqualTo(oldType); | 55 Should("osc.type", osc.type).beEqualTo(oldType); |
| 67 | |
| 68 finishJSTest(); | |
| 69 } | 56 } |
| 70 | 57 |
| 71 runTest(); | 58 runTest(); |
| 72 successfullyParsed = true; | |
| 73 | |
| 74 </script> | 59 </script> |
| 75 | 60 |
| 76 | 61 |
| 77 </body> | 62 </body> |
| 78 </html> | 63 </html> |
| OLD | NEW |