2 <title>Canvas test:
2d.composite.globalAlpha.invalid
</title>
3 <script src=
"/MochiKit/MochiKit.js"></script>
4 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
5 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css">
7 <canvas id=
"c" width=
"100" height=
"50"><p class=
"fallback">FAIL (fallback content)
</p></canvas>
10 SimpleTest
.waitForExplicitFinish();
11 MochiKit
.DOM
.addLoadEvent(function () {
13 var canvas
= document
.getElementById('c');
14 var ctx
= canvas
.getContext('2d');
16 ctx
.globalAlpha
= 0.5;
17 var a
= ctx
.globalAlpha
; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons
18 var _thrown
= undefined; try {
19 ctx
.globalAlpha
= Infinity
;
20 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
21 ok(ctx
.globalAlpha
== a
, "ctx.globalAlpha == a");
22 var _thrown
= undefined; try {
23 ctx
.globalAlpha
= -Infinity
;
24 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
25 ok(ctx
.globalAlpha
== a
, "ctx.globalAlpha == a");
26 var _thrown
= undefined; try {
27 ctx
.globalAlpha
= NaN
;
28 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
29 ok(ctx
.globalAlpha
== a
, "ctx.globalAlpha == a");