Diff
Modified: trunk/LayoutTests/ChangeLog (203102 => 203103)
--- trunk/LayoutTests/ChangeLog 2016-07-12 03:30:05 UTC (rev 203102)
+++ trunk/LayoutTests/ChangeLog 2016-07-12 04:03:43 UTC (rev 203103)
@@ -1,3 +1,16 @@
+2016-07-11 Frederic Wang <[email protected]>
+
+ Replace reftest mathml/presentation/fractions-positions.html with script tests
+ https://bugs.webkit.org/show_bug.cgi?id=159558
+
+ Reviewed by Martin Robinson.
+
+ * TestExpectations: Remove fractions-positions.html
+ * imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-1-expected.txt: Added.
+ * imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-1.html: Added.
+ * mathml/presentation/fractions-positions-expected.html: Removed.
+ * mathml/presentation/fractions-positions.html: Removed.
+
2016-07-11 Benjamin Poulain <[email protected]>
[JSC] Array.from() and Array.of() try to build objects even if "this" is not a constructor
Modified: trunk/LayoutTests/TestExpectations (203102 => 203103)
--- trunk/LayoutTests/TestExpectations 2016-07-12 03:30:05 UTC (rev 203102)
+++ trunk/LayoutTests/TestExpectations 2016-07-12 04:03:43 UTC (rev 203103)
@@ -121,9 +121,6 @@
webkit.org/b/129057 media/controls-styling-strict.html [ Pass Failure ]
-# Skip this MathML test for now until it is rewritten to be more reliable.
-webkit.org/b/159558 mathml/presentation/fractions-positions.html [ Skip ]
-
# These tests will be rewritten, just skip them until that time.
webkit.org/b/148036 http/tests/inspector/css/ [ Skip ]
webkit.org/b/148036 http/tests/inspector/page/ [ Skip ]
Added: trunk/LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-1-expected.txt (0 => 203103)
--- trunk/LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-1-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-1-expected.txt 2016-07-12 04:03:43 UTC (rev 203103)
@@ -0,0 +1,8 @@
+−
+
+
+PASS Fraction axis is aligned on the math axis
+PASS Vertical positions of numerator and denominator
+PASS Horizontal alignments of numerator and denominator
+PASS Dimension of mfrac elements
+
Property changes on: trunk/LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-1-expected.txt
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: trunk/LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-1.html (0 => 203103)
--- trunk/LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-1.html (rev 0)
+++ trunk/LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-1.html 2016-07-12 04:03:43 UTC (rev 203103)
@@ -0,0 +1,126 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Fraction</title>
+<link rel="help" href=""
+<meta name="assert" content="Verify fraction metrics for different sizes of numerator and denominator.">
+<script src=""
+<script src=""
+<style>
+ math, mspace {
+ font-size: 10px;
+ }
+</style>
+<script>
+ /* This test does not use any specific fonts and so the exact rules are not
+ specified precisely. We assume reasonable values for numerator/denominator
+ shifts and spacing. */
+
+ function getBox(aId) {
+ var box = document.getElementById(aId).getBoundingClientRect();
+ box.middle = (box.bottom + box.top) / 2;
+ box.center = (box.left + box.right) / 2;
+ return box;
+ }
+
+ function getFractionAxis(aId) {
+ return (getBox(aId).top * den.height + getBox(aId).bottom * num.height) / (num.height + den.height);
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ test(function() {
+ var e = 3;
+ var mathAxis = getBox("axis").middle;
+ for (var i = 0; i < 10; i++) {
+ var frac = getBox("frac" + i);
+ var num = getBox("frac" + i + "num");
+ var den = getBox("frac" + i + "den");
+ // To estimate the fraction axis, we calculate barycenter between the
+ // top and bottom of the fraction, using the heights of numerator and
+ // denominator as weights.
+ var fracAxis = (frac.top * den.height + frac.bottom * num.height) / (num.height + den.height);
+ assert_approx_equals(fracAxis, mathAxis, e, "frac" + i + " fraction bar");
+ }
+ }, "Fraction axis is aligned on the math axis");
+
+ test(function() {
+ for (var i = 0; i < 10; i++) {
+ assert_less_than(getBox("frac" + i + "num").bottom, getBox("frac" + i + "den").top, "numerator is above denominator");
+ assert_less_than(getBox("frac" + i + "den").top - getBox("frac" + i + "num").bottom, 5, "The gap between numerator and denominator is not too large");
+ }
+ }, "Vertical positions of numerator and denominator");
+
+ test(function() {
+ var e = 3;
+ for (var i = 0; i < 10; i++)
+ assert_approx_equals(getBox("frac" + i + "num").center, getBox("frac" + i + "den").center, e, "numerator and denominator are horizontally centered");
+ }, "Horizontal alignments of numerator and denominator");
+
+ test(function() {
+ var e = 5;
+ for (var i = 0; i < 10; i++) {
+ var frac = getBox("frac" + i);
+ var num = getBox("frac" + i + "num");
+ var den = getBox("frac" + i + "den");
+ assert_approx_equals(frac.height, den.bottom - num.top, e, "height of frac " + i + " is determined by the bottom/top sides of the denominator/numerator");
+ assert_approx_equals(frac.width, Math.max(num.right, den.right) - Math.min(num.left, den.left), e, "width of frac " + i + " is determined by the left/right sides of the denominator/numerator (plus some spacing)");
+ }
+ }, "Dimension of mfrac elements");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <p>
+ <math>
+ <mo id="axis">−</mo>
+ <mfrac id="frac0">
+ <mspace id="frac0num" width="15px" height="15px" mathbackground="blue"/>
+ <mspace id="frac0den" width="15px" height="15px" mathbackground="green"/>
+ </mfrac>
+ <mfrac id="frac1">
+ <mspace id="frac1num" width="30px" height="15px" mathbackground="blue"/>
+ <mspace id="frac1den" width="15px" height="15px" mathbackground="green"/>
+ </mfrac>
+ <mfrac id="frac2">
+ <mspace id="frac2num" width="15px" height="15px" mathbackground="blue"/>
+ <mspace id="frac2den" width="30px" height="15px" mathbackground="green"/>
+ </mfrac>
+ <mfrac id="frac3">
+ <mspace id="frac3num" width="15px" height="30px" mathbackground="blue"/>
+ <mspace id="frac3den" width="15px" height="15px" mathbackground="green"/>
+ </mfrac>
+ <mfrac id="frac4">
+ <mspace id="frac4num" width="15px" height="15px" mathbackground="blue"/>
+ <mspace id="frac4den" width="15px" height="30px" mathbackground="green"/>
+ </mfrac>
+ <mfrac id="frac5" linethickness="0px">
+ <mspace id="frac5num" width="15px" height="15px" mathbackground="blue"/>
+ <mspace id="frac5den" width="15px" height="15px" mathbackground="green"/>
+ </mfrac>
+ <mfrac id="frac6" linethickness="0px">
+ <mspace id="frac6num" width="30px" height="15px" mathbackground="blue"/>
+ <mspace id="frac6den" width="15px" height="15px" mathbackground="green"/>
+ </mfrac>
+ <mfrac id="frac7" linethickness="0px">
+ <mspace id="frac7num" width="15px" height="15px" mathbackground="blue"/>
+ <mspace id="frac7den" width="30px" height="15px" mathbackground="green"/>
+ </mfrac>
+ <mfrac id="frac8" linethickness="0px">
+ <mspace id="frac8num" width="15px" height="30px" mathbackground="blue"/>
+ <mspace id="frac8den" width="15px" height="15px" mathbackground="green"/>
+ </mfrac>
+ <mfrac id="frac9" linethickness="0px">
+ <mspace id="frac9num" width="15px" height="15px" mathbackground="blue"/>
+ <mspace id="frac9den" width="15px" height="30px" mathbackground="green"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+</body>
+</html>
Property changes on: trunk/LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-1.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Deleted: trunk/LayoutTests/mathml/presentation/fractions-positions-expected.html (203102 => 203103)
--- trunk/LayoutTests/mathml/presentation/fractions-positions-expected.html 2016-07-12 03:30:05 UTC (rev 203102)
+++ trunk/LayoutTests/mathml/presentation/fractions-positions-expected.html 2016-07-12 04:03:43 UTC (rev 203103)
@@ -1,59 +0,0 @@
-<!doctype html>
-<html>
- <head>
- <title>fractions positions</title>
- <meta charset="utf-8"/>
- <style>
- math {
- padding: 0;
- border: 0;
- }
- td {
- border: 1px solid black;
- text-align: center; width: 8em; height: 8em;
- vertical-align: middle;
- }
- span {
- display: inline-block;
- background: black;
- border: 0;
- margin: 0;
- }
- </style>
- </head>
- <body>
-
- <table style="position: absolute; top: 10px; left: 10px;">
- <tr>
- <td>
- <math>
- <mfrac>
- <mtext><span style="width: 2em; height: 1em;"></span></mtext>
- <mtext><span style="width: 2em; height: 1em; background:blue;"></span></mtext>
- </mfrac>
- </math>
- </td>
- <td>
- <math>
- <mfrac>
- <mtext><span style="width: 2em; height: 1em; background:red;"></span></mtext>
- <mtext><span style="width: 2em; height: 1em;"></span></mtext>
- </mfrac>
- </math>
- </td>
- </tr>
- </table>
-
- <table style="position: absolute; top: 10px; left: 10px;">
- <tr>
- <td>
- <span style="width: 2em; height: 2em; margin-bottom: 2em;"></span>
- </td>
- <td>
- <span style="width: 2em; height: 2em; margin-top: 2em;"></span>
- </td>
- </tr>
- </table>
-
- </body>
-</html>
Deleted: trunk/LayoutTests/mathml/presentation/fractions-positions.html (203102 => 203103)
--- trunk/LayoutTests/mathml/presentation/fractions-positions.html 2016-07-12 03:30:05 UTC (rev 203102)
+++ trunk/LayoutTests/mathml/presentation/fractions-positions.html 2016-07-12 04:03:43 UTC (rev 203103)
@@ -1,62 +0,0 @@
-<!doctype html>
-<html>
- <head>
- <title>fractions positions</title>
- <meta charset="utf-8"/>
- <style>
- math {
- padding: 0;
- border: 0;
- }
- td {
- border: 1px solid black;
- text-align: center; width: 8em; height: 8em;
- vertical-align: middle;
- }
- span {
- display: inline-block;
- background: black;
- border: 0;
- margin: 0;
- }
- </style>
- </head>
- <body>
-
- <!-- This verifies the position of the numerator and denominator -->
- <table style="position: absolute; top: 10px; left: 10px;">
- <tr>
- <td>
- <math>
- <mfrac>
- <mtext><span style="width: 2em; height: 1em; background:red;"></span></mtext>
- <mtext><span style="width: 2em; height: 1em; background:blue;"></span></mtext>
- </mfrac>
- </math>
- </td>
- <td>
- <math>
- <mfrac>
- <mtext><span style="width: 2em; height: 1em; background:red;"></span></mtext>
- <mtext><span style="width: 2em; height: 1em; background:blue;"></span></mtext>
- </mfrac>
- </math>
- </td>
- </tr>
- </table>
-
- <table style="position: absolute; top: 10px; left: 10px;">
- <tr>
- <td>
- <!-- This should hide the numerator -->
- <span style="width: 2em; height: 2em; margin-bottom: 2em;"></span>
- </td>
- <td>
- <!-- This should hide the denumerator -->
- <span style="width: 2em; height: 2em; margin-top: 2em;"></span>
- </td>
- </tr>
- </table>
-
- </body>
-</html>