content/canvas/test/test_strokeText_throw.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/canvas/test/test_strokeText_throw.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=728629
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 728629</title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +  <script type="application/javascript">
    1.15 +
    1.16 +  /** Test for Bug 728629 **/
    1.17 +  SimpleTest.waitForExplicitFinish();
    1.18 +  function test() {
    1.19 +    var c = document.createElement('canvas');
    1.20 +    document.body.appendChild(c);
    1.21 +    try {
    1.22 +      c.getContext("2d").strokeText("Hello",NaN,50);
    1.23 +      ok(true, "strokeText should not throw with NaN.");
    1.24 +    } catch (e) {
    1.25 +      ok(false, "strokeText should not throw with NaN.");
    1.26 +    }
    1.27 +    try {
    1.28 +      c.getContext("2d").strokeText("Hello",Infinity,50);
    1.29 +      ok(true, "strokeText should not throw with Infinity.");
    1.30 +    } catch (e) {
    1.31 +      ok(false, "strokeText should not throw with Infinity.");
    1.32 +    }
    1.33 +    try {
    1.34 +      c.getContext("2d").strokeText("Hello",undefined,50);
    1.35 +      ok(true, "strokeText should not throw with undefined.");
    1.36 +    } catch (e) {
    1.37 +      ok(false, "strokeText should not throw with undefined.");
    1.38 +    }
    1.39 +    try {
    1.40 +      c.getContext("2d").fillText("Hello",NaN,50);
    1.41 +      ok(true, "fillText should not throw with NaN.");
    1.42 +    } catch (e) {
    1.43 +      ok(false, "fillText should not throw with NaN.");
    1.44 +    }
    1.45 +    try {
    1.46 +      c.getContext("2d").fillText("Hello",Infinity,50);
    1.47 +      ok(true, "fillText should not throw with Infinity.");
    1.48 +    } catch (e) {
    1.49 +      ok(false, "fillText should not throw with Infinity.");
    1.50 +    }
    1.51 +    try {
    1.52 +      c.getContext("2d").fillText("Hello",undefined,50);
    1.53 +      ok(true, "fillText should not throw with undefined.");
    1.54 +    } catch (e) {
    1.55 +      ok(false, "fillText should not throw with undefined.");
    1.56 +    }
    1.57 +    SimpleTest.finish();
    1.58 +  }
    1.59 +
    1.60 +  </script>
    1.61 +</head>
    1.62 +<body onload="test();">
    1.63 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=728629">Mozilla Bug 728629</a>
    1.64 +<p id="display"></p>
    1.65 +<div id="content" style="display: none">
    1.66 +
    1.67 +</div>
    1.68 +<pre id="test">
    1.69 +</pre>
    1.70 +</body>
    1.71 +</html>

mercurial