2 <title>Canvas test: text.textBaseline
</title>
3 <script src=
"/MochiKit/MochiKit.js"></script>
4 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
5 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css">
7 <canvas id=
"c" width=
"100" height=
"50"><p class=
"fallback">FAIL (fallback content)
</p></canvas>
11 SimpleTest
.waitForExplicitFinish();
12 MochiKit
.DOM
.addLoadEvent(function () {
14 var canvas
= document
.getElementById('c');
15 var ctx
= canvas
.getContext('2d');
17 is(ctx
.textBaseline
, 'alphabetic', "default textBaseline is not 'alphabetic'");
20 ctx
.textBaseline
= 'ideographic';
21 is(ctx
.textBaseline
, 'ideographic', 'textBaseline getter returns incorrect value');
24 ctx
.textBaseline
= 'top';
25 is(ctx
.textBaseline
, 'top', 'textBaseline getter returns incorrect value');
28 ctx
.textBaseline
= 'middle';
29 is(ctx
.textBaseline
, 'middle', 'textBaseline getter returns incorrect value');
32 ctx
.textBaseline
= 'bottom';
33 is(ctx
.textBaseline
, 'bottom', 'textBaseline getter returns incorrect value');
36 ctx
.textBaseline
= 'hanging';
37 is(ctx
.textBaseline
, 'hanging', 'textBaseline getter returns incorrect value');
40 ctx
.textBaseline
= 'alphabetic';
41 is(ctx
.textBaseline
, 'alphabetic', 'textBaseline getter returns incorrect value');
44 is(ctx
.textBaseline
, 'hanging', 'textBaseline not being stored in the context state');
47 is(ctx
.textBaseline
, 'bottom', 'textBaseline not being stored in the context state');
50 is(ctx
.textBaseline
, 'middle', 'textBaseline not being stored in the context state');
53 is(ctx
.textBaseline
, 'top', 'textBaseline not being stored in the context state');
56 is(ctx
.textBaseline
, 'ideographic', 'textBaseline not being stored in the context state');
59 is(ctx
.textBaseline
, 'alphabetic', 'textBaseline not being stored in the context state');
61 if (!_deferred
) SimpleTest
.finish();