Bug 655926, Test even-odd fill rule. r=joe

This commit is contained in:
Chris Jones 2011-06-09 19:15:13 -07:00
parent 377e990c19
commit 38a6987ed3
8 changed files with 169 additions and 0 deletions

View File

@ -0,0 +1,16 @@
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var ctx = document.getElementById("c1").getContext("2d");
ctx.mozFillRule = "evenodd";
ctx.rect(50, 50, 200, 200);
ctx.rect(100, 100, 100, 100);
ctx.fill();
}
</script>
</head>
<body>
<div><canvas id="c1" width="300" height="300"></canvas></div>
</body>
</html>

View File

@ -0,0 +1,19 @@
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var ctx = document.getElementById("c1").getContext("2d");
ctx.mozFillRule = "evenodd";
ctx.rect(50, 50, 200, 200);
ctx.rect(100, 100, 100, 100);
ctx.clip();
ctx.beginPath();
ctx.fillRect(0, 0, 300, 300);
}
</script>
</head>
<body>
<div><canvas id="c1" width="300" height="300"></canvas></div>
</body>
</html>

View File

@ -0,0 +1,27 @@
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var ctx = document.getElementById("c1").getContext("2d");
ctx.mozFillRule = "evenodd";
ctx.moveTo(50, 50);
ctx.lineTo(250, 50);
ctx.lineTo(250, 250);
ctx.lineTo(50, 250);
ctx.lineTo(50, 50);
ctx.moveTo(100, 100);
ctx.lineTo(100, 200);
ctx.lineTo(200, 200);
ctx.lineTo(200, 100);
ctx.lineTo(100, 100);
ctx.fill();
}
</script>
</head>
<body>
<div><canvas id="c1" width="300" height="300"></canvas></div>
</body>
</html>

View File

@ -0,0 +1,17 @@
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var ctx = document.getElementById("c1").getContext("2d");
ctx.rect(50, 50, 200, 50);
ctx.rect(50, 50, 50, 200);
ctx.rect(250, 250, -200, -50);
ctx.rect(250, 250, -50, -200);
ctx.fill();
}
</script>
</head>
<body>
<div><canvas id="c1" width="300" height="300"></canvas></div>
</body>
</html>

View File

@ -0,0 +1,43 @@
<html>
<head>
<script type="text/javascript">
function assert(cond, msg) { if (!cond) { throw msg; } }
window.onload = function() {
try {
var ctx = document.getElementById("c1").getContext("2d");
assert("nonzero" == ctx.mozFillRule,
"Default fillRule is 'nonzero'");
ctx.mozFillRule = "evenodd";
assert("evenodd" == ctx.mozFillRule,
"fillRule understands 'evenodd'");
ctx.mozFillRule = "nonzero";
ctx.mozFillRule = "garbageLSKJDF 29879234";
assert("nonzero" == ctx.mozFillRule,
"Garbage fillRule string has no effect");
ctx.mozFillRule = "evenodd";
ctx.mozFillRule = "garbageLSKJDF 29879234";
assert("evenodd" == ctx.mozFillRule,
"Garbage fillRule string has no effect");
ctx.mozFillRule = "nonzero";
ctx.save();
ctx.mozFillRule = "evenodd";
ctx.restore();
assert("nonzero" == ctx.mozFillRule,
"fillRule was saved then restored");
} catch (e) {
document.body.innerHTML = "FAIL: "+ e.toString();
return;
}
document.body.innerHTML = "Pass";
}
</script>
</head>
<body>
<div><canvas id="c1" width="300" height="300"></canvas></div>
</body>
</html>

View File

@ -0,0 +1,15 @@
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var ctx = document.getElementById("c1").getContext("2d");
ctx.rect(50, 50, 200, 200);
ctx.rect(100, 100, 100, 100);
ctx.fill();
}
</script>
</head>
<body>
<div><canvas id="c1" width="300" height="300"></canvas></div>
</body>
</html>

View File

@ -0,0 +1,26 @@
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var ctx = document.getElementById("c1").getContext("2d");
ctx.moveTo(50, 50);
ctx.lineTo(250, 50);
ctx.lineTo(250, 250);
ctx.lineTo(50, 250);
ctx.lineTo(50, 50);
ctx.moveTo(100, 100);
ctx.lineTo(100, 200);
ctx.lineTo(200, 200);
ctx.lineTo(200, 100);
ctx.lineTo(100, 100);
ctx.fill();
}
</script>
</head>
<body>
<div><canvas id="c1" width="300" height="300"></canvas></div>
</body>
</html>

View File

@ -47,3 +47,9 @@ fails-if(Android) != text-font-lang.html text-font-lang-notref.html
fails-if(cocoaWidget) == linear-gradient-1b.html linear-gradient-1-ref.html fails-if(cocoaWidget) == linear-gradient-1b.html linear-gradient-1-ref.html
== zero-dimensions.html zero-dimensions-ref.html == zero-dimensions.html zero-dimensions-ref.html
== evenodd-fill-sanity.html data:text/html,<body>Pass
!= evenodd-fill-1.html nonzero-fill-1.html
== evenodd-fill-1.html evenodd-fill-ref.html
== evenodd-fill-2.html evenodd-fill-ref.html
== evenodd-fill-3.html nonzero-fill-2.html