blob: a11f8fa289185a6767c791f3fdec3a84a5291e0d [file] [log] [blame]
chang.shu@nokia.comd5cb9102010-05-21 20:47:13 +00001<!DOCTYPE html>
2<title>Canvas test: 2d.state.saverestore.textAlign</title>
3<script src="../tests.js"></script>
4<link rel="stylesheet" href="../tests.css">
andreas.kling@nokia.com7817c162010-11-07 13:49:39 +00005<body>
6<p id="passtext">Pass</p>
7<p id="failtext">Fail</p>
8<p class="output">These images should be identical:</p>
chang.shu@nokia.comd5cb9102010-05-21 20:47:13 +00009<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
10
11<ul id="d"></ul>
12<script>
13_addTest(function(canvas, ctx) {
14
15// Test that restore() undoes any modifications
16var old = ctx.textAlign;
17ctx.save();
18ctx.textAlign = "center";
19ctx.restore();
20_assertSame(ctx.textAlign, old, "ctx.textAlign", "old");
21
22// Also test that save() doesn't modify the values
23ctx.textAlign = "center";
24old = ctx.textAlign;
25 // we're not interested in failures caused by get(set(x)) != x (e.g.
26 // from rounding), so compare against 'old' instead of against "center"
27ctx.save();
28_assertSame(ctx.textAlign, old, "ctx.textAlign", "old");
29ctx.restore();
30
31
32});
33</script>
34