pjs/content/canvas/test/test_2d.state.saverestore.s...

32 строки
841 B
HTML

<!DOCTYPE HTML>
<title>Canvas test: 2d.state.saverestore.stack</title>
<script src="/MochiKit/MochiKit.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<body>
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<script>
var _deferred = false;
SimpleTest.waitForExplicitFinish();
MochiKit.DOM.addLoadEvent(function () {
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');
ctx.lineWidth = 1;
ctx.save();
ctx.lineWidth = 2;
ctx.save();
ctx.lineWidth = 3;
ok(ctx.lineWidth == 3, "ctx.lineWidth == 3");
ctx.restore();
ok(ctx.lineWidth == 2, "ctx.lineWidth == 2");
ctx.restore();
ok(ctx.lineWidth == 1, "ctx.lineWidth == 1");
if (!_deferred) SimpleTest.finish();
});
</script>