layout/reftests/canvas/evenodd-fill-sanity.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 <html>
michael@0 2 <head>
michael@0 3 <script type="text/javascript">
michael@0 4 function assert(cond, msg) { if (!cond) { throw msg; } }
michael@0 5 window.onload = function() {
michael@0 6 try {
michael@0 7 var ctx = document.getElementById("c1").getContext("2d");
michael@0 8
michael@0 9 assert("nonzero" == ctx.mozFillRule,
michael@0 10 "Default fillRule is 'nonzero'");
michael@0 11
michael@0 12 ctx.mozFillRule = "evenodd";
michael@0 13 assert("evenodd" == ctx.mozFillRule,
michael@0 14 "fillRule understands 'evenodd'");
michael@0 15 ctx.mozFillRule = "nonzero";
michael@0 16
michael@0 17 ctx.mozFillRule = "garbageLSKJDF 29879234";
michael@0 18 assert("nonzero" == ctx.mozFillRule,
michael@0 19 "Garbage fillRule string has no effect");
michael@0 20
michael@0 21 ctx.mozFillRule = "evenodd";
michael@0 22 ctx.mozFillRule = "garbageLSKJDF 29879234";
michael@0 23 assert("evenodd" == ctx.mozFillRule,
michael@0 24 "Garbage fillRule string has no effect");
michael@0 25 ctx.mozFillRule = "nonzero";
michael@0 26
michael@0 27 ctx.save();
michael@0 28 ctx.mozFillRule = "evenodd";
michael@0 29 ctx.restore();
michael@0 30 assert("nonzero" == ctx.mozFillRule,
michael@0 31 "fillRule was saved then restored");
michael@0 32 } catch (e) {
michael@0 33 document.body.innerHTML = "FAIL: "+ e.toString();
michael@0 34 return;
michael@0 35 }
michael@0 36 document.body.innerHTML = "Pass";
michael@0 37 }
michael@0 38 </script>
michael@0 39 </head>
michael@0 40 <body>
michael@0 41 <div><canvas id="c1" width="300" height="300"></canvas></div>
michael@0 42 </body>
michael@0 43 </html>

mercurial