зеркало из https://github.com/mozilla/gecko-dev.git
Bug 827713 - Part 4: Tests for merged script elements. r=fredw
This commit is contained in:
Родитель
b933e0b355
Коммит
e5c50c21e1
|
@ -14,6 +14,8 @@ include $(DEPTH)/config/autoconf.mk
|
|||
MOCHITEST_FILES =\
|
||||
test_bug706406.html \
|
||||
test_bug553917.html \
|
||||
test_bug827713-2.html \
|
||||
test_bug827713.html \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -0,0 +1,153 @@
|
|||
<!DOCTYPE HTML>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=553917
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for error handling aspect of Bug 827713</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="application/javascript">
|
||||
SimpleTest.expectAssertions(22);
|
||||
|
||||
var stringBundleService =
|
||||
SpecialPowers.Cc["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(SpecialPowers.Ci.nsIStringBundleService);
|
||||
var g_bundl =
|
||||
stringBundleService.createBundle("chrome://global/locale/mathml/mathml.properties");
|
||||
|
||||
var g_errorInfo = {
|
||||
InvalidChild: {
|
||||
status : [false, false, false, false, false, false],
|
||||
args : [["mprescripts", "msubsup"], ["mprescripts", "msubsup"],
|
||||
["mprescripts", "msub"], ["none", "msub"], ["none","msup"],
|
||||
["none","msubsup"]]
|
||||
},
|
||||
|
||||
MMultiscriptsErrors: {
|
||||
status: [false, false],
|
||||
args: ["NoBase", "SubSupMismatch"]
|
||||
}
|
||||
};
|
||||
|
||||
var g_errorTypes = ["InvalidChild", "MMultiscriptsErrors"];
|
||||
|
||||
function getErrorMessage(name,idx)
|
||||
{
|
||||
if (name != "MMultiscriptsErrors") {
|
||||
return g_bundl.formatStringFromName(name,g_errorInfo[name].args[idx],
|
||||
g_errorInfo[name].args[idx].length);
|
||||
}
|
||||
else {
|
||||
return g_bundl.formatStringFromName(g_errorInfo[name].args[idx],[],0);
|
||||
}
|
||||
}
|
||||
|
||||
/** Checks the roll call to see if all expected error messages were present. */
|
||||
function processRollCall()
|
||||
{
|
||||
for (var i=0; i<g_errorTypes.length;i++) {
|
||||
for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
|
||||
ok(g_errorInfo[g_errorTypes[i]].status[j],
|
||||
"\"" + getErrorMessage(g_errorTypes[i], j)
|
||||
+ "\" was expected to be in the error console.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Tests a candidate to see if it is one of the expected messages and updates the
|
||||
g_errorInfo structure if it is. */
|
||||
function doRollCall(msg)
|
||||
{
|
||||
for (var i = 0; i < g_errorTypes.length; i++) {
|
||||
for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
|
||||
if (msg == getErrorMessage(g_errorTypes[i], j))
|
||||
{
|
||||
g_errorInfo[g_errorTypes[i]].status[j] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SpecialPowers.registerConsoleListener(
|
||||
function (msg) {
|
||||
if (msg.message == "SENTINEL") {
|
||||
processRollCall();
|
||||
SimpleTest.finish();
|
||||
} else if (msg.isScriptError) {
|
||||
doRollCall(msg.errorMessage);
|
||||
}
|
||||
});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</head>
|
||||
<body onload="SpecialPowers.postConsoleSentinel();">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=827713">Mozilla Bug 827713</a>
|
||||
|
||||
<!-- InvalidChild -->
|
||||
<math>
|
||||
<msubsup>
|
||||
<mprescripts/>
|
||||
</msubsup>
|
||||
</math>
|
||||
|
||||
<math>
|
||||
<msubsup>
|
||||
<mprescripts/>
|
||||
<mprescripts/>
|
||||
</msubsup>
|
||||
</math>
|
||||
|
||||
<math>
|
||||
<msub>
|
||||
<mtext>a</mtext>
|
||||
<mprescripts/>
|
||||
<mtext>a</mtext>
|
||||
<mprescripts/>
|
||||
</msub>
|
||||
</math>
|
||||
|
||||
<math>
|
||||
<msub>
|
||||
<mtext>a</mtext>
|
||||
<none/>
|
||||
</msub>
|
||||
</math>
|
||||
|
||||
<math>
|
||||
<msup>
|
||||
<mtext>a</mtext>
|
||||
<none/>
|
||||
</msup>
|
||||
</math>
|
||||
|
||||
<math>
|
||||
<msubsup>
|
||||
<mtext>a</mtext>
|
||||
<mtext>b</mtext>
|
||||
<none/>
|
||||
</msubsup>
|
||||
</math>
|
||||
|
||||
<!-- NoBase -->
|
||||
<math>
|
||||
<mmultiscripts>
|
||||
<none/>
|
||||
<mtext>b</mtext>
|
||||
<mtext>c</mtext>
|
||||
</mmultiscripts>
|
||||
</math>
|
||||
|
||||
<!-- SubSupMismatch -->
|
||||
<math>
|
||||
<mmultiscripts>
|
||||
<mtext>b</mtext>
|
||||
<mtext>c</mtext>
|
||||
<mprescripts/>
|
||||
<mtext>a</mtext>
|
||||
</mmultiscripts>
|
||||
</math>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,61 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=706406
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 706406</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=827713">Mozilla Bug 827713</a>
|
||||
<p id="display"></p>
|
||||
<p><math>
|
||||
<msub subscriptshift="50px">
|
||||
<mspace width="50px" height="25px" depth="25px" mathbackground="blue" id ="subbase"></mspace>
|
||||
<mspace width="50px" height="25px" depth="25px" mathbackground="red" id="subsub"></mspace>
|
||||
</msub>
|
||||
</math></p>
|
||||
|
||||
<p><math>
|
||||
<msup superscriptshift="50px">
|
||||
<mspace width="50px" height="25px" depth="25px" mathbackground="blue" id="supbase"></mspace>
|
||||
<mspace width="50px" height="25px" depth="25px" mathbackground="green" id="supsup"></mspace>
|
||||
</msup>
|
||||
</math></p>
|
||||
|
||||
<p><math>
|
||||
<msubsup subscriptshift="50px" superscriptshift="50px">
|
||||
<mspace width="50px" height="25px" depth="25px" mathbackground="blue" id="ssbase"></mspace>
|
||||
<mspace width="50px" height="25px" depth="25px" mathbackground="red" id="sssub"></mspace>
|
||||
<mspace width="50px" height="25px" depth="25px" mathbackground="green" id="sssup"></mspace>
|
||||
</msubsup>
|
||||
</math></p>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for the scriptshift aspect of bug 827713 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
subBaseRect = $("subbase").getBoundingClientRect();
|
||||
subSubRect = $("subsub").getBoundingClientRect();
|
||||
is(subBaseRect.bottom, subSubRect.top, "Bad subscript shift for msub");
|
||||
|
||||
supBaseRect = $("supbase").getBoundingClientRect();
|
||||
supSupRect = $("supsup").getBoundingClientRect();
|
||||
is(supBaseRect.top, supSupRect.bottom, "Bad superscript shift for msup");
|
||||
|
||||
ssBaseRect = $("ssbase").getBoundingClientRect();
|
||||
ssSubRect = $("sssub").getBoundingClientRect();
|
||||
ssSupRect = $("sssup").getBoundingClientRect();
|
||||
is(ssBaseRect.bottom, ssSubRect.top, "Bad subscript shift for msubusp");
|
||||
is(ssBaseRect.top, ssSupRect.bottom, "Bad superscript shift for msubusp");
|
||||
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,74 @@
|
|||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Comparison of script elements</title></head>
|
||||
<body>
|
||||
msubsup:
|
||||
<math>
|
||||
<mmultiscripts style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
<mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
|
||||
<mtext style="background-color: rgba(0, 255, 0, 0.4);">ccc</mtext>
|
||||
</mmultiscripts>
|
||||
</math>
|
||||
|
||||
<br><br>
|
||||
|
||||
msubsup:
|
||||
<math>
|
||||
<mmultiscripts style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
<mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
|
||||
<none/>
|
||||
</mmultiscripts>
|
||||
</math>
|
||||
|
||||
<br><br>
|
||||
|
||||
msup / msubsup:
|
||||
<math>
|
||||
<mmultiscripts style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
<none/>
|
||||
<mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
|
||||
</mmultiscripts>
|
||||
</math>
|
||||
|
||||
<math>
|
||||
<mmultiscripts style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
<none/>
|
||||
<mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
|
||||
</mmultiscripts>
|
||||
</math>
|
||||
|
||||
<br><br>
|
||||
|
||||
|
||||
mrow / msub:
|
||||
<math>
|
||||
<mrow style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
</mrow>
|
||||
</math>
|
||||
|
||||
<math>
|
||||
<mrow style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
</mrow>
|
||||
</math>
|
||||
|
||||
<br><br>
|
||||
|
||||
msup / msupsub:
|
||||
<math>
|
||||
<mmultiscripts style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
</mmultiscripts>
|
||||
</math>
|
||||
|
||||
<math>
|
||||
<mmultiscripts style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
</mmultiscripts>
|
||||
</math>
|
||||
|
||||
</body></html>
|
|
@ -0,0 +1,77 @@
|
|||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Comparison of script elements</title></head>
|
||||
<body>
|
||||
msubsup:
|
||||
<math>
|
||||
<msubsup style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
<mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
|
||||
<mtext style="background-color: rgba(0, 255, 0, 0.4);">ccc</mtext>
|
||||
</msubsup>
|
||||
</math>
|
||||
|
||||
<br><br>
|
||||
|
||||
<!-- Different rules apply to msub, so it won't provide equivalent output -->
|
||||
msubsup:
|
||||
<math>
|
||||
<msubsup style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
<mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
|
||||
<mrow></mrow>
|
||||
</msubsup>
|
||||
</math>
|
||||
|
||||
<br><br>
|
||||
|
||||
msup / msubsup:
|
||||
<math>
|
||||
<msup style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
<mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
|
||||
</msup>
|
||||
</math>
|
||||
|
||||
<math>
|
||||
<msubsup style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
<mrow></mrow>
|
||||
<mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
|
||||
</msubsup>
|
||||
</math>
|
||||
|
||||
<br><br>
|
||||
|
||||
mrow / msub:
|
||||
<math>
|
||||
<mrow style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
</mrow>
|
||||
</math>
|
||||
|
||||
<math>
|
||||
<msub style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
<mrow></mrow>
|
||||
</msub>
|
||||
</math>
|
||||
|
||||
<br><br>
|
||||
|
||||
msup / msupsub:
|
||||
<math>
|
||||
<msup style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
<mrow></mrow>
|
||||
</msup>
|
||||
</math>
|
||||
|
||||
<math>
|
||||
<msubsup style="background: red;">
|
||||
<mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
|
||||
<mrow></mrow>
|
||||
<mrow></mrow>
|
||||
</msubsup>
|
||||
</math>
|
||||
|
||||
</body></html>
|
|
@ -122,6 +122,7 @@ fails == whitespace-trim-4.html whitespace-trim-4-ref.html # Bug 787215
|
|||
== operator-1.xhtml operator-1-ref.xhtml
|
||||
== scriptshift-1.xhtml scriptshift-1-ref.xhtml
|
||||
== number-size-1.xhtml number-size-1-ref.xhtml
|
||||
== multiscripts-1.html multiscripts-1-ref.html
|
||||
== mathml-mmultiscript-base.html mathml-mmultiscript-base-ref.html
|
||||
== mathml-mmultiscript-mprescript.html mathml-mmultiscript-mprescript-ref.html
|
||||
!= menclose-1.html menclose-1-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче