summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/typedarrays/Uint8ClampedArray_constructor.html
blob: 056952a4fcac0111d9c9b3aa6385aba55d5d38ea (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
<!DOCTYPE html>
<meta charset="utf-8">
<title>Typed Arrays Test: Uint8ClampedArray constructor</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="http://www.khronos.org/registry/typedarray/specs/latest/#7.1">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>

test(function() {
  var obj = new Uint8ClampedArray(new Uint8ClampedArray(8));
  assert_true(obj instanceof Uint8ClampedArray, "The constructor return Uint8ClampedArray");
  assert_equals(obj.length, 8, "The length of Uint8ClampedArray");
}, "Check if the constructor(Uint8ClampedArray) create new Uint8ClampedArray");

test(function() {
  var obj = new Uint8ClampedArray(new ArrayBuffer(8));
  assert_true(obj instanceof Uint8ClampedArray, "The constructor return Uint8ClampedArray");
  assert_equals(obj.length, 8, "The length of Uint8ClampedArray");
}, "Check if the constructor(ArrayBuffer) create new Uint8ClampedArray");

test(function() {
  var obj = new Uint8ClampedArray(new ArrayBuffer(8), 2);
  assert_true(obj instanceof Uint8ClampedArray, "The constructor return object Uint8ClampedArray");
  assert_equals(obj.length, 6, "The length of Uint8ClampedArray");
}, "Check if the constructor(ArrayBuffer, byteOffset) create new Uint8ClampedArray");

test(function() {
  var obj = new Uint8ClampedArray(new ArrayBuffer(8), 2, 4);
  assert_true(obj instanceof Uint8ClampedArray, "The constructor return object Uint8ClampedArray");
  assert_equals(obj.length, 4, "The length of Uint8ClampedArray");
}, "Check if the constructor(ArrayBuffer, byteOffset, length) create new Uint8ClampedArray");

</script>