Bug 800556; test for mozDashOffset errors; r=Ms2ger

--HG--
extra : rebase_source : 834c2d1c426a8f33b66ee60e3fef912d652d5f59
This commit is contained in:
Nicholas Cameron 2012-11-13 21:39:37 -08:00
parent b75eec07c3
commit 6d44a38ee5
2 changed files with 40 additions and 0 deletions

View File

@ -60,6 +60,7 @@ MOCHITEST_FILES = \
test_bug764125.html \
test_drawImage_edge_cases.html \
test_drawImage_document_domain.html \
test_mozDashOffset.html \
file_drawImage_document_domain.html \
$(NULL)

View File

@ -0,0 +1,39 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for mozDashOffset</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display">
<canvas id="c" width="100" height="100"><p class="fallback">FAIL (fallback content)</p></canvas>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script>
try {
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');
ctx.mozDash = [1, 1];
ctx.mozDashOffset = 1;
ctx.mozDashOffset = Infinity;
ok(ctx.mozDashOffset === 1, "ctx.mozDashOffset === 1");
ctx.mozDashOffset = 1;
ctx.mozDashOffset = -Infinity;
ok(ctx.mozDashOffset === 1, "ctx.mozDashOffset === 1");
ctx.mozDashOffset = 1;
ctx.mozDashOffset = NaN;
ok(ctx.mozDashOffset === 1, "ctx.mozDashOffset === 1");
} catch(e) {
ok(false, "unexpected exception thrown in: test_mozDashOffset.html");
}
</script>
</pre>
</body>
</html>