[MathML] Import WPT test to replace mathml/opentype/large-operators-italic-correction...
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Mar 2018 11:31:47 +0000 (11:31 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Mar 2018 11:31:47 +0000 (11:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=183891

Patch by Frederic Wang <fwang@igalia.com> on 2018-03-22
Reviewed by Manuel Rego Casasnovas.

LayoutTests/imported/w3c:

Import WPT test added in https://github.com/w3c/web-platform-tests/pull/9993.

* web-platform-tests/fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff: Added.
* web-platform-tests/fonts/math/w3c-import.log:
* web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2-expected.txt: Added.
* web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2.html: Added.
* web-platform-tests/mathml/presentation-markup/scripts/w3c-import.log:
* web-platform-tests/mathml/tools/largeop.py:

LayoutTests:

Remove large-operators-italic-correction.html. Italic correction is tested more completely by
a new WPT test that does not require Latin Modern Math to be installed on the try bots.

* mathml/opentype/large-operators-italic-correction-expected.txt: Removed.
* mathml/opentype/large-operators-italic-correction.html: Removed.
* platform/ios/TestExpectations: Remove test expectation.
* platform/mac/TestExpectations: Ditto.
* platform/win/TestExpectations: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229847 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
LayoutTests/ChangeLog
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/fonts/math/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/mathml/tools/largeop.py
LayoutTests/mathml/opentype/large-operators-italic-correction-expected.txt [deleted file]
LayoutTests/mathml/opentype/large-operators-italic-correction.html [deleted file]
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/win/TestExpectations

index ad57c84..00de41a 100644 (file)
@@ -1,3 +1,19 @@
+2018-03-22  Frederic Wang  <fwang@igalia.com>
+
+        [MathML] Import WPT test to replace mathml/opentype/large-operators-italic-correction.html
+        https://bugs.webkit.org/show_bug.cgi?id=183891
+
+        Reviewed by Manuel Rego Casasnovas.
+
+        Remove large-operators-italic-correction.html. Italic correction is tested more completely by
+        a new WPT test that does not require Latin Modern Math to be installed on the try bots.
+
+        * mathml/opentype/large-operators-italic-correction-expected.txt: Removed.
+        * mathml/opentype/large-operators-italic-correction.html: Removed.
+        * platform/ios/TestExpectations: Remove test expectation.
+        * platform/mac/TestExpectations: Ditto.
+        * platform/win/TestExpectations: Ditto.
+
 2018-03-21  Chris Dumez  <cdumez@apple.com>
 
         Regression(r229831): fast/loader/javascript-url-iframe-remove-on-navigate-async-delegate.html is flaky
index c7fffdd..e18c144 100644 (file)
@@ -1,3 +1,19 @@
+2018-03-22  Frederic Wang  <fwang@igalia.com>
+
+        [MathML] Import WPT test to replace mathml/opentype/large-operators-italic-correction.html
+        https://bugs.webkit.org/show_bug.cgi?id=183891
+
+        Reviewed by Manuel Rego Casasnovas.
+
+        Import WPT test added in https://github.com/w3c/web-platform-tests/pull/9993.
+
+        * web-platform-tests/fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff: Added.
+        * web-platform-tests/fonts/math/w3c-import.log:
+        * web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2-expected.txt: Added.
+        * web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2.html: Added.
+        * web-platform-tests/mathml/presentation-markup/scripts/w3c-import.log:
+        * web-platform-tests/mathml/tools/largeop.py:
+
 2018-03-20  Antoine Quint  <graouts@apple.com>
 
         [Web Animations] Update the timing model when pending tasks schedule changes
diff --git a/LayoutTests/imported/w3c/web-platform-tests/fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff b/LayoutTests/imported/w3c/web-platform-tests/fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff
new file mode 100644 (file)
index 0000000..0b4f8bf
Binary files /dev/null and b/LayoutTests/imported/w3c/web-platform-tests/fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff differ
index 110f220..472eb82 100644 (file)
@@ -25,6 +25,7 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/fonts/math/fraction-numeratorgapmin9000-rulethickness1000.woff
 /LayoutTests/imported/w3c/web-platform-tests/fonts/math/fraction-numeratorshiftup11000-rulethickness1000.woff
 /LayoutTests/imported/w3c/web-platform-tests/fonts/math/fraction-rulethickness10000.woff
+/LayoutTests/imported/w3c/web-platform-tests/fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff
 /LayoutTests/imported/w3c/web-platform-tests/fonts/math/largeop-displayoperatorminheight5000.woff
 /LayoutTests/imported/w3c/web-platform-tests/fonts/math/limits-lowerlimitbaselinedropmin3000.woff
 /LayoutTests/imported/w3c/web-platform-tests/fonts/math/limits-lowerlimitgapmin11000.woff
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2-expected.txt
new file mode 100644 (file)
index 0000000..459484e
--- /dev/null
@@ -0,0 +1,23 @@
+
+PASS Null Italic Correction 
+PASS NonNull Italic Correction 
+Null Italic Correction
+
+⫿
+⫿
+⫿
+⫿
+
+NonNull Italic Correction
+
+⫿
+⫿
+⫿
+⫿
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2.html b/LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2.html
new file mode 100644 (file)
index 0000000..eaa4f0f
--- /dev/null
@@ -0,0 +1,132 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Subscripts and Superscripts parameters</title>
+<link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S3.html#SS4">
+<meta name="assert" content="Elements msub, msup, subsup and msubsup correctly use the italic correction from the MATH table.">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+  math, mspace {
+    font-size: 10px;
+  }
+  @font-face {
+    font-family: largeop-displayoperatorminheight5000;
+    src: url("/fonts/math/largeop-displayoperatorminheight5000.woff");
+  }
+  @font-face {
+    font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;
+    src: url("/fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff");
+  }
+</style>
+<script>
+  function getBox(aId) {
+    return document.getElementById(aId).getBoundingClientRect();
+  }
+
+  setup({ explicit_done: true });
+  window.addEventListener("load", function() {
+    // Delay the check to workaround WebKit's bug https://webkit.org/b/174030.
+    requestAnimationFrame(() => { document.fonts.ready.then(runTests); });
+  });
+
+  /*
+    These two tests verify that:
+    - In msub, the script is at the right of the base minus the italic correction.
+    - In msup, the script is just at the right of the base.
+    - In msubsup, the scripts are shifted by the italic correction.
+    - In mmultiscripts, postscript pairs are shifted by the italic correction.
+    - In mmultiscripts, prescript pairs are vertically aligned.
+  */
+  var epsilon = 1;
+  function runTests() {
+    test(function() {
+      var v = 0;
+      assert_approx_equals(getBox("base001").right - getBox("sub001").left, v, epsilon, "msub");
+      assert_approx_equals(getBox("sup002").left, getBox("base002").right, epsilon, "msup");
+      assert_approx_equals(getBox("sup003").left - getBox("sub003").left, v, epsilon, "msubsup");
+      assert_approx_equals(getBox("sup004").left - getBox("sub004").left, v, epsilon, "mmultiscripts postscripts");
+      assert_approx_equals(getBox("sup005").left - getBox("sub005").left, 0, epsilon, "mmultiscripts prescripts");
+    }, "Null Italic Correction");
+    test(function() {
+      var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+      var v = 3000 * emToPx;
+      assert_approx_equals(getBox("base011").right - getBox("sub011").left, v, epsilon, "msub");
+      assert_approx_equals(getBox("sup012").left, getBox("base012").right, epsilon, "msup");
+      assert_approx_equals(getBox("sup013").left - getBox("sub013").left, v, epsilon, "msubsup");
+      assert_approx_equals(getBox("sup014").left - getBox("sub014").left, v, epsilon, "mmultiscripts postscripts");
+      assert_approx_equals(getBox("sup015").left - getBox("sub015").left, 0, epsilon, "mmultiscripts prescripts");
+    }, "NonNull Italic Correction");
+    done();
+  }
+</script>
+</head>
+<body>
+  <div id="log"></div>
+  <h2>Null Italic Correction</h2>
+  <p>
+    <math displaystyle="true" style="font-family: largeop-displayoperatorminheight5000;">
+      <msub>
+        <mo id="base001" lspace="0px" rspace="0px">&#x2AFF;</mo>
+        <mspace id="sub001" height="1em" width="1em" mathbackground="blue"/>
+      </msub>
+    </math>
+    <math displaystyle="true" style="font-family: largeop-displayoperatorminheight5000;">
+      <msup>
+        <mo id="base002" lspace="0px" rspace="0px">&#x2AFF;</mo>
+        <mspace id="sup002" height="1em" width="1em" mathbackground="blue"/>
+      </msup>
+    </math>
+    <math displaystyle="true" style="font-family: largeop-displayoperatorminheight5000;">
+      <msubsup>
+        <mo lspace="0px" rspace="0px">&#x2AFF;</mo>
+        <mspace id="sub003" height="1em" width="1em" mathbackground="blue"/>
+        <mspace id="sup003" height="1em" width="1em" mathbackground="green"/>
+      </msubsup>
+    </math>
+    <math displaystyle="true" style="font-family: largeop-displayoperatorminheight5000;">
+      <mmultiscripts>
+        <mo lspace="0px" rspace="0px">&#x2AFF;</mo>
+        <mspace id="sub004" height="1em" width="1em" mathbackground="blue"/>
+        <mspace id="sup004" height="1em" width="1em" mathbackground="green"/>
+        <mprescripts/>
+        <mspace id="sub005" height="1em" width="1em" mathbackground="magenta"/>
+        <mspace id="sup005" height="1em" width="1em" mathbackground="cyan"/>
+      </mmultiscripts>
+    </math>
+  </p>
+  <h2>NonNull Italic Correction</h2>
+  <p>
+    <math displaystyle="true" style="font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;">
+      <msub>
+        <mo id="base011" lspace="0px" rspace="0px">&#x2AFF;</mo>
+        <mspace id="sub011" height="1em" width="1em" mathbackground="blue"/>
+      </msub>
+    </math>
+    <math displaystyle="true" style="font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;">
+      <msup>
+        <mo id="base012" lspace="0px" rspace="0px">&#x2AFF;</mo>
+        <mspace id="sup012" height="1em" width="1em" mathbackground="blue"/>
+      </msup>
+    </math>
+    <math displaystyle="true" style="font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;">
+      <msubsup>
+        <mo lspace="0px" rspace="0px">&#x2AFF;</mo>
+        <mspace id="sub013" height="1em" width="1em" mathbackground="blue"/>
+        <mspace id="sup013" height="1em" width="1em" mathbackground="green"/>
+      </msubsup>
+    </math>
+    <math displaystyle="true" style="font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;">
+      <mmultiscripts>
+        <mo lspace="0px" rspace="0px">&#x2AFF;</mo>
+        <mspace id="sub014" height="1em" width="1em" mathbackground="blue"/>
+        <mspace id="sup014" height="1em" width="1em" mathbackground="green"/>
+        <mprescripts/>
+        <mspace id="sub015" height="1em" width="1em" mathbackground="magenta"/>
+        <mspace id="sup015" height="1em" width="1em" mathbackground="cyan"/>
+      </mmultiscripts>
+    </math>
+  </p>
+</body>
+</html>
index 818e702..0c2ad6c 100644 (file)
@@ -20,6 +20,7 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/subsup-4.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/subsup-5.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-1.html
+/LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/underover-1.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/underover-parameters-1.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/underover-parameters-2.html
index 3c9c6c4..73d9676 100644 (file)
@@ -12,3 +12,21 @@ g = f.createChar(-1, "uni2AFF.display")
 mathfont.drawRectangleGlyph(g, mathfont.em, v1, 0)
 f[nAryWhiteVerticalBarCodePoint].verticalVariants = "uni2AFF uni2AFF.display"
 mathfont.save(f)
+
+v1 = 2 * mathfont.em
+v2 = 3 * mathfont.em
+f = mathfont.create("largeop-displayoperatorminheight%d-2AFF-italiccorrection%d" % (v1, v2))
+f.copyright = "Copyright (c) 2018 Igalia S.L."
+f.math.DisplayOperatorMinHeight = v1
+mathfont.createSquareGlyph(f, nAryWhiteVerticalBarCodePoint)
+g = f.createChar(-1, "uni2AFF.display")
+p = g.glyphPen()
+p.moveTo(0, 0)
+p.lineTo(v2, v1)
+p.lineTo(v2 + mathfont.em, v1)
+p.lineTo(mathfont.em, 0)
+p.closePath();
+g.width = mathfont.em + v2
+g.italicCorrection = v2
+f[nAryWhiteVerticalBarCodePoint].verticalVariants = "uni2AFF uni2AFF.display"
+mathfont.save(f)
diff --git a/LayoutTests/mathml/opentype/large-operators-italic-correction-expected.txt b/LayoutTests/mathml/opentype/large-operators-italic-correction-expected.txt
deleted file mode 100644 (file)
index 9e48ab0..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-This test passes if the difference of horizontal positions between the subscript and superscript corresponds to the italic correction of the integral operator.
-
-∫
-
-PASS Large Operators Italic Correction 
-
diff --git a/LayoutTests/mathml/opentype/large-operators-italic-correction.html b/LayoutTests/mathml/opentype/large-operators-italic-correction.html
deleted file mode 100644 (file)
index 6218463..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Large Operators Italic Correction</title>
-    <meta charset="utf-8">
-    <script src="../../resources/testharness.js"></script>
-    <script src="../../resources/testharnessreport.js"></script>
-    <style type="text/css">
-      /* This test requires the Latin Modern Math font, which satisfies:
-         italic correction of ∫ = 591
-         em = 1000
-         so the actual italic correction will be 591 * 64 / 1000;
-       */
-      math {
-        font-family: "Latin Modern Math";
-        font-size: 64px;
-      }
-    </style>
-    <script type="text/javascript">
-      var epsilon = 1;
-      setup({ "explicit_done": true });
-      function run() {
-        assert_approx_equals(document.getElementById("sup").getBoundingClientRect().left - document.getElementById("sub").getBoundingClientRect().left, 591 * 64 / 1000, epsilon);
-        done();
-      }
-    </script>
-  </head>
-  <body onload="run()">
-
-    <p>This test passes if the difference of horizontal positions between the
-      subscript and superscript corresponds to the italic correction of the
-      integral operator.</p>
-
-    <math display="block">
-      <msubsup>
-        <mo>∫</mo>
-        <mspace id="sub" width="10px" height="10px" mathbackground="red"/>
-        <mspace id="sup" width="10px" height="10px" mathbackground="green"/>
-      </msubsup>
-    </math>
-  </body>
-</html>
index 0869304..caf4a32 100644 (file)
@@ -1373,8 +1373,7 @@ webkit.org/b/160161 mathml/opentype/large-operators.html [ Skip ]
 webkit.org/b/160161 mathml/opentype/horizontal.html [ Skip ]
 webkit.org/b/160161 mathml/opentype/horizontal-munderover.html [ Skip ]
 
-# These tests require the Latin Modern Math font.
-webkit.org/b/160161 mathml/opentype/large-operators-italic-correction.html [ Skip ]
+# This test requires the Latin Modern Math font.
 webkit.org/b/160161 mathml/presentation/bug159513.html [ Skip ]
 
 # This test fails because the USE_TYPO_METRICS flag is ignored for non-math font
index e096313..a9028a4 100644 (file)
@@ -678,8 +678,7 @@ webkit.org/b/160161 mathml/opentype/large-operators.html [ Skip ]
 webkit.org/b/160161 mathml/opentype/horizontal.html [ Skip ]
 webkit.org/b/160161 mathml/opentype/horizontal-munderover.html [ Skip ]
 
-# These tests require the Latin Modern Math font.
-webkit.org/b/160161 mathml/opentype/large-operators-italic-correction.html [ Skip ]
+# This test requires the Latin Modern Math font.
 webkit.org/b/160161 mathml/presentation/bug159513.html [ Skip ]
 
 # These tests use key navigation to test MathML links but do not seem to work on Mac.
index c41279f..aa6db31 100644 (file)
@@ -1958,9 +1958,6 @@ mathml/presentation/href-style.html [ ImageOnlyFailure ]
 mathml/presentation/mathvariant-inheritance.html  [ ImageOnlyFailure ]
 mathml/presentation/mathvariant-tokens.html [ ImageOnlyFailure ]
 mathml/presentation/tokenElements-mathvariant.html [ ImageOnlyFailure ]
-
-# These tests require the Latin Modern Math font.
-mathml/opentype/large-operators-italic-correction.html [ Skip ]
 ################################################################################
 #################          End MathML Issues                ####################
 ################################################################################