summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/imagebitmap_extensions.html
blob: d66fe9ad1a3aeb1ae2d854a150a2ce134549fb84 (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
<!DOCTYPE HTML>
<head>
  <title>Test ImageBitmap Extensions (Bug 1141979)</title>
  <meta charset="utf-8">
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" href="/tests/SimpleTest/test.css">
</head>
<body>
<script src="imagebitmap_extensions_prepareSources.js"></script>
<script src="imagebitmap_extensions_data.js"></script>
<script src="imagebitmap_extensions.js"></script>
<script type="text/javascript">

runTests();

function ok(expect, msg) {
  window.parent.postMessage({"type": "status", status: !!expect, msg: msg}, "*");
}

function runTests() {

  prepareSources().
    then( function() { return Promise.all([testAccessing_randomTest("Video", gVideo, 20), // video might use slightly different frames
                                           testAccessing_randomTest("Image", gImage, 0),
                                           testAccessing_randomTest("Canvas", gCanvas, 0),
                                           testAccessing_randomTest("Ctx", gCtx, 0),
                                           testAccessing_randomTest("ImageData", gImageData, 0),
                                           testAccessing_randomTest("ImageBitmap", gImageBitmap, 0),
                                           testAccessing_randomTest("PNG", gPNGBlob, 0),
                                           testAccessing_randomTest("JPEG", gJPEGBlob, 10) // JPEG loses information
                                          ]); }).
    then( function() { return Promise.all([testCreateFromArrayBffer_randomTest("Video", gVideo, 20), // video might use slightly different frames
                                           testCreateFromArrayBffer_randomTest("Image", gImage, 0),
                                           testCreateFromArrayBffer_randomTest("Canvas", gCanvas, 0),
                                           testCreateFromArrayBffer_randomTest("Ctx", gCtx, 0),
                                           testCreateFromArrayBffer_randomTest("ImageData", gImageData, 0),
                                           testCreateFromArrayBffer_randomTest("ImageBitmap", gImageBitmap, 0),
                                           testCreateFromArrayBffer_randomTest("PNG", gPNGBlob, 0),
                                           testCreateFromArrayBffer_randomTest("JPEG", gJPEGBlob, 10) // JPEG loses information
                                          ]); }).
    then(testDraw()).
    then(testExceptions).
    then(testColorConversions()).
    then(function() { return testInvalidAccess([gVideo, gImage, gCanvas, gCtx, gImageData, gImageBitmap, gPNGBlob, gJPEGBlob]); } ).
    then(function() {window.parent.postMessage({"type": "finish"}, "*");}, function(ev) { failed(ev); window.parent.postMessage({"type": "finish"}, "*"); });
}

</script>
</body>