content/canvas/test/test_text.textBaseline.html
author L. David Baron <dbaron@dbaron.org>
Wed, 06 May 2009 13:46:04 -0700
changeset 28048 8f7b73d88f6bbedec99c6c8ef48b243ab922d05c
parent 15295 963ced95e2d1f10252fd3c54897d81b0883c9f05
permissions -rw-r--r--
Switch HTML mochitests from using MochiKit.js to packed.js. (Bug 490955) r=sayrer

<!DOCTYPE HTML>
<title>Canvas test: text.textBaseline</title>
<script src="/MochiKit/packed.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.textBaseline, 'alphabetic', "default textBaseline is not 'alphabetic'");

ctx.save();
ctx.textBaseline = 'ideographic';
is(ctx.textBaseline, 'ideographic', 'textBaseline getter returns incorrect value');

ctx.save();
ctx.textBaseline = 'top';
is(ctx.textBaseline, 'top', 'textBaseline getter returns incorrect value');

ctx.save();
ctx.textBaseline = 'middle';
is(ctx.textBaseline, 'middle', 'textBaseline getter returns incorrect value');

ctx.save();
ctx.textBaseline = 'bottom';
is(ctx.textBaseline, 'bottom', 'textBaseline getter returns incorrect value');

ctx.save();
ctx.textBaseline = 'hanging';
is(ctx.textBaseline, 'hanging', 'textBaseline getter returns incorrect value');

ctx.save();
ctx.textBaseline = 'alphabetic';
is(ctx.textBaseline, 'alphabetic', 'textBaseline getter returns incorrect value');

ctx.restore();
is(ctx.textBaseline, 'hanging', 'textBaseline not being stored in the context state');

ctx.restore();
is(ctx.textBaseline, 'bottom', 'textBaseline not being stored in the context state');

ctx.restore();
is(ctx.textBaseline, 'middle', 'textBaseline not being stored in the context state');

ctx.restore();
is(ctx.textBaseline, 'top', 'textBaseline not being stored in the context state');

ctx.restore();
is(ctx.textBaseline, 'ideographic', 'textBaseline not being stored in the context state');

ctx.restore();
is(ctx.textBaseline, 'alphabetic', 'textBaseline not being stored in the context state');

if (!_deferred) SimpleTest.finish();
});
</script>