layout/mathml/tests/test_bug553917.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/mathml/tests/test_bug553917.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,171 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<!--
     1.6 +https://bugzilla.mozilla.org/show_bug.cgi?id=553917
     1.7 +-->
     1.8 +<html>
     1.9 +  <head>
    1.10 +    <title>Test for Bug 553917</title>
    1.11 +    <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +    <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.13 +    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.14 +    <script type="application/javascript">
    1.15 +      var stringBundleService = 
    1.16 +        SpecialPowers.Cc["@mozilla.org/intl/stringbundle;1"]
    1.17 +                    .getService(SpecialPowers.Ci.nsIStringBundleService);
    1.18 +      var g_bundl =
    1.19 +        stringBundleService.createBundle("chrome://global/locale/mathml/mathml.properties");
    1.20 +      
    1.21 +      var g_errorInfo = {
    1.22 +      /*<math><mroot></mroot></math>
    1.23 +        <math><msub></msub></math>
    1.24 +        <math><msup></msup></math>
    1.25 +        <math><mfrac></mfrac></math>
    1.26 +        <math><msubsup></msubsup></math>
    1.27 +        <math><munderover></munderover></math>*/
    1.28 +        ChildCountIncorrect: {
    1.29 +            status : [false, false, false, false, false, false],
    1.30 +            args : [["mroot"], ["msub"], ["msup"], ["mfrac"], ["msubsup"], ["munderover"]] },
    1.31 +      /*<math fontfamily="serif"></math>
    1.32 +        <math color="#112233"></math>
    1.33 +        <math background="#FFFFFF"></math>
    1.34 +        <math fontsize="10"></math>
    1.35 +        <math xlink:href="http://www.mozilla.org"></math>*/
    1.36 +        DeprecatedSupersededBy: { 
    1.37 +          status: [false, false, false, false, false],
    1.38 +          args: [["fontfamily","mathvariant"],["color","mathcolor"], ["background","mathbackground"], 
    1.39 +                ["fontsize","mathsize"], ["xlink:href","href"]] },
    1.40 +      /*<math><mpadded width="BAD!"></mpadded></math>
    1.41 +        <math><mpadded height="BAD!"></mpadded></math>
    1.42 +        <math><mpadded voffset="BAD!"></mpadded></math>*/
    1.43 +        AttributeParsingError: { 
    1.44 +          status: [false, false, false],
    1.45 +          args: [["BAD!","width","mpadded"], ["BAD!","height","mpadded"], ["BAD!","voffset","mpadded"]]
    1.46 +        },
    1.47 +      /*<math scriptlevel="BAD!"></math>
    1.48 +        <math scriptsizemultiplier="BAD!"></math>*/
    1.49 +        AttributeParsingErrorNoTag: {
    1.50 +          status: [false, false],
    1.51 +          args: [["BAD!","scriptlevel"], ["BAD!","scriptsizemultiplier"]]
    1.52 +        },
    1.53 +      /* <math><mo rspace="2..0">+</mo></math>
    1.54 +        <math><mo minsize="1.5notaunit">+</mo></math>
    1.55 +        <math><mspace width="2"/></math>
    1.56 +        <math><mo lspace="BADlspace">+</mo></math>
    1.57 +        <math><mspace height="BADheight"/></math>
    1.58 +        <math><mspace depth="BADdepth"/></math>*/
    1.59 +        LengthParsingError : {
    1.60 +          status: [false, false, false, false, false, false],
    1.61 +          args: [["2..0"], ["1.5notaunit"], ["2"],["BADlspace"],["BADheight"],["BADdepth"]]
    1.62 +        },
    1.63 +      /*<math><mmultiscripts></mmultiscripts></math>
    1.64 +        <math><mmultiscripts><mprescripts/><mprescripts/></mmultiscripts></math>
    1.65 +        <math><mmultiscripts><mi>x</mi><mi>y</mi></mmultiscripts></math>*/
    1.66 +        MMultiscriptsErrors: {
    1.67 +          status: [false, false, false],
    1.68 +          args: ["NoBase","DuplicateMprescripts", "SubSupMismatch"]
    1.69 +        },
    1.70 +      /*<math><mo minsize="2">+</mo></math>*/
    1.71 +        UnitlessValuesAreDeprecated : {
    1.72 +          status : [false],
    1.73 +          args : [[]] }};
    1.74 +      
    1.75 +      var g_errorTypes = ["ChildCountIncorrect","DeprecatedSupersededBy","AttributeParsingError",
    1.76 +                          "AttributeParsingErrorNoTag","LengthParsingError", "MMultiscriptsErrors",
    1.77 +                          "UnitlessValuesAreDeprecated"];
    1.78 +      
    1.79 +      function getErrorMessage(name,idx)
    1.80 +      {
    1.81 +        if (name != "MMultiscriptsErrors") {
    1.82 +          var formatParams = g_errorInfo[name].args[idx];
    1.83 +          if (formatParams.length > 0) {
    1.84 +            return g_bundl.formatStringFromName(name,formatParams,formatParams.length);
    1.85 +          } else {
    1.86 +            return g_bundl.GetStringFromName(name);
    1.87 +          }
    1.88 +        } else {
    1.89 +          return g_bundl.GetStringFromName(g_errorInfo[name].args[idx]);
    1.90 +        }
    1.91 +      }
    1.92 +    
    1.93 +    /** Checks the roll call to see if all expected error messages were present. */
    1.94 +    function processRollCall()
    1.95 +    {
    1.96 +      for (var i=0; i<g_errorTypes.length;i++) {
    1.97 +        for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
    1.98 +          ok(g_errorInfo[g_errorTypes[i]].status[j],
    1.99 +             "\"" + getErrorMessage(g_errorTypes[i], j)
   1.100 +                  + "\" was expected to be in the error console.");
   1.101 +        }
   1.102 +      }
   1.103 +    }
   1.104 +    
   1.105 +    /** Tests a candidate to see if it is one of the expected messages and updates the 
   1.106 +        g_errorInfo structure if it is. */
   1.107 +    function doRollCall(msg)
   1.108 +    {
   1.109 +      for (var i = 0; i < g_errorTypes.length; i++) {
   1.110 +        for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
   1.111 +          if (msg == getErrorMessage(g_errorTypes[i], j))
   1.112 +          {
   1.113 +            g_errorInfo[g_errorTypes[i]].status[j] = true;
   1.114 +          }
   1.115 +        }
   1.116 +      }
   1.117 +    }
   1.118 +    
   1.119 +    SpecialPowers.registerConsoleListener(
   1.120 +      function (msg) {
   1.121 +        if (msg.message == "SENTINEL") {
   1.122 +          processRollCall();
   1.123 +          SimpleTest.finish();
   1.124 +        } else if (msg.isScriptError) {
   1.125 +          doRollCall(msg.errorMessage);
   1.126 +        }
   1.127 +      });
   1.128 +      
   1.129 +    SimpleTest.waitForExplicitFinish();
   1.130 +  </script>
   1.131 +  </head>
   1.132 +  <body onload="SpecialPowers.postConsoleSentinel();">
   1.133 +    <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=553917">Mozilla Bug 553917</a>
   1.134 +    <!-- ChildCountIncorrect -->
   1.135 +    <math><mroot></mroot></math>
   1.136 +    <math><msub></msub></math>
   1.137 +    <math><msup></msup></math>
   1.138 +    <math><mfrac></mfrac></math>
   1.139 +    <math><msubsup></msubsup></math>
   1.140 +    <math><munderover></munderover></math>
   1.141 +    
   1.142 +    <!-- DeprecatedSupersededBy -->
   1.143 +    <math fontfamily="serif"></math>
   1.144 +    <math color="#112233"></math>
   1.145 +    <math background="#FFFFFF"></math>
   1.146 +    <math fontsize="10"></math>
   1.147 +    <math xlink:href="http://www.mozilla.org"></math>
   1.148 +    
   1.149 +    <!-- AttributeParsingError -->
   1.150 +    <math><mpadded width="BAD!"></mpadded></math>
   1.151 +    <math><mpadded height="BAD!"></mpadded></math>
   1.152 +    <math><mpadded voffset="BAD!"></mpadded></math>
   1.153 +    
   1.154 +    <!-- AttributeParsingErrorNoTag -->
   1.155 +    <math scriptlevel="BAD!"></math>
   1.156 +    <math scriptsizemultiplier="BAD!"></math>
   1.157 +    
   1.158 +    <!-- LengthParsingError -->
   1.159 +    <math><mo rspace="2..0">+</mo></math>
   1.160 +    <math><mo minsize="1.5notaunit">+</mo></math>
   1.161 +    <math><mspace width="2"/></math>
   1.162 +    <math><mo lspace="BADlspace">+</mo></math>
   1.163 +    <math><mspace height="BADheight"/></math>
   1.164 +    <math><mspace depth="BADdepth"/></math>
   1.165 +    
   1.166 +    <!-- MMultiscriptsErrors -->
   1.167 +    <math><mmultiscripts></mmultiscripts></math>
   1.168 +    <math><mmultiscripts><mprescripts/><mprescripts/></mmultiscripts></math>
   1.169 +    <math><mmultiscripts><mi>x</mi><mi>y</mi></mmultiscripts></math>
   1.170 +    
   1.171 +    <!-- UnitlessValuesAreDeprecated -->
   1.172 +    <math><mo minsize="2">+</mo></math>
   1.173 +  </body>
   1.174 +</html>

mercurial