diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /layout/mathml/tests | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/mathml/tests')
19 files changed, 1958 insertions, 0 deletions
diff --git a/layout/mathml/tests/chrome.ini b/layout/mathml/tests/chrome.ini new file mode 100644 index 000000000..0885f4c6b --- /dev/null +++ b/layout/mathml/tests/chrome.ini @@ -0,0 +1,6 @@ +[DEFAULT] + +support-files = + mathml_example_test.html + +[test_disabled_chrome.html] diff --git a/layout/mathml/tests/mathml_example_test.html b/layout/mathml/tests/mathml_example_test.html new file mode 100644 index 000000000..6eee75d01 --- /dev/null +++ b/layout/mathml/tests/mathml_example_test.html @@ -0,0 +1,28 @@ +<math xmlns="http://www.w3.org/1998/Math/MathML"> + <mstyle scriptsizemultiplier="2"> + <msub> + <mtext>O</mtext> + <mtext>O</mtext> + </msub> + <msup> + <mtext>O</mtext> + <mtext>O</mtext> + </msup> + <msubsup> + <mtext>O</mtext> + <mtext>O</mtext> + <mtext>O</mtext> + </msubsup> + <mmultiscripts> + <mtext>O</mtext> + <mtext>O</mtext> + <mtext>O</mtext> + <mprescripts/> + <mtext>O</mtext> + <mtext>O</mtext> + </mmultiscripts> + </mstyle> +</math> + +<svg id="svgel"> +</svg> diff --git a/layout/mathml/tests/mochitest.ini b/layout/mathml/tests/mochitest.ini new file mode 100644 index 000000000..6a6651509 --- /dev/null +++ b/layout/mathml/tests/mochitest.ini @@ -0,0 +1,17 @@ +[DEFAULT] + +[test_bug330964.html] +[test_bug553917.html] +[test_bug706406.html] +[test_bug827713-2.html] +[test_bug827713.html] +[test_bug975681.html] +[test_disabled.html] +[test_opentype-axis-height.html] +[test_opentype-fraction.html] +[test_opentype-limits.html] +skip-if = os == "win" # Fails on WinXP +[test_opentype-radical.html] +skip-if = os == "win" # Fails on WinXP +[test_opentype-scripts.html] +[test_opentype-stack.html] diff --git a/layout/mathml/tests/stretchy-and-large-operators.html b/layout/mathml/tests/stretchy-and-large-operators.html new file mode 100644 index 000000000..13fe14aa7 --- /dev/null +++ b/layout/mathml/tests/stretchy-and-large-operators.html @@ -0,0 +1,88 @@ +<!-- -*- mode: HTML; tab-width: 2; indent-tabs-mode: nil; -*- --> +<!-- vim: set tabstop=2 expandtab shiftwidth=2 textwidth=80: --> +<!DOCTYPE html> +<html> + <head> + <title>Test Stretchy and Large Operators</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + <script type="text/javascript" + src="stretchy-and-large-operators.js"></script> + <script type="text/javascript"> + + var mathml = "http://www.w3.org/1998/Math/MathML"; + + function createMo(aOperator, aForm) + { + var mo = document.createElementNS(mathml, "mo"); + mo.appendChild(document.createTextNode(aOperator)); + mo.setAttribute("form", aForm); + return mo; + } + + function createTest(aEntry) + { + var opname = aEntry[0]; + var operator = aEntry[1]; + var type = aEntry[2]; + var form = aEntry[3]; + + var div = document.createElement("div"); + div.appendChild(document.createTextNode(opname)); + + var math = document.createElementNS(mathml, "math"); + + switch (type) + { + case "l": // largeop + math.appendChild(createMo(operator, form)); + var mstyle = document.createElementNS(mathml, "mstyle"); + mstyle.setAttribute("displaystyle", "true"); + mstyle.appendChild(createMo(operator, form)); + math.appendChild(mstyle); + break; + + case "v": // vertical + for (var i = 1; i < 10; i+=2) { + var mo = createMo(operator, form); + mo.setAttribute("minsize", (.5 * i) + "em"); + math.appendChild(mo); + } + break; + + case "h": // horizontal + for (var i = 1; i < 10; i+=2) { + var mo = createMo(operator, form); + var mspace = document.createElementNS(mathml, "mspace"); + mspace.setAttribute("width", (.5 * i) + "em"); + var mover = document.createElementNS(mathml, "mover"); + mover.setAttribute("accent", "false"); + mover.appendChild(mspace); + mover.appendChild(mo); + math.appendChild(mover); + } + break; + + default: + break; + } + + div.appendChild(math); + document.body.appendChild(div); + } + + function init() + { + for (var i in stretchy_and_large_operators) { + createTest(stretchy_and_large_operators[i]); + } + } + </script> + </head> + + <body onload="init()"> + + </body> +</html> diff --git a/layout/mathml/tests/stretchy-and-large-operators.js b/layout/mathml/tests/stretchy-and-large-operators.js new file mode 100644 index 000000000..775e02840 --- /dev/null +++ b/layout/mathml/tests/stretchy-and-large-operators.js @@ -0,0 +1,2 @@ +// This file is automatically generated. Do not edit. +var stretchy_and_large_operators = [['\\u2194.infix: ', '\u2194','h','infix'],['\\u222E.prefix: ', '\u222E','l','prefix'],['\\u2A11.prefix: ', '\u2A11','l','prefix'],['\\u007E.infix: ', '\u007E','h','infix'],['\\u27F8.infix: ', '\u27F8','h','infix'],['\\u02CD.postfix: ', '\u02CD','h','postfix'],['\\u0028.prefix: ', '\u0028','v','prefix'],['\\u220F.prefix: ', '\u220F','l','prefix'],['\\u2225.postfix: ', '\u2225','v','postfix'],['\\u2A13.prefix: ', '\u2A13','l','prefix'],['\\u007C\u007C.infix: ', '\u007C\u007C','v','infix'],['\\u203E.postfix: ', '\u203E','h','postfix'],['\\u27EE.prefix: ', '\u27EE','v','prefix'],['\\u007C.prefix: ', '\u007C','v','prefix'],['\\u2A00.prefix: ', '\u2A00','l','prefix'],['\\u295A.infix: ', '\u295A','h','infix'],['\\u02C6.postfix: ', '\u02C6','h','postfix'],['\\u21E2.infix: ', '\u21E2','h','infix'],['\\u2961.infix: ', '\u2961','v','infix'],['\\u2998.postfix: ', '\u2998','v','postfix'],['\\u2197.infix: ', '\u2197','v','infix'],['\\u21BE.infix: ', '\u21BE','v','infix'],['\\u21A7.infix: ', '\u21A7','v','infix'],['\\u21C7.infix: ', '\u21C7','h','infix'],['\\u2A0D.prefix: ', '\u2A0D','l','prefix'],['\\u23E1.postfix: ', '\u23E1','h','postfix'],['\\u2A18.prefix: ', '\u2A18','l','prefix'],['\\u21A9.infix: ', '\u21A9','h','infix'],['\\u21F0.infix: ', '\u21F0','h','infix'],['\\u2016.prefix: ', '\u2016','v','prefix'],['\\u007D.postfix: ', '\u007D','v','postfix'],['\\u294E.infix: ', '\u294E','h','infix'],['\\u2A02.prefix: ', '\u2A02','l','prefix'],['\\u21D5.infix: ', '\u21D5','v','infix'],['\\u219E.infix: ', '\u219E','h','infix'],['\\u21EE.infix: ', '\u21EE','v','infix'],['\\u22C3.prefix: ', '\u22C3','l','prefix'],['\\u21C9.infix: ', '\u21C9','h','infix'],['\\u21A6.infix: ', '\u21A6','h','infix'],['\\u2044.infix: ', '\u2044','v','infix'],['\\u27F9.infix: ', '\u27F9','h','infix'],['\\u21A1.infix: ', '\u21A1','v','infix'],['\\u2953.infix: ', '\u2953','h','infix'],['\\u2195.infix: ', '\u2195','v','infix'],['\\u21E0.infix: ', '\u21E0','h','infix'],['\\u21E4.infix: ', '\u21E4','h','infix'],['\\u2987.prefix: ', '\u2987','v','prefix'],['\\u2A15.prefix: ', '\u2A15','l','prefix'],['\\u21FE.infix: ', '\u21FE','h','infix'],['\\u2225.prefix: ', '\u2225','v','prefix'],['\\u2233.prefix: ', '\u2233','l','prefix'],['\\u2772.prefix: ', '\u2772','v','prefix'],['\\u27FA.infix: ', '\u27FA','h','infix'],['\\u2230.prefix: ', '\u2230','l','prefix'],['\\u2960.infix: ', '\u2960','v','infix'],['\\u21AF.infix: ', '\u21AF','v','infix'],['\\u20E1.postfix: ', '\u20E1','h','postfix'],['\\u007C\u007C\u007C.postfix: ', '\u007C\u007C\u007C','v','postfix'],['\\u27FB.infix: ', '\u27FB','h','infix'],['\\u295C.infix: ', '\u295C','v','infix'],['\\u007C.postfix: ', '\u007C','v','postfix'],['\\u21D1.infix: ', '\u21D1','v','infix'],['\\u27F7.infix: ', '\u27F7','h','infix'],['\\u21B1.infix: ', '\u21B1','v','infix'],['\\u21EC.infix: ', '\u21EC','v','infix'],['\\u21CC.infix: ', '\u21CC','h','infix'],['\\u27E8.prefix: ', '\u27E8','v','prefix'],['\\u2990.postfix: ', '\u2990','v','postfix'],['\\u21B4.infix: ', '\u21B4','h','infix'],['\\u22C0.prefix: ', '\u22C0','l','prefix'],['\\u2951.infix: ', '\u2951','v','infix'],['\\u2AFF.prefix: ', '\u2AFF','l','prefix'],['\\u21B5.infix: ', '\u21B5','v','infix'],['\\u2215.infix: ', '\u2215','v','infix'],['\\u2988.postfix: ', '\u2988','v','postfix'],['\\u290D.infix: ', '\u290D','h','infix'],['\\u21C1.infix: ', '\u21C1','h','infix'],['\\u290B.infix: ', '\u290B','v','infix'],['\\u2A16.prefix: ', '\u2A16','l','prefix'],['\\u295E.infix: ', '\u295E','h','infix'],['\\u2950.infix: ', '\u2950','h','infix'],['\\u27EB.postfix: ', '\u27EB','v','postfix'],['\\u29FC.prefix: ', '\u29FC','v','prefix'],['\\u21A4.infix: ', '\u21A4','h','infix'],['\\u295D.infix: ', '\u295D','v','infix'],['\\u2A10.prefix: ', '\u2A10','l','prefix'],['\\u2199.infix: ', '\u2199','h','infix'],['\\u222C.prefix: ', '\u222C','l','prefix'],['\\u2959.infix: ', '\u2959','v','infix'],['\\u21EB.infix: ', '\u21EB','v','infix'],['\\u290C.infix: ', '\u290C','h','infix'],['\\u21E9.infix: ', '\u21E9','v','infix'],['\\u2A1A.prefix: ', '\u2A1A','l','prefix'],['\\u2913.infix: ', '\u2913','v','infix'],['\\u2910.infix: ', '\u2910','h','infix'],['\\uFE36.postfix: ', '\uFE36','h','postfix'],['\\u21B0.infix: ', '\u21B0','v','infix'],['\\u296E.infix: ', '\u296E','v','infix'],['\\u2500.infix: ', '\u2500','h','infix'],['\\u2308.prefix: ', '\u2308','v','prefix'],['\\u21A8.infix: ', '\u21A8','v','infix'],['\\u21C6.infix: ', '\u21C6','h','infix'],['\\u21DD.infix: ', '\u21DD','h','infix'],['\\u221A.prefix: ', '\u221A','v','prefix'],['\\u2994.postfix: ', '\u2994','v','postfix'],['\\u2296.prefix: ', '\u2296','l','prefix'],['\\u2985.prefix: ', '\u2985','v','prefix'],['\\u21F6.infix: ', '\u21F6','h','infix'],['\\u298B.prefix: ', '\u298B','v','prefix'],['\\u02C7.postfix: ', '\u02C7','h','postfix'],['\\u2223.prefix: ', '\u2223','v','prefix'],['\\u007C.infix: ', '\u007C','v','infix'],['\\u2A07.prefix: ', '\u2A07','l','prefix'],['\\u2A06.prefix: ', '\u2A06','l','prefix'],['\\u20D6.postfix: ', '\u20D6','h','postfix'],['\\u2A12.prefix: ', '\u2A12','l','prefix'],['\\u2223.postfix: ', '\u2223','v','postfix'],['\\u2958.infix: ', '\u2958','v','infix'],['\\u23DC.postfix: ', '\u23DC','h','postfix'],['\\u2986.postfix: ', '\u2986','v','postfix'],['\\u2B46.infix: ', '\u2B46','h','infix'],['\\u21FD.infix: ', '\u21FD','h','infix'],['\\u007C\u007C\u007C.prefix: ', '\u007C\u007C\u007C','v','prefix'],['\\u21D2.infix: ', '\u21D2','h','infix'],['\\u298C.postfix: ', '\u298C','v','postfix'],['\\u2912.infix: ', '\u2912','v','infix'],['\\u21EA.infix: ', '\u21EA','v','infix'],['\\u21BC.infix: ', '\u21BC','h','infix'],['\\u005B.prefix: ', '\u005B','v','prefix'],['\\u22C2.prefix: ', '\u22C2','l','prefix'],['\\u296F.infix: ', '\u296F','v','infix'],['\\u2B45.infix: ', '\u2B45','h','infix'],['\\u02F7.postfix: ', '\u02F7','h','postfix'],['\\u0332.postfix: ', '\u0332','h','postfix'],['\\u27FE.infix: ', '\u27FE','h','infix'],['\\u0029.postfix: ', '\u0029','v','postfix'],['\\u21C0.infix: ', '\u21C0','h','infix'],['\\u2A0F.prefix: ', '\u2A0F','l','prefix'],['\\u27E7.postfix: ', '\u27E7','v','postfix'],['\\u27ED.postfix: ', '\u27ED','v','postfix'],['\\u27E6.prefix: ', '\u27E6','v','prefix'],['\\u2995.prefix: ', '\u2995','v','prefix'],['\\u219F.infix: ', '\u219F','v','infix'],['\\u21AC.infix: ', '\u21AC','h','infix'],['\\u21A2.infix: ', '\u21A2','h','infix'],['\\u007B.prefix: ', '\u007B','v','prefix'],['\\u222D.prefix: ', '\u222D','l','prefix'],['\\u2A04.prefix: ', '\u2A04','l','prefix'],['\\u2A0C.prefix: ', '\u2A0C','l','prefix'],['\\u27FF.infix: ', '\u27FF','h','infix'],['\\uFE37.postfix: ', '\uFE37','h','postfix'],['\\u007C\u007C.prefix: ', '\u007C\u007C','v','prefix'],['\\u2A14.prefix: ', '\u2A14','l','prefix'],['\\u23DD.postfix: ', '\u23DD','h','postfix'],['\\u29FD.postfix: ', '\u29FD','v','postfix'],['\\u20D7.postfix: ', '\u20D7','h','postfix'],['\\u222F.prefix: ', '\u222F','l','prefix'],['\\u230A.prefix: ', '\u230A','v','prefix'],['\\u27FD.infix: ', '\u27FD','h','infix'],['\\u2AFC.prefix: ', '\u2AFC','l','prefix'],['\\u21E6.infix: ', '\u21E6','h','infix'],['\\u2210.prefix: ', '\u2210','l','prefix'],['\\u298E.postfix: ', '\u298E','v','postfix'],['\\u21E8.infix: ', '\u21E8','h','infix'],['\\u2A0B.prefix: ', '\u2A0B','l','prefix'],['\\u21D0.infix: ', '\u21D0','h','infix'],['\\u27EC.prefix: ', '\u27EC','v','prefix'],['\\u2996.postfix: ', '\u2996','v','postfix'],['\\u2A1C.prefix: ', '\u2A1C','l','prefix'],['\\uFE38.postfix: ', '\uFE38','h','postfix'],['\\u2A0E.prefix: ', '\u2A0E','l','prefix'],['\\u23DF.postfix: ', '\u23DF','h','postfix'],['\\u290F.infix: ', '\u290F','h','infix'],['\\u2954.infix: ', '\u2954','v','infix'],['\\u21DA.infix: ', '\u21DA','h','infix'],['\\u298A.postfix: ', '\u298A','v','postfix'],['\\u2232.prefix: ', '\u2232','l','prefix'],['\\u298D.prefix: ', '\u298D','v','prefix'],['\\u21F3.infix: ', '\u21F3','v','infix'],['\\u2980.postfix: ', '\u2980','v','postfix'],['\\u21B3.infix: ', '\u21B3','v','infix'],['\\u02DC.postfix: ', '\u02DC','h','postfix'],['\\u230B.postfix: ', '\u230B','v','postfix'],['\\u2A19.prefix: ', '\u2A19','l','prefix'],['\\u007C\u007C.postfix: ', '\u007C\u007C','v','postfix'],['\\u21CA.infix: ', '\u21CA','v','infix'],['\\u2231.prefix: ', '\u2231','l','prefix'],['\\u2A01.prefix: ', '\u2A01','l','prefix'],['\\u21E3.infix: ', '\u21E3','v','infix'],['\\u2192.infix: ', '\u2192','h','infix'],['\\u23E0.postfix: ', '\u23E0','h','postfix'],['\\u21A3.infix: ', '\u21A3','h','infix'],['\\u21D4.infix: ', '\u21D4','h','infix'],['\\u2957.infix: ', '\u2957','h','infix'],['\\u298F.prefix: ', '\u298F','v','prefix'],['\\u290A.infix: ', '\u290A','v','infix'],['\\u2989.prefix: ', '\u2989','v','prefix'],['\\u2297.prefix: ', '\u2297','l','prefix'],['\\u27EF.postfix: ', '\u27EF','v','postfix'],['\\u2991.prefix: ', '\u2991','v','prefix'],['\\u21B9.infix: ', '\u21B9','h','infix'],['\\u2295.prefix: ', '\u2295','l','prefix'],['\\u007E.postfix: ', '\u007E','h','postfix'],['\\u02C9.postfix: ', '\u02C9','h','postfix'],['\\u21C4.infix: ', '\u21C4','h','infix'],['\\u21BD.infix: ', '\u21BD','h','infix'],['\\u21D3.infix: ', '\u21D3','v','infix'],['\\u005F.infix: ', '\u005F','h','infix'],['\\u2A08.prefix: ', '\u2A08','l','prefix'],['\\u20D1.postfix: ', '\u20D1','h','postfix'],['\\u2196.infix: ', '\u2196','v','infix'],['\\u27E9.postfix: ', '\u27E9','v','postfix'],['\\u27F5.infix: ', '\u27F5','h','infix'],['\\u2980.prefix: ', '\u2980','v','prefix'],['\\u21B2.infix: ', '\u21B2','v','infix'],['\\u294F.infix: ', '\u294F','v','infix'],['\\u21C5.infix: ', '\u21C5','v','infix'],['\\u21DC.infix: ', '\u21DC','h','infix'],['\\u21E7.infix: ', '\u21E7','v','infix'],['\\u21ED.infix: ', '\u21ED','v','infix'],['\\u21C2.infix: ', '\u21C2','v','infix'],['\\u21E5.infix: ', '\u21E5','h','infix'],['\\u23B1.postfix: ', '\u23B1','v','postfix'],['\\u21C8.infix: ', '\u21C8','v','infix'],['\\u27FC.infix: ', '\u27FC','h','infix'],['\\u290E.infix: ', '\u290E','h','infix'],['\\u2955.infix: ', '\u2955','v','infix'],['\\u295B.infix: ', '\u295B','h','infix'],['\\u23DE.postfix: ', '\u23DE','h','postfix'],['\\u2997.prefix: ', '\u2997','v','prefix'],['\\u2983.prefix: ', '\u2983','v','prefix'],['\\u2309.postfix: ', '\u2309','v','postfix'],['\\u2A17.prefix: ', '\u2A17','l','prefix'],['\\u23B4.postfix: ', '\u23B4','h','postfix'],['\\u22C1.prefix: ', '\u22C1','l','prefix'],['\\u2190.infix: ', '\u2190','h','infix'],['\\u21F5.infix: ', '\u21F5','v','infix'],['\\u21BF.infix: ', '\u21BF','v','infix'],['\\u27F0.infix: ', '\u27F0','v','infix'],['\\uFE35.postfix: ', '\uFE35','h','postfix'],['\\u21A0.infix: ', '\u21A0','h','infix'],['\\u2211.prefix: ', '\u2211','l','prefix'],['\\u219D.infix: ', '\u219D','h','infix'],['\\u23B5.postfix: ', '\u23B5','h','postfix'],['\\u27F6.infix: ', '\u27F6','h','infix'],['\\u2299.prefix: ', '\u2299','l','prefix'],['\\u219C.infix: ', '\u219C','h','infix'],['\\u00AF.postfix: ', '\u00AF','h','postfix'],['\\u21EF.infix: ', '\u21EF','v','infix'],['\\u2191.infix: ', '\u2191','v','infix'],['\\u2A09.prefix: ', '\u2A09','l','prefix'],['\\u2A0A.prefix: ', '\u2A0A','l','prefix'],['\\u005F.postfix: ', '\u005F','h','postfix'],['\\u23B0.prefix: ', '\u23B0','v','prefix'],['\\u21C3.infix: ', '\u21C3','v','infix'],['\\u21A5.infix: ', '\u21A5','v','infix'],['\\u27EA.prefix: ', '\u27EA','v','prefix'],['\\u2773.postfix: ', '\u2773','v','postfix'],['\\u2016.infix: ', '\u2016','v','infix'],['\\u21CB.infix: ', '\u21CB','h','infix'],['\\u228E.prefix: ', '\u228E','l','prefix'],['\\u27F1.infix: ', '\u27F1','v','infix'],['\\u005E.postfix: ', '\u005E','h','postfix'],['\\u0302.postfix: ', '\u0302','h','postfix'],['\\u005D.postfix: ', '\u005D','v','postfix'],['\\u2952.infix: ', '\u2952','h','infix'],['\\u295F.infix: ', '\u295F','h','infix'],['\\u21AB.infix: ', '\u21AB','h','infix'],['\\u2992.postfix: ', '\u2992','v','postfix'],['\\u2016.postfix: ', '\u2016','v','postfix'],['\\u007C\u007C\u007C.infix: ', '\u007C\u007C\u007C','v','infix'],['\\u2A03.prefix: ', '\u2A03','l','prefix'],['\\u2193.infix: ', '\u2193','v','infix'],['\\u2956.infix: ', '\u2956','h','infix'],['\\u2984.postfix: ', '\u2984','v','postfix'],['\\u21AA.infix: ', '\u21AA','h','infix'],['\\u2A1B.prefix: ', '\u2A1B','l','prefix'],['\\u21E1.infix: ', '\u21E1','v','infix'],['\\u2198.infix: ', '\u2198','h','infix'],['\\u21AD.infix: ', '\u21AD','h','infix'],['\\u2A05.prefix: ', '\u2A05','l','prefix'],['\\u21DB.infix: ', '\u21DB','h','infix'],['\\u2993.prefix: ', '\u2993','v','prefix'],['\\u222B.prefix: ', '\u222B','l','prefix'],['\\u20D0.postfix: ', '\u20D0','h','postfix'],['\\u21FF.infix: ', '\u21FF','h','infix'],]; diff --git a/layout/mathml/tests/test_bug330964.html b/layout/mathml/tests/test_bug330964.html new file mode 100644 index 000000000..d0599a97b --- /dev/null +++ b/layout/mathml/tests/test_bug330964.html @@ -0,0 +1,98 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=330964 +--> +<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=330964">Mozilla Bug 330964</a> +<p id="display"></p> + +<math> + <mtable framespacing="7px 20px" frame="solid" rowspacing="11px 27px" columnspacing="5px 16px" + style="border-width: 2px;" id="mtable0"> + <mtr> + <mtd id="mtd0"> + <mn>X</mn> + </mtd> + <mtd id="mtd1"> + <mn>X</mn> + </mtd> + <mtd id="mtd2"> + <mn>X</mn> + </mtd> + </mtr> + <mtr> + <mtd id="mtd3"> + <mn>X</mn> + </mtd> + <mtd id="mtd4"> + <mn>X</mn> + </mtd> + <mtd id="mtd5"> + <mn>X</mn> + </mtd> + </mtr> + <mtr> + <mtd id="mtd6"> + <mn>X</mn> + </mtd> + <mtd id="mtd7"> + <mn>X</mn> + </mtd> + <mtd id="mtd8"> + <mn>X</mn> + </mtd> + </mtr> + </mtable> +</math> + +<pre id="test"> +<script type="application/javascript"> + + var epsilon = 2; + function almostEqual(x, y) { return Math.abs(x - y) < epsilon; } + + rectTable = $("mtable0").getBoundingClientRect(); + rect0 = $("mtd0").getBoundingClientRect(); + rect1 = $("mtd1").getBoundingClientRect(); + rect2 = $("mtd2").getBoundingClientRect(); + rect3 = $("mtd3").getBoundingClientRect(); + rect4 = $("mtd4").getBoundingClientRect(); + rect5 = $("mtd5").getBoundingClientRect(); + rect6 = $("mtd6").getBoundingClientRect(); + rect7 = $("mtd7").getBoundingClientRect(); + rect8 = $("mtd8").getBoundingClientRect(); + ok(almostEqual(rect1.left - rect0.right, 5), "columnspacing wonky"); + ok(almostEqual(rect2.left - rect1.right, 16), "columnspacing wonky"); + ok(almostEqual(rect4.left - rect3.right, 5), "columnspacing wonky"); + ok(almostEqual(rect5.left - rect4.right, 16), "columnspacing wonky"); + ok(almostEqual(rect7.left - rect6.right, 5), "columnspacing wonky"); + ok(almostEqual(rect8.left - rect7.right, 16), "columnspacing wonky"); + ok(almostEqual(rect3.top - rect0.bottom, 11), "rowspacing wonky"); + ok(almostEqual(rect4.top - rect1.bottom, 11), "rowspacing wonky"); + ok(almostEqual(rect5.top - rect2.bottom, 11), "rowspacing wonky"); + ok(almostEqual(rect6.top - rect3.bottom, 27), "rowspacing wonky"); + ok(almostEqual(rect7.top - rect4.bottom, 27), "rowspacing wonky"); + ok(almostEqual(rect8.top - rect5.bottom, 27), "rowspacing wonky"); + // Remember to subtract border + ok(almostEqual(rect0.left - rectTable.left - 2, 7), "framespacing left wonky"); + ok(almostEqual(rect3.left - rectTable.left - 2, 7), "framespacing left wonky"); + ok(almostEqual(rect6.left - rectTable.left - 2, 7), "framespacing left wonky"); + ok(almostEqual(rect0.top - rectTable.top - 2, 20), "framespacing top wonky"); + ok(almostEqual(rect1.top - rectTable.top - 2, 20), "framespacing top wonky"); + ok(almostEqual(rect2.top - rectTable.top - 2, 20), "framespacing top wonky"); + ok(almostEqual(rectTable.bottom - rect6.bottom - 2, 20), "framespacing bottom wonky"); + ok(almostEqual(rectTable.bottom - rect7.bottom - 2, 20), "framespacing bottom wonky"); + ok(almostEqual(rectTable.bottom - rect8.bottom - 2, 20), "framespacing bottom wonky"); + ok(almostEqual(rectTable.right - rect2.right - 2, 7), "framespacing right wonky"); + ok(almostEqual(rectTable.right - rect5.right - 2, 7), "framespacing right wonky"); + ok(almostEqual(rectTable.right - rect8.right - 2, 7), "framespacing right wonky"); +</script> +</pre> +</body> +</html> diff --git a/layout/mathml/tests/test_bug553917.html b/layout/mathml/tests/test_bug553917.html new file mode 100644 index 000000000..439ddbdd6 --- /dev/null +++ b/layout/mathml/tests/test_bug553917.html @@ -0,0 +1,171 @@ +<!DOCTYPE HTML> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=553917 +--> +<html> + <head> + <title>Test for Bug 553917</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"> + 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 = { + /*<math><mroot></mroot></math> + <math><msub></msub></math> + <math><msup></msup></math> + <math><mfrac></mfrac></math> + <math><msubsup></msubsup></math> + <math><munderover></munderover></math>*/ + ChildCountIncorrect: { + status : [false, false, false, false, false, false], + args : [["mroot"], ["msub"], ["msup"], ["mfrac"], ["msubsup"], ["munderover"]] }, + /*<math fontfamily="serif"></math> + <math color="#112233"></math> + <math background="#FFFFFF"></math> + <math fontsize="10"></math> + <math xlink:href="http://www.mozilla.org"></math>*/ + DeprecatedSupersededBy: { + status: [false, false, false, false, false], + args: [["fontfamily","mathvariant"],["color","mathcolor"], ["background","mathbackground"], + ["fontsize","mathsize"], ["xlink:href","href"]] }, + /*<math><mpadded width="BAD!"></mpadded></math> + <math><mpadded height="BAD!"></mpadded></math> + <math><mpadded voffset="BAD!"></mpadded></math>*/ + AttributeParsingError: { + status: [false, false, false], + args: [["BAD!","width","mpadded"], ["BAD!","height","mpadded"], ["BAD!","voffset","mpadded"]] + }, + /*<math scriptlevel="BAD!"></math> + <math scriptsizemultiplier="BAD!"></math>*/ + AttributeParsingErrorNoTag: { + status: [false, false], + args: [["BAD!","scriptlevel"], ["BAD!","scriptsizemultiplier"]] + }, + /* <math><mo rspace="2..0">+</mo></math> + <math><mo minsize="1.5notaunit">+</mo></math> + <math><mspace width="2"/></math> + <math><mo lspace="BADlspace">+</mo></math> + <math><mspace height="BADheight"/></math> + <math><mspace depth="BADdepth"/></math>*/ + LengthParsingError : { + status: [false, false, false, false, false, false], + args: [["2..0"], ["1.5notaunit"], ["2"],["BADlspace"],["BADheight"],["BADdepth"]] + }, + /*<math><mmultiscripts></mmultiscripts></math> + <math><mmultiscripts><mprescripts/><mprescripts/></mmultiscripts></math> + <math><mmultiscripts><mi>x</mi><mi>y</mi></mmultiscripts></math>*/ + MMultiscriptsErrors: { + status: [false, false, false], + args: ["NoBase","DuplicateMprescripts", "SubSupMismatch"] + }, + /*<math><mo minsize="2">+</mo></math>*/ + UnitlessValuesAreDeprecated : { + status : [false], + args : [[]] }}; + + var g_errorTypes = ["ChildCountIncorrect","DeprecatedSupersededBy","AttributeParsingError", + "AttributeParsingErrorNoTag","LengthParsingError", "MMultiscriptsErrors", + "UnitlessValuesAreDeprecated"]; + + function getErrorMessage(name,idx) + { + if (name != "MMultiscriptsErrors") { + var formatParams = g_errorInfo[name].args[idx]; + if (formatParams.length > 0) { + return g_bundl.formatStringFromName(name,formatParams,formatParams.length); + } else { + return g_bundl.GetStringFromName(name); + } + } else { + return g_bundl.GetStringFromName(g_errorInfo[name].args[idx]); + } + } + + /** 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=553917">Mozilla Bug 553917</a> + <!-- ChildCountIncorrect --> + <math><mroot></mroot></math> + <math><msub></msub></math> + <math><msup></msup></math> + <math><mfrac></mfrac></math> + <math><msubsup></msubsup></math> + <math><munderover></munderover></math> + + <!-- DeprecatedSupersededBy --> + <math fontfamily="serif"></math> + <math color="#112233"></math> + <math background="#FFFFFF"></math> + <math fontsize="10"></math> + <math xlink:href="http://www.mozilla.org"></math> + + <!-- AttributeParsingError --> + <math><mpadded width="BAD!"></mpadded></math> + <math><mpadded height="BAD!"></mpadded></math> + <math><mpadded voffset="BAD!"></mpadded></math> + + <!-- AttributeParsingErrorNoTag --> + <math scriptlevel="BAD!"></math> + <math scriptsizemultiplier="BAD!"></math> + + <!-- LengthParsingError --> + <math><mo rspace="2..0">+</mo></math> + <math><mo minsize="1.5notaunit">+</mo></math> + <math><mspace width="2"/></math> + <math><mo lspace="BADlspace">+</mo></math> + <math><mspace height="BADheight"/></math> + <math><mspace depth="BADdepth"/></math> + + <!-- MMultiscriptsErrors --> + <math><mmultiscripts></mmultiscripts></math> + <math><mmultiscripts><mprescripts/><mprescripts/></mmultiscripts></math> + <math><mmultiscripts><mi>x</mi><mi>y</mi></mmultiscripts></math> + + <!-- UnitlessValuesAreDeprecated --> + <math><mo minsize="2">+</mo></math> + </body> +</html> diff --git a/layout/mathml/tests/test_bug706406.html b/layout/mathml/tests/test_bug706406.html new file mode 100644 index 000000000..76cfc6352 --- /dev/null +++ b/layout/mathml/tests/test_bug706406.html @@ -0,0 +1,71 @@ +<!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> + <script type="application/javascript" src="/tests/SimpleTest/EventUtils.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=706406">Mozilla Bug 706406</a> +<p id="display"></p> +<math xmlns="http://www.w3.org/1998/Math/MathML"> + <maction actiontype="toggle" id="maction"> + <mn>1</mn> + <mn>2</mn> + </maction> +</math> +<pre id="test"> +<script type="application/javascript"> + +/** Test for Bug 706406 **/ + +function doTest() +{ + function doStopPropagation(aEvent) { + aEvent.stopPropagation(); + } + + var maction = document.getElementById("maction"); + + synthesizeMouseAtCenter(maction, {}); + + is(maction.getAttribute("selection"), "2", + "maction's selection attribute isn't 2 by first click"); + + synthesizeMouseAtCenter(maction, {}); + + is(maction.getAttribute("selection"), "1", + "maction's selection attribute isn't 1 by second click"); + + window.addEventListener("mousedown", doStopPropagation, true); + window.addEventListener("mouseup", doStopPropagation, true); + window.addEventListener("click", doStopPropagation, true); + + synthesizeMouseAtCenter(maction, {}); + + is(maction.getAttribute("selection"), "2", + "maction's selection attribute isn't 2 by first click called stopPropagation()"); + + synthesizeMouseAtCenter(maction, {}); + + is(maction.getAttribute("selection"), "1", + "maction's selection attribute isn't 1 by second click called stopPropagation()"); + + window.removeEventListener("mousedown", doStopPropagation, true); + window.removeEventListener("mouseup", doStopPropagation, true); + window.removeEventListener("click", doStopPropagation, true); + + SimpleTest.finish(); +} + +SimpleTest.waitForExplicitFinish(); +SimpleTest.waitForFocus(doTest); + +</script> +</pre> +</body> +</html> diff --git a/layout/mathml/tests/test_bug827713-2.html b/layout/mathml/tests/test_bug827713-2.html new file mode 100644 index 000000000..b7d27504d --- /dev/null +++ b/layout/mathml/tests/test_bug827713-2.html @@ -0,0 +1,152 @@ +<!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"> + + 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.GetStringFromName(g_errorInfo[name].args[idx]); + } + } + + /** 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> diff --git a/layout/mathml/tests/test_bug827713.html b/layout/mathml/tests/test_bug827713.html new file mode 100644 index 000000000..ebc46d333 --- /dev/null +++ b/layout/mathml/tests/test_bug827713.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> diff --git a/layout/mathml/tests/test_bug975681.html b/layout/mathml/tests/test_bug975681.html new file mode 100644 index 000000000..854693ead --- /dev/null +++ b/layout/mathml/tests/test_bug975681.html @@ -0,0 +1,118 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=975681 +--> + <head> + <meta charset="utf-8"> + <title> Test for Bug 975681 </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"/> + </head> + <body> + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=975681"> Mozilla Bug 975681 </a> + <p id="display"></p> + + <p> + <math> + <mfrac id="test_mfrac"> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + </mfrac> + </math> + </p> + + <p> + <math> + <mfrac linethickness="30px" id="mfrac_linethickness"> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + </mfrac> + </math> + </p> + + <p> + <math> + <mfrac numalign="left" id="mfrac_numalign"> + <mspace width="50px" height="20px" mathbackground="red"></mspace> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + </mfrac> + </math> + </p> + + <p> + <math> + <mfrac denomalign="right" id="mfrac_denomalign"> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + <mspace width="50px" height="20px" mathbackground="red"></mspace> + </mfrac> + </math> + </p> + + <p> + <math> + <mfrac bevelled="true" id="mfrac_bevelled"> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + </mfrac> + </math> + </p> + + <pre id="test"> + <script type="application/javascript"> + + /** Test for Bug 975681 **/ + SimpleTest.waitForExplicitFinish(); + + var epsilon = 1; // allow a small relative error + var delta = .25; // used to indicate a small shift + + function almostEqualAbs(x, y) { + var e = Math.abs(x - y); + return (e <= epsilon); + } + + function almostLessThanAbs(x, y) { + var e = x - y; + return (e <= epsilon); + } + + // test: mfrac + var mfracNum = document.getElementById("test_mfrac").firstElementChild.getBoundingClientRect(); + var mfracDenom = document.getElementById("test_mfrac").lastElementChild.getBoundingClientRect(); + + ok(almostEqualAbs(mfracNum.left, mfracDenom.left) && + almostEqualAbs(mfracNum.right, mfracDenom.right), "Numerator and denominator should be vertical aligned"); + + ok(almostLessThanAbs(mfracNum.bottom, mfracDenom.top), "Numerator should be above denominator"); + + // test: mfrac attributes + var mfrac = document.getElementById("mfrac_linethickness").getBoundingClientRect(); + var num = document.getElementById("mfrac_linethickness").firstElementChild.getBoundingClientRect(); + var denom = document.getElementById("mfrac_linethickness").lastElementChild.getBoundingClientRect(); + + ok(almostLessThanAbs(num.height + 30 + denom.height, mfrac.height) && + almostLessThanAbs(num.bottom + 30, denom.top), "numerator and denominator should be separated by linethickness"); + + num = document.getElementById("mfrac_numalign").firstElementChild.getBoundingClientRect(); + mfrac = document.getElementById("mfrac_numalign").getBoundingClientRect(); + + ok(almostEqualAbs(num.left, mfrac.left), "numerator should be aligned left"); + + mfrac = document.getElementById("mfrac_denomalign").getBoundingClientRect(); + denom = document.getElementById("mfrac_denomalign").lastElementChild.getBoundingClientRect(); + + ok(almostEqualAbs(mfrac.right, denom.right), "denominator should be aligned right"); + + num = document.getElementById("mfrac_bevelled").firstElementChild.getBoundingClientRect(); + denom = document.getElementById("mfrac_bevelled").lastElementChild.getBoundingClientRect(); + + ok(almostLessThanAbs(num.right, denom.left) && + almostLessThanAbs(num.top*(1-delta)+num.bottom*delta, denom.top), "incorrect position of mfrac children"); + + SimpleTest.finish(); + + </script> + </body> +</html> diff --git a/layout/mathml/tests/test_disabled.html b/layout/mathml/tests/test_disabled.html new file mode 100644 index 000000000..9b649d0f9 --- /dev/null +++ b/layout/mathml/tests/test_disabled.html @@ -0,0 +1,47 @@ +<!DOCTYPE HTML> +<html> +<!-- +Copied from +https://bugzilla.mozilla.org/show_bug.cgi?id=744830 +--> +<head> + <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=166235">Mozilla Bug 166235</a> +<div id="testnodes"><span>hi</span> there <!-- mon ami --></div> +<pre id="test"> +<script type="application/javascript"> + SimpleTest.waitForExplicitFinish(); + SpecialPowers.pushPrefEnv({"set": [["mathml.disabled", true]]}, doTest); + function doTest() { + let t = document.getElementById('testnodes'); + t.innerHTML = null; + t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math:math")); + t.firstChild.textContent = "<foo>"; + is(t.innerHTML, "<math:math><foo></math:math>"); + + t.innerHTML = null; + t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math")); + is(t.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML"); + t.firstChild.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "script")); + is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML"); + t.firstChild.firstChild.textContent = "1&2<3>4\xA0"; + is(t.innerHTML, '<math><script>1&2<3>4 \u003C/script></math>'); + + t.innerHTML = null; + t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math")); + is(t.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML"); + t.firstChild.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "style")); + is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML"); + t.firstChild.firstChild.textContent = "1&2<3>4\xA0"; + is(t.innerHTML, '<math><style>1&2<3>4 \u003C/style></math>'); + + SimpleTest.finish(); + } +</script> +</pre> +</body> +</html> + diff --git a/layout/mathml/tests/test_disabled_chrome.html b/layout/mathml/tests/test_disabled_chrome.html new file mode 100644 index 000000000..dff4011bb --- /dev/null +++ b/layout/mathml/tests/test_disabled_chrome.html @@ -0,0 +1,55 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=744830 +--> +<head> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> +<!-- + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> +--> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.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=166235">Mozilla Bug 166235</a> +<div id="testnodes"><span>hi</span> there <!-- mon ami --></div> +<pre id="test"> +<script type="application/javascript"> + add_task(function* () { + const initialPrefValue = SpecialPowers.getBoolPref("mathml.disabled"); + SpecialPowers.setBoolPref("mathml.disabled", true); + const Cu = SpecialPowers.Components.utils; + const { ContentTaskUtils } = Cu.import("resource://testing-common/ContentTaskUtils.jsm", {}); + let t = document.getElementById('testnodes'); + + let url = 'chrome://mochitests/content/chrome/layout/mathml/tests/mathml_example_test.html' + const chromeIframeEl = document.createElement('iframe'); + let chromeLoadPromise = ContentTaskUtils.waitForEvent(chromeIframeEl, 'load', false); + chromeIframeEl.src = url; + t.appendChild(chromeIframeEl); + + yield chromeLoadPromise; + const chromeBR = chromeIframeEl.contentDocument.body.getBoundingClientRect(); + + url = "http://mochi.test:8888/chrome/layout/mathml/tests/mathml_example_test.html"; + const iframeEl = document.createElement('iframe'); + iframeEl.src = url; + let loadPromise = ContentTaskUtils.waitForEvent(iframeEl, 'load', false); + t.appendChild(iframeEl); + yield loadPromise; + + const contentBR = iframeEl.contentDocument.body.getBoundingClientRect(); + + ok(chromeBR.height > contentBR.height, "Chrome content height should be bigger than content due to layout"); + + ok(!iframeEl.contentDocument.getElementById('svgel').hasExtension("http://www.w3.org/1998/Math/MathML"), 'SVG namespace support is disabled in content iframe'); + ok(chromeIframeEl.contentDocument.getElementById('svgel').hasExtension("http://www.w3.org/1998/Math/MathML"), 'SVG namespace support is enabled in chrome iframe'); + + SpecialPowers.setBoolPref("mathml.disabled", initialPrefValue); + }); +</script> +</pre> +</body> +</html> + diff --git a/layout/mathml/tests/test_opentype-axis-height.html b/layout/mathml/tests/test_opentype-axis-height.html new file mode 100644 index 000000000..cfab51d40 --- /dev/null +++ b/layout/mathml/tests/test_opentype-axis-height.html @@ -0,0 +1,60 @@ +<!doctype html> +<html> + <head> + <title>Open Type MATH - axis-height</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"/> + <meta charset="utf-8"/> + <style type="text/css"> + math { + font-size: 10px; + } + @font-face { + font-family: axis-height-1; + src: url(/tests/fonts/math/axis-height-1.otf); + } + @font-face { + font-family: axis-height-2; + src: url(/tests/fonts/math/axis-height-2.otf); + } + </style> + <script type="application/javascript"> + SimpleTest.waitForExplicitFinish(); + + var epsilon = 5; + function almostEqual(x, y) { return Math.abs(x - y) < epsilon; } + + function getBox(aId) { + return document.getElementById(aId).getBoundingClientRect(); + } + + function doTest() { + ok(almostEqual(getBox("plus1").top - getBox("plus2").top, 10 * 20), + "Bad AxisHeight"); + + SimpleTest.finish(); + } + </script> + </head> + <body onload="doTest()"> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365"> + Mozilla Bug 961365 + </a> + + <p id="display"></p> + + <p> + <math style="font-family: axis-height-1;"> + <mo id="plus1">+</mo> + </math> + <math style="font-family: axis-height-2;"> + <mo id="plus2">+</mo> + </math> + </p> + + </body> +</html> diff --git a/layout/mathml/tests/test_opentype-fraction.html b/layout/mathml/tests/test_opentype-fraction.html new file mode 100644 index 000000000..ad25b2e4d --- /dev/null +++ b/layout/mathml/tests/test_opentype-fraction.html @@ -0,0 +1,187 @@ +<!doctype html> +<html> + <head> + <title>Open Type MATH - fraction</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"/> + <meta charset="utf-8"/> + <style type="text/css"> + math { + font-size: 10px; + } + @font-face { + font-family: fraction-1; + src: url(/tests/fonts/math/fraction-1.otf); + } + @font-face { + font-family: fraction-2; + src: url(/tests/fonts/math/fraction-2.otf); + } + @font-face { + font-family: fraction-3; + src: url(/tests/fonts/math/fraction-3.otf); + } + @font-face { + font-family: fraction-4; + src: url(/tests/fonts/math/fraction-4.otf); + } + @font-face { + font-family: fraction-5; + src: url(/tests/fonts/math/fraction-5.otf); + } + @font-face { + font-family: fraction-6; + src: url(/tests/fonts/math/fraction-6.otf); + } + @font-face { + font-family: fraction-7; + src: url(/tests/fonts/math/fraction-7.otf); + } + @font-face { + font-family: fraction-8; + src: url(/tests/fonts/math/fraction-8.otf); + } + @font-face { + font-family: fraction-9; + src: url(/tests/fonts/math/fraction-9.otf); + } + </style> + <script type="text/javascript"> + var epsilon = 5; + function almostEqual(x, y) { return Math.abs(x - y) < epsilon; } + + function getBox(aId) { + return document.getElementById(aId).getBoundingClientRect(); + } + + function doTest() { + /* inline style */ + var ref = getBox("ref").height; + + ok(almostEqual(getBox("d1").top - getBox("n1").bottom, ref * 20), + "Bad FractionRuleThickness"); + + ok(almostEqual(getBox("n1").top, getBox("n2").top) && + almostEqual(getBox("d2").top - getBox("n2").bottom, ref * 10.5), + "Bad FractionNumeratorGapMin"); + + ok(almostEqual(getBox("d1").bottom, getBox("d3").bottom) && + almostEqual(getBox("d3").top - getBox("n3").bottom, ref * 10.5), + "Bad FractionDenominatorGapMin"); + + ok(almostEqual(getBox("ref").top - getBox("n4").top, ref*3), + "Bad FractionNumeratorShiftUp"); + + ok(almostEqual(getBox("d5").bottom - getBox("ref").bottom, ref*3), + "Bad FractionDenominatorShiftDown"); + + /* display style */ + ref = getBox("dref").height; + + ok(almostEqual(getBox("dd1").top - getBox("dn1").bottom, ref * 20), + "Bad FractionRuleThickness"); + + ok(almostEqual(getBox("dn1").top, getBox("n6").top) && + almostEqual(getBox("d6").top - getBox("n6").bottom, ref * 10.5), + "Bad FractionNumeratorDisplayStyleGapMin"); + + ok(almostEqual(getBox("dd1").bottom, getBox("d7").bottom) && + almostEqual(getBox("d7").top - getBox("n7").bottom, ref * 10.5), + "Bad FractionDenominatorDisplayStyleGapMin"); + + ok(almostEqual(getBox("dref").top - getBox("n8").top, ref*3), + "Bad FractionNumeratorDisplayStyleShiftUp"); + + ok(almostEqual(getBox("d9").bottom - getBox("dref").bottom, ref*3), + "Bad FractionDenominatorDisplayStyleShiftDown"); + + SimpleTest.finish(); + } + </script> + </head> + <body onload="doTest()"> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365"> + Mozilla Bug 961365 + </a> + + <p id="display"></p> + + <p> + <math> + <mspace id="ref" height="1em" width="1em" mathbackground="green"/> + </math> + <math style="font-family: fraction-1;"> + <mfrac> + <mspace id="n1" height="1em" width="1em" mathbackground="red"/> + <mspace id="d1" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + <math style="font-family: fraction-2;"> + <mfrac> + <mspace id="n2" height="1em" width="1em" mathbackground="red"/> + <mspace id="d2" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + <math style="font-family: fraction-3;"> + <mfrac> + <mspace id="n3" height="1em" width="1em" mathbackground="red"/> + <mspace id="d3" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + <math style="font-family: fraction-4;"> + <mfrac> + <mspace id="n4" height="1em" width="1em" mathbackground="red"/> + <mspace id="d4" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + <math style="font-family: fraction-5;"> + <mfrac> + <mspace id="n5" height="1em" width="1em" mathbackground="red"/> + <mspace id="d5" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + </p> + + <p> + <math displaystyle="true"> + <mspace id="dref" height="1em" width="1em" mathbackground="green"/> + </math> + <math displaystyle="true" style="font-family: fraction-1;"> + <mfrac> + <mspace id="dn1" height="1em" width="1em" mathbackground="red"/> + <mspace id="dd1" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + <math displaystyle="true" style="font-family: fraction-6;"> + <mfrac> + <mspace id="n6" height="1em" width="1em" mathbackground="red"/> + <mspace id="d6" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + <math displaystyle="true" style="font-family: fraction-7;"> + <mfrac> + <mspace id="n7" height="1em" width="1em" mathbackground="red"/> + <mspace id="d7" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + <math displaystyle="true" style="font-family: fraction-8;"> + <mfrac> + <mspace id="n8" height="1em" width="1em" mathbackground="red"/> + <mspace id="d8" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + <math displaystyle="true" style="font-family: fraction-9;"> + <mfrac> + <mspace id="n9" height="1em" width="1em" mathbackground="red"/> + <mspace id="d9" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + </p> + + </body> +</html> diff --git a/layout/mathml/tests/test_opentype-limits.html b/layout/mathml/tests/test_opentype-limits.html new file mode 100644 index 000000000..596838789 --- /dev/null +++ b/layout/mathml/tests/test_opentype-limits.html @@ -0,0 +1,172 @@ +<!doctype html> +<html> + <head> + <title>Open Type MATH - limits</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"/> + <meta charset="utf-8"/> + <style type="text/css"> + math { + font-size: 10px; + } + @font-face { + font-family: limits-1; + src: url(/tests/fonts/math/limits-1.otf); + } + @font-face { + font-family: limits-2; + src: url(/tests/fonts/math/limits-2.otf); + } + @font-face { + font-family: limits-3; + src: url(/tests/fonts/math/limits-3.otf); + } + @font-face { + font-family: limits-4; + src: url(/tests/fonts/math/limits-4.otf); + } + @font-face { + font-family: limits-5; + src: url(/tests/fonts/math/limits-5.otf); + } + </style> + <script type="text/javascript"> + SimpleTest.waitForExplicitFinish(); + + var epsilon = 5; + function almostEqual(x, y) { return Math.abs(x - y) < epsilon; } + + function getBox(aId) { + return document.getElementById(aId).getBoundingClientRect(); + } + + function doTest() { + ok(almostEqual(getBox("base1").top - getBox("over1").bottom, 7 * 10) && + almostEqual(getBox("base2").top - getBox("over2").bottom, 7 * 10), + "Bad UpperLimitGapMin"); + + ok(almostEqual(getBox("under3").top - getBox("base3").bottom, 5 * 10) && + almostEqual(getBox("under4").top - getBox("base4").bottom, 5 * 10), + "Bad LowerLimitGapMin"); + + ok(almostEqual(getBox("ref3").top - getBox("over5").bottom, 9 * 10) && + almostEqual(getBox("ref3").top - getBox("over6").bottom, 9 * 10), + "UpperLimitBaselineRiseMin"); + + ok(almostEqual(getBox("under7").top - getBox("ref4").bottom, 2 * 10) && + almostEqual(getBox("under8").top - getBox("ref4").bottom, 2 * 10), + "LowerLimitBaselineDropMin"); + + ok(almostEqual(getBox("base9").top - getBox("over9").bottom, + (6 - 2) * 10) && + almostEqual(getBox("base10").top - getBox("over10").bottom, + (6 - 2) * 10), + "Bad AccentBaseHeight"); + + SimpleTest.finish(); + } + </script> + </head> + <body onload="doTest()"> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365"> + Mozilla Bug 961365 + </a> + + <p id="display"></p> + + <p> + <math style="font-family: limits-1;" displaystyle="true"> + <mover> + <mo id="base1">∑</mo> + <mspace id="over1" height="1em" width="1em" mathbackground="red"/> + </mover> + </math> + <math style="font-family: limits-1;" displaystyle="true"> + <munderover> + <mo id="base2">∑</mo> + <mspace id="under2" height="1em" width="1em" mathbackground="red"/> + <mspace id="over2" height="1em" width="1em" mathbackground="red"/> + </munderover> + </math> + </p> + + <p> + <math style="font-family: limits-2;" displaystyle="true"> + <munder> + <mo id="base3">∑</mo> + <mspace id="under3" height="1em" width="1em" mathbackground="red"/> + </munder> + </math> + <math style="font-family: limits-2;" displaystyle="true"> + <munderover> + <mo id="base4">∑</mo> + <mspace id="under4" height="1em" width="1em" mathbackground="red"/> + <mspace id="over4" height="1em" width="1em" mathbackground="red"/> + </munderover> + </math> + </p> + + <p> + <math style="font-family: limits-3;" displaystyle="true"> + <mspace id="ref3" height="1em" width="1em" mathbackground="green"/> + </math> + <math style="font-family: limits-3;" displaystyle="true"> + <mover> + <mo id="base5">∑</mo> + <mspace id="over5" height="1em" width="1em" mathbackground="red"/> + </mover> + </math> + <math style="font-family: limits-3;" displaystyle="true"> + <munderover> + <mo id="base6">∑</mo> + <mspace id="under6" height="1em" width="1em" mathbackground="red"/> + <mspace id="over6" height="1em" width="1em" mathbackground="red"/> + </munderover> + </math> + </p> + + <p> + <math style="font-family: limits-4;" displaystyle="true"> + <mspace id="ref4" height="1em" width="1em" mathbackground="green"/> + </math> + <math style="font-family: limits-4;" displaystyle="true"> + <munder> + <mo id="base7">∑</mo> + <mspace id="under7" height="1em" width="1em" mathbackground="red"/> + </munder> + </math> + <math style="font-family: limits-4;" displaystyle="true"> + <munderover> + <mo id="base8">∑</mo> + <mspace id="under8" height="1em" width="1em" mathbackground="red"/> + <mspace id="over8" height="1em" width="1em" mathbackground="red"/> + </munderover> + </math> + </p> + + <p> + <math style="font-family: limits-5;" displaystyle="true"> + <mspace id="ref5" height="1em" width="1em" mathbackground="green"/> + </math> + <math style="font-family: limits-5;" displaystyle="true"> + <mover> + <mspace id="base9" height="2em" width="2em" mathbackground="blue"/> + <mo id="over9" stretchy="false">~</mo> + </mover> + </math> + <math style="font-family: limits-5;" displaystyle="true"> + <munderover> + <mspace id="base10" height="2em" width="2em" mathbackground="blue"/> + <mspace id="under10" height="1em" width="1em" mathbackground="red"/> + <mo id="over10" stretchy="false">~</mo> + </munderover> + </math> + </p> + + </body> +</html> diff --git a/layout/mathml/tests/test_opentype-radical.html b/layout/mathml/tests/test_opentype-radical.html new file mode 100644 index 000000000..b073eb358 --- /dev/null +++ b/layout/mathml/tests/test_opentype-radical.html @@ -0,0 +1,196 @@ +<!doctype html> +<html> + <head> + <title>Open Type MATH - radical</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"/> + <meta charset="utf-8"/> + <style type="text/css"> + math { + font-size: 10px; + } + @font-face { + font-family: radical-1; + src: url(/tests/fonts/math/radical-1.otf); + } + @font-face { + font-family: radical-2; + src: url(/tests/fonts/math/radical-2.otf); + } + @font-face { + font-family: radical-3; + src: url(/tests/fonts/math/radical-3.otf); + } + @font-face { + font-family: radical-4; + src: url(/tests/fonts/math/radical-4.otf); + } + @font-face { + font-family: radical-5; + src: url(/tests/fonts/math/radical-5.otf); + } + @font-face { + font-family: radical-6; + src: url(/tests/fonts/math/radical-6.otf); + } + @font-face { + font-family: radical-7; + src: url(/tests/fonts/math/radical-7.otf); + } + </style> + <script type="text/javascript"> + SimpleTest.waitForExplicitFinish(); + + var epsilon = 5; + function almostEqual(x, y) { return Math.abs(x - y) < epsilon; } + + function getBox(aId) { + return document.getElementById(aId).getBoundingClientRect(); + } + + function doTest() { + ok(almostEqual(getBox("inner1").top - + getBox("outer1").top, 5*10) && + almostEqual(getBox("inner2").top - + getBox("outer2").top, 5*10) && + almostEqual(getBox("inner3").top - + getBox("outer3").top, 5*10), + "Bad RadicalRuleThickness"); + + ok(almostEqual(getBox("inner4").top - + getBox("outer4").top, (7+1)*10) && + almostEqual(getBox("inner5").top - + getBox("outer5").top, (7+1)*10) && + almostEqual(getBox("inner6").top - + getBox("outer6").top, (7+1)*10), + "Bad RadicalExtraAscender"); + + ok(almostEqual(getBox("inner7").top - + getBox("outer7").top, (3+1)*10) && + almostEqual(getBox("inner7").top - + getBox("outer8").top, (3+1)*10) && + almostEqual(getBox("inner8").top - + getBox("outer9").top, (3+1)*10), + "Bad RadicalVerticalGap"); + + ok(almostEqual(getBox("inner10").top - + getBox("outer10").top, (9+1)*10) && + almostEqual(getBox("inner11").top - + getBox("outer11").top, (9+1)*10) && + almostEqual(getBox("inner12").top - + getBox("outer12").top, (9+1)*10), + "Bad RadicalDisplayStyleVerticalGap"); + + ok(almostEqual(getBox("base5").bottom - getBox("index5").bottom, + (getBox("base5").bottom - getBox("root5").top) * .25), + "Bad RadicalDegreeBottomRaisePercent") + + ok(almostEqual(getBox("index6").left - getBox("root6").left, 10 * 5), + "Bad RadicalKernBeforeDegree") + + ok(almostEqual(getBox("base7").left - + getBox("index7").right, 10 * (7+1)), + "Bad RadicalKernAfterDegree") + + SimpleTest.finish(); + } + </script> + </head> + <body onload="doTest()"> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365"> + Mozilla Bug 961365 + </a> + + <p id="display"></p> + + <p> + <math style="font-family: radical-1;"> + <msqrt id="outer1" mathbackground="green"> + <mspace id="inner1" width="1em" height="1em" mathbackground="red"/> + </msqrt> + <menclose id="outer2" notation="radical" mathbackground="green"> + <mspace id="inner2" width="1em" height="1em" mathbackground="red"/> + </menclose> + <mroot id="outer3" mathbackground="green"> + <mspace id="inner3" width="1em" height="1em" mathbackground="red"/> + <mspace/> + </mroot> + </math> + </p> + <p> + <math style="font-family: radical-2;"> + <msqrt id="outer4" mathbackground="green"> + <mspace id="inner4" width="1em" height="1em" mathbackground="red"/> + </msqrt> + <menclose id="outer5" notation="radical" mathbackground="green"> + <mspace id="inner5" width="1em" height="1em" mathbackground="red"/> + </menclose> + <mroot id="outer6" mathbackground="green"> + <mspace id="inner6" width="1em" height="1em" mathbackground="red"/> + <mspace/> + </mroot> + </math> + </p> + <p> + <math style="font-family: radical-3;"> + <msqrt id="outer7" mathbackground="green"> + <mspace id="inner7" width="1em" height="1em" mathbackground="red"/> + </msqrt> + <menclose id="outer8" notation="radical" mathbackground="green"> + <mspace id="inner8" width="1em" height="1em" mathbackground="red"/> + </menclose> + <mroot id="outer9" mathbackground="green"> + <mspace id="inner9" width="1em" height="1em" mathbackground="red"/> + <mspace/> + </mroot> + </math> + </p> + <p> + <math style="font-family: radical-4;" displaystyle="true"> + <msqrt id="outer10" mathbackground="green"> + <mspace id="inner10" width="1em" height="1em" mathbackground="red"/> + </msqrt> + <menclose id="outer11" notation="radical" mathbackground="green"> + <mspace id="inner11" width="1em" height="1em" mathbackground="red"/> + </menclose> + <mroot id="outer12" mathbackground="green"> + <mspace id="inner12" width="1em" height="1em" mathbackground="red"/> + <mspace/> + </mroot> + </math> + </p> + + <p> + <math style="font-family: radical-5;"> + <mroot id="root5" mathbackground="green"> + <mspace id="base5" width="1em" height="10em" mathbackground="red"/> + <mspace id="index5" width="1em" height="1em" mathbackground="blue"/> + </mroot> + </math> + </p> + + <p> + <math style="font-family: radical-6;"> + <mroot id="root6" mathbackground="green"> + <mspace id="base6" width="1em" height="10em" mathbackground="red"/> + <mspace id="index6" width="1em" height="1em" mathbackground="blue"/> + </mroot> + </math> + </p> + + <p> + <math style="font-family: radical-7;"> + <mroot id="root7" mathbackground="green"> + <mspace id="base7" width="1em" height="10em" mathbackground="red"/> + <mspace id="index7" width="1em" height="1em" mathbackground="blue"/> + </mroot> + </math> + </p> + + </body> +</html> diff --git a/layout/mathml/tests/test_opentype-scripts.html b/layout/mathml/tests/test_opentype-scripts.html new file mode 100644 index 000000000..7ad0e90ab --- /dev/null +++ b/layout/mathml/tests/test_opentype-scripts.html @@ -0,0 +1,292 @@ +<!doctype html> +<html> + <head> + <title>Open Type MATH - scripts</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"/> + <meta charset="utf-8"/> + <style type="text/css"> + math, mspace { + font-size: 10px; + } + @font-face { + font-family: scripts-1; + src: url(/tests/fonts/math/scripts-1.otf); + } + @font-face { + font-family: scripts-2; + src: url(/tests/fonts/math/scripts-2.otf); + } + @font-face { + font-family: scripts-3; + src: url(/tests/fonts/math/scripts-3.otf); + } + @font-face { + font-family: scripts-4; + src: url(/tests/fonts/math/scripts-4.otf); + } + @font-face { + font-family: scripts-5; + src: url(/tests/fonts/math/scripts-5.otf); + } + @font-face { + font-family: scripts-6; + src: url(/tests/fonts/math/scripts-6.otf); + } + @font-face { + font-family: scripts-7; + src: url(/tests/fonts/math/scripts-7.otf); + } + @font-face { + font-family: scripts-8; + src: url(/tests/fonts/math/scripts-8.otf); + } + @font-face { + font-family: scripts-9; + src: url(/tests/fonts/math/scripts-9.otf); + } + </style> + <script type="text/javascript"> + SimpleTest.waitForExplicitFinish(); + + function doTest() { + var epsilon = 5; + function almostEqual(x, y) { return Math.abs(x - y) < epsilon; } + + function getBox(aId) { + return document.getElementById(aId).getBoundingClientRect(); + } + + ok(almostEqual(getBox("ref1").left - getBox("sub1").right, 3*10) && + almostEqual(getBox("ref2").left - getBox("sup2").right, 3*10) && + almostEqual(getBox("sup32").left - getBox("sup31").right, 3*10) && + almostEqual(getBox("ref3").left - getBox("sup32").right, 3*10), + "SpaceAfterScript"); + + ok(almostEqual(getBox("ref4").bottom - + getBox("sup41").bottom, 7 * 10) && + almostEqual(getBox("ref4").bottom - + getBox("sup42").bottom, 7 * 10) && + almostEqual(getBox("ref4").bottom - + getBox("sup43").bottom, 7 * 10) && + almostEqual(getBox("ref4").bottom - + getBox("sup44").bottom, 7 * 10), + "Bad SuperscriptShiftUp") + ok(almostEqual(getBox("ref5").bottom - + getBox("sup51").bottom, 5 * 10) && + almostEqual(getBox("ref5").bottom - + getBox("sup52").bottom, 5 * 10) && + almostEqual(getBox("ref5").bottom - + getBox("sup53").bottom, 5 * 10) && + almostEqual(getBox("ref5").bottom - + getBox("sup54").bottom, 5 * 10), + "Bad SuperscriptShiftUpCramped") + + ok(almostEqual(getBox("ref6").bottom - + getBox("sub61").bottom, -6 * 10) && + almostEqual(getBox("ref6").bottom - + getBox("sub62").bottom, -6 * 10) && + almostEqual(getBox("ref6").bottom - + getBox("sub63").bottom, -6 * 10) && + almostEqual(getBox("ref6").bottom - + getBox("sub64").bottom, -6 * 10), + "Bad SubscriptShiftDown") + + ok(almostEqual(getBox("sub7").top - + getBox("sup7").bottom, 11 * 10), + "Bad SubSuperscriptGapMin"); + + ok(almostEqual(getBox("sub8").top - + getBox("sup8").bottom, 11 * 10) && + almostEqual(getBox("ref8").bottom - + getBox("sup8").bottom, 3 * 10), + "Bad SuperscriptBottomMaxWithSubscript"); + + ok(almostEqual(getBox("ref9").top, getBox("sub9").top), + "Bad SubscriptTopMax"); + + ok(almostEqual(getBox("ref10").bottom - getBox("sup10").bottom, 9 * 10), + "Bad SuperscriptBottomMin"); + + ok(almostEqual(getBox("base11").bottom + 3 * 10, + getBox("sub11").top), + "Bad SubscriptBaselineDrop"); + + ok(almostEqual(getBox("base11").top + 5 * 10, + getBox("sup11").bottom), + "Bad SuperscriptBaselineDrop"); + + SimpleTest.finish(); + } + </script> + </head> + <body onload="doTest()"> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365"> + Mozilla Bug 961365 + </a> + + <p id="display"></p> + + <p> + <math style="font-family: scripts-1;"> + <msub> + <mspace height="2em" width="2em" mathbackground="blue"/> + <mspace id="sub1" height="1em" width="1em" mathbackground="red"/> + </msub> + <mspace id="ref1" height="1em" width="1em" mathbackground="green"/> + </math> + <math style="font-family: scripts-1;"> + <msup> + <mspace height="2em" width="2em" mathbackground="blue"/> + <mspace id="sup2" height="1em" width="1em" mathbackground="red"/> + </msup> + <mspace id="ref2" height="1em" width="1em" mathbackground="green"/> + </math> + <math style="font-family: scripts-1;"> + <mmultiscripts> + <mspace height="2em" width="2em" mathbackground="blue"/> + <none/> + <mspace id="sup31" height="1em" width="1em" mathbackground="red"/> + <none/> + <mspace id="sup32" height="1em" width="1em" mathbackground="red"/> + </mmultiscripts> + <mspace id="ref3" height="1em" width="1em" mathbackground="green"/> + </math> + </p> + + <p> + <math style="font-family: scripts-2;"> + <mspace id="ref4" height="1em" width="1em" mathbackground="green"/> + <msup> + <mspace height="2em" width="2em" mathbackground="blue"/> + <mspace id="sup41" height="1em" width="1em" mathbackground="red"/> + </msup> + <msubsup> + <mspace height="2em" width="2em" mathbackground="blue"/> + <mspace height="1em" width="1em" mathbackground="red"/> + <mspace id="sup42" height="1em" width="1em" mathbackground="red"/> + </msubsup> + <mmultiscripts> + <mspace height="2em" width="2em" mathbackground="blue"/> + <none/> + <mspace id="sup43" height="1em" width="1em" mathbackground="red"/> + <none/> + <mspace id="sup44" height="1em" width="1em" mathbackground="red"/> + </mmultiscripts> + </math> + </p> + + <p> + <math style="font-family: scripts-3;"> + <msqrt> + <mspace id="ref5" height="1em" width="1em" mathbackground="green"/> + <msup> + <mspace height="2em" width="2em" mathbackground="blue"/> + <mspace id="sup51" height="1em" width="1em" mathbackground="red"/> + </msup> + <msubsup> + <mspace height="2em" width="2em" mathbackground="blue"/> + <mspace height="1em" width="1em" mathbackground="red"/> + <mspace id="sup52" height="1em" width="1em" mathbackground="red"/> + </msubsup> + <mmultiscripts> + <mspace height="2em" width="2em" mathbackground="blue"/> + <mspace height="1em" width="1em" mathbackground="red"/> + <mspace id="sup53" height="1em" width="1em" mathbackground="red"/> + <mspace height="1em" width="1em" mathbackground="red"/> + <mspace id="sup54" height="1em" width="1em" mathbackground="red"/> + </mmultiscripts> + </msqrt> + </math> + </p> + + <p> + <math style="font-family: scripts-4;"> + <mspace id="ref6" height="1em" width="1em" mathbackground="green"/> + <msub> + <mspace height="2em" width="2em" mathbackground="blue"/> + <mspace id="sub61" height="1em" width="1em" mathbackground="red"/> + </msub> + <msubsup> + <mspace height="2em" width="2em" mathbackground="blue"/> + <mspace id="sub62" height="1em" width="1em" mathbackground="red"/> + <mspace height="1em" width="1em" mathbackground="red"/> + </msubsup> + <mmultiscripts> + <mspace height="2em" width="2em" mathbackground="blue"/> + <mspace id="sub63" height="1em" width="1em" mathbackground="red"/> + <mspace height="1em" width="1em" mathbackground="red"/> + <mspace id="sub64" height="1em" width="1em" mathbackground="red"/> + <mspace height="1em" width="1em" mathbackground="red"/> + </mmultiscripts> + </math> + </p> + + <p> + <math style="font-family: scripts-5;"> + <msubsup> + <mspace height="2em" width="2em" mathbackground="blue"/> + <mspace id="sub7" height="1em" width="1em" mathbackground="red"/> + <mspace id="sup7" height="1em" width="1em" mathbackground="red"/> + </msubsup> + </math> + </p> + + <p> + <math style="font-family: scripts-6;"> + <mspace id="ref8" height="1em" width="1em" mathbackground="green"/> + <msubsup> + <mspace height="2em" width="2em" mathbackground="blue"/> + <mspace id="sub8" height="1em" width="1em" mathbackground="red"/> + <mspace id="sup8" height="1em" width="1em" mathbackground="red"/> + </msubsup> + </math> + </p> + + <p> + <math style="font-family: scripts-7;"> + <msub> + <mspace height="2em" width="2em" mathbackground="blue"/> + <mspace id="ref9" height="5em" + width="1em" mathbackground="green"/> + </msub> + <msub> + <mspace height="2em" width="2em" mathbackground="blue"/> + <mspace id="sub9" height="9em" + width="1em" mathbackground="red"/> + </msub> + </math> + </p> + + <p> + <math style="font-family: scripts-8;"> + <mspace id="ref10" height="1em" + width="1em" mathbackground="green"/> + <msup> + <mspace id="base10" height="2em" + width="2em" mathbackground="blue"/> + <mspace id="sup10" height="1em" + width="1em" mathbackground="red"/> + </msup> + </math> + </p> + + <p> + <math style="font-family: scripts-9;"> + <msubsup> + <mspace id="base11" height="10em" depth="10em" + width="1em" mathbackground="red"/> + <mspace id="sub11" + height="0em" depth="1em" width="1em" mathbackground="green"/> + <mspace id="sup11" + height="1em" depth="0em" width="1em" mathbackground="blue"/> + </msubsup> + </math> + </p> + </body> +</html> diff --git a/layout/mathml/tests/test_opentype-stack.html b/layout/mathml/tests/test_opentype-stack.html new file mode 100644 index 000000000..0cbaabb97 --- /dev/null +++ b/layout/mathml/tests/test_opentype-stack.html @@ -0,0 +1,137 @@ +<!doctype html> +<html> + <head> + <title>Open Type MATH - stack</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"/> + <meta charset="utf-8"/> + <style type="text/css"> + math { + font-size: 10px; + } + @font-face { + font-family: stack-1; + src: url(/tests/fonts/math/stack-1.otf); + } + @font-face { + font-family: stack-2; + src: url(/tests/fonts/math/stack-2.otf); + } + @font-face { + font-family: stack-3; + src: url(/tests/fonts/math/stack-3.otf); + } + @font-face { + font-family: stack-4; + src: url(/tests/fonts/math/stack-4.otf); + } + @font-face { + font-family: stack-5; + src: url(/tests/fonts/math/stack-5.otf); + } + @font-face { + font-family: stack-6; + src: url(/tests/fonts/math/stack-6.otf); + } + </style> + <script type="text/javascript"> + SimpleTest.waitForExplicitFinish(); + + function doTest() { + var epsilon = 5; + function almostEqual(x, y) { return Math.abs(x - y) < epsilon; } + + function getBox(aId) { + return document.getElementById(aId).getBoundingClientRect(); + } + + /* inline style */ + var ref = getBox("ref").height; + + ok(almostEqual(getBox("d1").top - getBox("n1").bottom, ref * 20), + "Bad StackGapMin"); + + ok(almostEqual(getBox("ref").top - getBox("n2").top, ref*3), + "Bad StackTopShiftMin"); + + ok(almostEqual(getBox("d3").bottom - getBox("ref").bottom, ref*3), + "Bad StackBottomShiftDown"); + + /* display style */ + ref = getBox("ref").height; + + ok(almostEqual(getBox("d4").top - getBox("n4").bottom, ref * 20), + "Bad StackGapDisplayStyleMin"); + + ok(almostEqual(getBox("dref").top - getBox("n5").top, ref*3), + "Bad StackTopDisplayStyleShiftMin"); + + ok(almostEqual(getBox("d6").bottom - getBox("dref").bottom, ref*3), + "Bad StackDisplayStyleBottomShiftDown"); + + SimpleTest.finish(); + } + </script> + </head> + <body onload="doTest()"> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365"> + Mozilla Bug 961365 + </a> + + <p id="display"></p> + + <p> + <math> + <mspace id="ref" height="1em" width="1em" mathbackground="green"/> + </math> + <math style="font-family: stack-1;"> + <mfrac linethickness="0"> + <mspace id="n1" height="1em" width="1em" mathbackground="red"/> + <mspace id="d1" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + <math style="font-family: stack-2;"> + <mfrac linethickness="0"> + <mspace id="n2" height="1em" width="1em" mathbackground="red"/> + <mspace id="d2" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + <math style="font-family: stack-3;"> + <mfrac linethickness="0"> + <mspace id="n3" height="1em" width="1em" mathbackground="red"/> + <mspace id="d3" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + </p> + + <p> + <math displaystyle="true"> + <mspace id="dref" height="1em" width="1em" mathbackground="green"/> + </math> + <math displaystyle="true" style="font-family: stack-4;"> + <mfrac linethickness="0"> + <mspace id="n4" height="1em" width="1em" mathbackground="red"/> + <mspace id="d4" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + <math displaystyle="true" style="font-family: stack-5;"> + <mfrac linethickness="0"> + <mspace id="n5" height="1em" width="1em" mathbackground="red"/> + <mspace id="d5" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + <math displaystyle="true" style="font-family: stack-6;"> + <mfrac linethickness="0"> + <mspace id="n6" height="1em" width="1em" mathbackground="red"/> + <mspace id="d6" height="1em" width="1em" mathbackground="red"/> + </mfrac> + </math> + </p> + + </body> +</html> |