blob: d18d1af16af82827c0c0f88bc2f47137f5de5934 [file] [log] [blame]
<!DOCTYPE html>
<title>Canvas test: 2d.state.saverestore.shadowOffsetX</title>
<script src="../tests.js"></script>
<link rel="stylesheet" href="../tests.css">
<link rel="prev" href="2d.state.saverestore.miterLimit.html" title="2d.state.saverestore.miterLimit">
<link rel="next" href="2d.state.saverestore.shadowOffsetY.html" title="2d.state.saverestore.shadowOffsetY">
<body class="show_output">
<p>
<a href="2d.state.saverestore.miterLimit.html" accesskey="p" title="[p] 2d.state.saverestore.miterLimit">&lt;</a>
<a href="index.html">[index]</a>
<a href="2d.state.saverestore.shadowOffsetY.html" accesskey="n" title="[n] 2d.state.saverestore.shadowOffsetY">&gt;</a>
<h1><a href="index.2d.html">2d</a>.<a href="index.2d.state.html">state</a>.<a href="index.2d.state.saverestore.html">saverestore</a>.shadowOffsetX</h1>
<p class="desc">save()/restore() works for shadowOffsetX</p>
<div class="refs">References:
<ul>
<li><a href="spec.html#testrefs.2d.state.shadowOffsetX">2d.state.shadowOffsetX</a>
</ul>
</div>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
_addTest(function(canvas, ctx) {
// Test that restore() undoes any modifications
var old = ctx.shadowOffsetX;
ctx.save();
ctx.shadowOffsetX = 5;
ctx.restore();
_assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old");
// Also test that save() doesn't modify the values
ctx.shadowOffsetX = 5;
old = ctx.shadowOffsetX;
// we're not interested in failures caused by get(set(x)) != x (e.g.
// from rounding), so compare against 'old' instead of against 5
ctx.save();
_assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old");
ctx.restore();
});
</script>