51 lines
1.6 KiB
HTML
51 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>
|
|
AudioDestinationNode
|
|
</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
function assert_doesnt_throw(f, desc) {
|
|
try {
|
|
f();
|
|
} catch (e) {
|
|
assert_true(false, desc);
|
|
return;
|
|
}
|
|
assert_true(true, desc);
|
|
}
|
|
|
|
test(function() {
|
|
var ac = new AudioContext();
|
|
|
|
assert_equals(ac.destination.channelCount, 2,
|
|
"A DestinationNode should have two channels by default");
|
|
|
|
assert_greater_than_equal(ac.destination.maxChannelCount, 2,
|
|
"maxChannelCount should be >= 2");
|
|
|
|
assert_throws_dom("IndexSizeError", function() {
|
|
ac.destination.channelCount = ac.destination.maxChannelCount + 1
|
|
}, `Setting the channelCount to something greater than
|
|
the maxChannelCount should throw IndexSizeError`);
|
|
|
|
assert_throws_dom("NotSupportedError", function() {
|
|
ac.destination.channelCount = 0;
|
|
}, "Setting the channelCount to 0 should throw NotSupportedError");
|
|
|
|
assert_doesnt_throw(function() {
|
|
ac.destination.channelCount = ac.destination.maxChannelCount;
|
|
}, "Setting the channelCount to maxChannelCount should not throw");
|
|
|
|
assert_doesnt_throw(function() {
|
|
ac.destination.channelCount = 1;
|
|
}, "Setting the channelCount to 1 should not throw");
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|