layout/mathml/tests/test_bug553917.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <!--
michael@0 3 https://bugzilla.mozilla.org/show_bug.cgi?id=553917
michael@0 4 -->
michael@0 5 <html>
michael@0 6 <head>
michael@0 7 <title>Test for Bug 553917</title>
michael@0 8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 11 <script type="application/javascript">
michael@0 12 var stringBundleService =
michael@0 13 SpecialPowers.Cc["@mozilla.org/intl/stringbundle;1"]
michael@0 14 .getService(SpecialPowers.Ci.nsIStringBundleService);
michael@0 15 var g_bundl =
michael@0 16 stringBundleService.createBundle("chrome://global/locale/mathml/mathml.properties");
michael@0 17
michael@0 18 var g_errorInfo = {
michael@0 19 /*<math><mroot></mroot></math>
michael@0 20 <math><msub></msub></math>
michael@0 21 <math><msup></msup></math>
michael@0 22 <math><mfrac></mfrac></math>
michael@0 23 <math><msubsup></msubsup></math>
michael@0 24 <math><munderover></munderover></math>*/
michael@0 25 ChildCountIncorrect: {
michael@0 26 status : [false, false, false, false, false, false],
michael@0 27 args : [["mroot"], ["msub"], ["msup"], ["mfrac"], ["msubsup"], ["munderover"]] },
michael@0 28 /*<math fontfamily="serif"></math>
michael@0 29 <math color="#112233"></math>
michael@0 30 <math background="#FFFFFF"></math>
michael@0 31 <math fontsize="10"></math>
michael@0 32 <math xlink:href="http://www.mozilla.org"></math>*/
michael@0 33 DeprecatedSupersededBy: {
michael@0 34 status: [false, false, false, false, false],
michael@0 35 args: [["fontfamily","mathvariant"],["color","mathcolor"], ["background","mathbackground"],
michael@0 36 ["fontsize","mathsize"], ["xlink:href","href"]] },
michael@0 37 /*<math><mpadded width="BAD!"></mpadded></math>
michael@0 38 <math><mpadded height="BAD!"></mpadded></math>
michael@0 39 <math><mpadded voffset="BAD!"></mpadded></math>*/
michael@0 40 AttributeParsingError: {
michael@0 41 status: [false, false, false],
michael@0 42 args: [["BAD!","width","mpadded"], ["BAD!","height","mpadded"], ["BAD!","voffset","mpadded"]]
michael@0 43 },
michael@0 44 /*<math scriptlevel="BAD!"></math>
michael@0 45 <math scriptsizemultiplier="BAD!"></math>*/
michael@0 46 AttributeParsingErrorNoTag: {
michael@0 47 status: [false, false],
michael@0 48 args: [["BAD!","scriptlevel"], ["BAD!","scriptsizemultiplier"]]
michael@0 49 },
michael@0 50 /* <math><mo rspace="2..0">+</mo></math>
michael@0 51 <math><mo minsize="1.5notaunit">+</mo></math>
michael@0 52 <math><mspace width="2"/></math>
michael@0 53 <math><mo lspace="BADlspace">+</mo></math>
michael@0 54 <math><mspace height="BADheight"/></math>
michael@0 55 <math><mspace depth="BADdepth"/></math>*/
michael@0 56 LengthParsingError : {
michael@0 57 status: [false, false, false, false, false, false],
michael@0 58 args: [["2..0"], ["1.5notaunit"], ["2"],["BADlspace"],["BADheight"],["BADdepth"]]
michael@0 59 },
michael@0 60 /*<math><mmultiscripts></mmultiscripts></math>
michael@0 61 <math><mmultiscripts><mprescripts/><mprescripts/></mmultiscripts></math>
michael@0 62 <math><mmultiscripts><mi>x</mi><mi>y</mi></mmultiscripts></math>*/
michael@0 63 MMultiscriptsErrors: {
michael@0 64 status: [false, false, false],
michael@0 65 args: ["NoBase","DuplicateMprescripts", "SubSupMismatch"]
michael@0 66 },
michael@0 67 /*<math><mo minsize="2">+</mo></math>*/
michael@0 68 UnitlessValuesAreDeprecated : {
michael@0 69 status : [false],
michael@0 70 args : [[]] }};
michael@0 71
michael@0 72 var g_errorTypes = ["ChildCountIncorrect","DeprecatedSupersededBy","AttributeParsingError",
michael@0 73 "AttributeParsingErrorNoTag","LengthParsingError", "MMultiscriptsErrors",
michael@0 74 "UnitlessValuesAreDeprecated"];
michael@0 75
michael@0 76 function getErrorMessage(name,idx)
michael@0 77 {
michael@0 78 if (name != "MMultiscriptsErrors") {
michael@0 79 var formatParams = g_errorInfo[name].args[idx];
michael@0 80 if (formatParams.length > 0) {
michael@0 81 return g_bundl.formatStringFromName(name,formatParams,formatParams.length);
michael@0 82 } else {
michael@0 83 return g_bundl.GetStringFromName(name);
michael@0 84 }
michael@0 85 } else {
michael@0 86 return g_bundl.GetStringFromName(g_errorInfo[name].args[idx]);
michael@0 87 }
michael@0 88 }
michael@0 89
michael@0 90 /** Checks the roll call to see if all expected error messages were present. */
michael@0 91 function processRollCall()
michael@0 92 {
michael@0 93 for (var i=0; i<g_errorTypes.length;i++) {
michael@0 94 for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
michael@0 95 ok(g_errorInfo[g_errorTypes[i]].status[j],
michael@0 96 "\"" + getErrorMessage(g_errorTypes[i], j)
michael@0 97 + "\" was expected to be in the error console.");
michael@0 98 }
michael@0 99 }
michael@0 100 }
michael@0 101
michael@0 102 /** Tests a candidate to see if it is one of the expected messages and updates the
michael@0 103 g_errorInfo structure if it is. */
michael@0 104 function doRollCall(msg)
michael@0 105 {
michael@0 106 for (var i = 0; i < g_errorTypes.length; i++) {
michael@0 107 for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
michael@0 108 if (msg == getErrorMessage(g_errorTypes[i], j))
michael@0 109 {
michael@0 110 g_errorInfo[g_errorTypes[i]].status[j] = true;
michael@0 111 }
michael@0 112 }
michael@0 113 }
michael@0 114 }
michael@0 115
michael@0 116 SpecialPowers.registerConsoleListener(
michael@0 117 function (msg) {
michael@0 118 if (msg.message == "SENTINEL") {
michael@0 119 processRollCall();
michael@0 120 SimpleTest.finish();
michael@0 121 } else if (msg.isScriptError) {
michael@0 122 doRollCall(msg.errorMessage);
michael@0 123 }
michael@0 124 });
michael@0 125
michael@0 126 SimpleTest.waitForExplicitFinish();
michael@0 127 </script>
michael@0 128 </head>
michael@0 129 <body onload="SpecialPowers.postConsoleSentinel();">
michael@0 130 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=553917">Mozilla Bug 553917</a>
michael@0 131 <!-- ChildCountIncorrect -->
michael@0 132 <math><mroot></mroot></math>
michael@0 133 <math><msub></msub></math>
michael@0 134 <math><msup></msup></math>
michael@0 135 <math><mfrac></mfrac></math>
michael@0 136 <math><msubsup></msubsup></math>
michael@0 137 <math><munderover></munderover></math>
michael@0 138
michael@0 139 <!-- DeprecatedSupersededBy -->
michael@0 140 <math fontfamily="serif"></math>
michael@0 141 <math color="#112233"></math>
michael@0 142 <math background="#FFFFFF"></math>
michael@0 143 <math fontsize="10"></math>
michael@0 144 <math xlink:href="http://www.mozilla.org"></math>
michael@0 145
michael@0 146 <!-- AttributeParsingError -->
michael@0 147 <math><mpadded width="BAD!"></mpadded></math>
michael@0 148 <math><mpadded height="BAD!"></mpadded></math>
michael@0 149 <math><mpadded voffset="BAD!"></mpadded></math>
michael@0 150
michael@0 151 <!-- AttributeParsingErrorNoTag -->
michael@0 152 <math scriptlevel="BAD!"></math>
michael@0 153 <math scriptsizemultiplier="BAD!"></math>
michael@0 154
michael@0 155 <!-- LengthParsingError -->
michael@0 156 <math><mo rspace="2..0">+</mo></math>
michael@0 157 <math><mo minsize="1.5notaunit">+</mo></math>
michael@0 158 <math><mspace width="2"/></math>
michael@0 159 <math><mo lspace="BADlspace">+</mo></math>
michael@0 160 <math><mspace height="BADheight"/></math>
michael@0 161 <math><mspace depth="BADdepth"/></math>
michael@0 162
michael@0 163 <!-- MMultiscriptsErrors -->
michael@0 164 <math><mmultiscripts></mmultiscripts></math>
michael@0 165 <math><mmultiscripts><mprescripts/><mprescripts/></mmultiscripts></math>
michael@0 166 <math><mmultiscripts><mi>x</mi><mi>y</mi></mmultiscripts></math>
michael@0 167
michael@0 168 <!-- UnitlessValuesAreDeprecated -->
michael@0 169 <math><mo minsize="2">+</mo></math>
michael@0 170 </body>
michael@0 171 </html>

mercurial