gecko/content/canvas/test/test_text.textAlign.html
2008-06-10 16:16:59 -07:00

58 lines
1.6 KiB
HTML

<!DOCTYPE HTML>
<title>Canvas test: text.textAlign</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');
is(ctx.textAlign, 'start', "default textAlign is not 'start'");
ctx.save();
ctx.textAlign = 'end';
is(ctx.textAlign, 'end', 'textAlign getter returns incorrect value');
ctx.save();
ctx.textAlign = 'left';
is(ctx.textAlign, 'left', 'textAlign getter returns incorrect value');
ctx.save();
ctx.textAlign = 'center';
is(ctx.textAlign, 'center', 'textAlign getter returns incorrect value');
ctx.save();
ctx.textAlign = 'right';
is(ctx.textAlign, 'right', 'textAlign getter returns incorrect value');
ctx.save();
ctx.textAlign = 'start';
is(ctx.textAlign, 'start', 'textAlign getter returns incorrect value');
ctx.restore();
is(ctx.textAlign, 'right', 'textAlign not being stored in the context state');
ctx.restore();
is(ctx.textAlign, 'center', 'textAlign not being stored in the context state');
ctx.restore();
is(ctx.textAlign, 'left', 'textAlign not being stored in the context state');
ctx.restore();
is(ctx.textAlign, 'end', 'textAlign not being stored in the context state');
ctx.restore();
is(ctx.textAlign, 'start', 'textAlign not being stored in the context state');
if (!_deferred) SimpleTest.finish();
});
</script>