Replace reftest scripts-height.html with script tests
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jul 2016 14:29:25 +0000 (14:29 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jul 2016 14:29:25 +0000 (14:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=159423

We import a test from the MathML in HTML5 test suite to replace the test scripts-height.html
and make results more reliable, explicit and accurate. This avoids the failure on iOS.

Patch by Frederic Wang <fwang@igalia.com> on 2016-07-07
Reviewed by Martin Robinson.

* imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-4-expected.txt: Added.
* imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-4.html: Added.
* mathml/presentation/scripts-height.html: Removed.
* platform/ios-simulator/TestExpectations: Remove failure expectation.

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

LayoutTests/ChangeLog
LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-4-expected.txt [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-4.html [new file with mode: 0644]
LayoutTests/mathml/presentation/scripts-height.html [deleted file]
LayoutTests/platform/ios-simulator/TestExpectations

index 50ef635..697334f 100644 (file)
@@ -1,5 +1,20 @@
 2016-07-07  Frederic Wang  <fwang@igalia.com>
 
+        Replace reftest scripts-height.html with script tests
+        https://bugs.webkit.org/show_bug.cgi?id=159423
+
+        We import a test from the MathML in HTML5 test suite to replace the test scripts-height.html
+        and make results more reliable, explicit and accurate. This avoids the failure on iOS.
+
+        Reviewed by Martin Robinson.
+
+        * imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-4-expected.txt: Added.
+        * imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-4.html: Added.
+        * mathml/presentation/scripts-height.html: Removed.
+        * platform/ios-simulator/TestExpectations: Remove failure expectation.
+
+2016-07-07  Frederic Wang  <fwang@igalia.com>
+
         Replace multiscripts-positions.html reftest with script tests
         https://bugs.webkit.org/show_bug.cgi?id=159418
 
diff --git a/LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-4-expected.txt b/LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-4-expected.txt
new file mode 100644 (file)
index 0000000..72de8d6
--- /dev/null
@@ -0,0 +1,4 @@
+
+PASS Alignment on the baseline for bases of different heights 
+PASS Vertical position of the scripts for bases of different heights 
+
diff --git a/LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-4.html b/LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-4.html
new file mode 100644 (file)
index 0000000..14d474a
--- /dev/null
@@ -0,0 +1,124 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Subscripts and Superscripts metrics</title>
+<link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S3.html#SS4">
+<meta name="assert" content="Verify metrics of scripted elements for bases of different heights.">
+<script src="../../../../../resources/testharness.js"></script>
+<script src="../../../../../resources/testharnessreport.js"></script>
+<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 script shifts and
+  spacing. */
+
+  function getBox(aId) {
+    var box = document.getElementById(aId).getBoundingClientRect();
+    box.middle = (box.bottom + box.top) / 2;
+    return box;
+  }
+
+  setup({ explicit_done: true });
+  window.addEventListener("load", runTests);
+
+  var sizeArray = [50, 75, 100];
+
+  function runTests() {
+    test(function() {
+      var e = 1;
+      sizeArray.forEach(function(size) {
+         assert_approx_equals(getBox("msub" + size + "base").middle, getBox("baseline").bottom, e, "msub base " + size + "is placed on the baseline");
+         assert_approx_equals(getBox("msup" + size + "base").middle, getBox("baseline").bottom, e, "msup base " + size + "is placed on the baseline");
+         assert_approx_equals(getBox("msubsup" + size + "base").middle, getBox("baseline").bottom, e, "msubsup base " + size + "is placed on the baseline");
+         assert_approx_equals(getBox("multi" + size + "base").middle, getBox("baseline").bottom, e, "mmultiscripts base " + size + "is placed on the baseline");
+      });
+    }, "Alignment on the baseline for bases of different heights");
+
+    test(function() {
+      var e = 5;
+      sizeArray.forEach(function(size) {
+         assert_approx_equals(getBox("msub" + size + "sub").middle, getBox("msub" + size + "base").bottom, e, "msub script " + size + "is placed at the top of of the base");
+      });
+    }, "Vertical position of the scripts for bases of different heights");
+
+    done();
+  }
+</script>
+</head>
+<body>
+  <p>
+    <math>
+      <mspace id="baseline" width="30px" height="2px" depth="0px" mathbackground="blue"/>
+      <msub id="msub50">
+        <mspace id="msub50base" width="30px" height="50px" depth="50px" mathbackground="black"/>
+        <mspace id="msub50sub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+      </msub>
+      <msup id="msup50">
+        <mspace id="msup50base" width="30px" height="50px" depth="50px" mathbackground="black"/>
+        <mspace id="msup50sup" width="10px" height="5px" depth="5px" mathbackground="black"/>
+      </msup>
+      <msubsup id="msubsup50">
+        <mspace id="msubsup50base" width="30px" height="50px" depth="50px" mathbackground="black"/>
+        <mspace id="msubsup50sub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+        <mspace id="msubsup50sup" width="10px" height="5px" depth="5px" mathbackground="black"/>
+      </msubsup>
+      <mmultiscripts id="multi50">
+        <mspace id="multi50base" width="30px" height="50px" depth="50px" mathbackground="black"/>
+        <mspace id="multi50postsub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+        <mspace id="multi50postsup" width="10px" height="5px" depth="5px" mathbackground="black"/>
+        <mprescripts/>
+        <mspace id="multi50presub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+        <mspace id="multi50presub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+      </mmultiscripts>
+      <msub id="msub75">
+        <mspace id="msub75base" width="30px" height="75px" depth="75px" mathbackground="black"/>
+        <mspace id="msub75sub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+      </msub>
+      <msup id="msup75">
+        <mspace id="msup75base" width="30px" height="75px" depth="75px" mathbackground="black"/>
+        <mspace id="msup75sup" width="10px" height="5px" depth="5px" mathbackground="black"/>
+      </msup>
+      <msubsup id="msubsup75">
+        <mspace id="msubsup75base" width="30px" height="75px" depth="75px" mathbackground="black"/>
+        <mspace id="msubsup75sub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+        <mspace id="msubsup75sup" width="10px" height="5px" depth="5px" mathbackground="black"/>
+      </msubsup>
+      <mmultiscripts id="multi75">
+        <mspace id="multi75base" width="30px" height="75px" depth="75px" mathbackground="black"/>
+        <mspace id="multi75postsub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+        <mspace id="multi75postsup" width="10px" height="5px" depth="5px" mathbackground="black"/>
+        <mprescripts/>
+        <mspace id="multi75presub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+        <mspace id="multi75presub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+      </mmultiscripts>
+      <msub id="msub100">
+        <mspace id="msub100base" width="30px" height="100px" depth="100px" mathbackground="black"/>
+        <mspace id="msub100sub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+      </msub>
+      <msup id="msup100">
+        <mspace id="msup100base" width="30px" height="100px" depth="100px" mathbackground="black"/>
+        <mspace id="msup100sup" width="10px" height="5px" depth="5px" mathbackground="black"/>
+      </msup>
+      <msubsup id="msubsup100">
+        <mspace id="msubsup100base" width="30px" height="100px" depth="100px" mathbackground="black"/>
+        <mspace id="msubsup100sub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+        <mspace id="msubsup100sup" width="10px" height="5px" depth="5px" mathbackground="black"/>
+      </msubsup>
+      <mmultiscripts id="multi100">
+        <mspace id="multi100base" width="30px" height="100px" depth="100px" mathbackground="black"/>
+        <mspace id="multi100postsub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+        <mspace id="multi100postsup" width="10px" height="5px" depth="5px" mathbackground="black"/>
+        <mprescripts/>
+        <mspace id="multi100presub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+        <mspace id="multi100presub" width="10px" height="5px" depth="5px" mathbackground="black"/>
+      </mmultiscripts>
+    </math>
+  </p>
+  <hr/>
+</body>
+</html>
diff --git a/LayoutTests/mathml/presentation/scripts-height.html b/LayoutTests/mathml/presentation/scripts-height.html
deleted file mode 100644 (file)
index 901a316..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-<!doctype html>
-<html>
-  <head>
-    <title>scripts-height</title>
-    <meta charset="utf-8"/>
-    <style>
-      math {
-      padding: 0;
-      border: 0;
-      }
-      td {
-      border: 1px solid black;
-      text-align: center; width: 100px; height: 100px;
-      vertical-align: middle;
-      }
-      span {
-      display: inline-block;
-      background: black;
-      border: 0;
-      margin: 0;
-      padding: 0;
-      }
-    </style>
-  </head>
-  <body>
-
-    <!-- base with large height: the script are shifted to the top/bottom
-         of the cell and should be hidden by the black rectangles -->
-    <div style="position: absolute; top: 10px; left: 10px;">
-      <table>
-        <tr>
-          <td>
-            <math>
-              <msubsup>
-                <mspace height="40px" depth="40px"/>
-                <mspace width="10px" height="5px" depth="5px"
-                        mathbackground="red"/>
-                <mspace width="10px" height="5px" depth="5px"
-                        mathbackground="blue"/>
-              </msubsup>
-            </math>
-          </td>
-        </tr>
-      </table>
-    </div>
-    <div style="position: absolute; top: 10px; left: 10px;">
-      <table>
-        <tr>
-          <td style="vertical-align: top">
-            <span style="width: 20px; height: 20px;"></span>
-          </td>
-        </tr>
-      </table>
-    </div>
-    <div  style="position: absolute; top: 10px; left: 10px;">
-      <table>
-        <tr>
-          <td style="vertical-align: bottom">
-            <span style="width: 20px; height: 20px;"></span>
-          </td>
-        </tr>
-      </table>
-    </div>
-
-    <!-- scripts of different heights: they should all be aligned in the
-         middle of the cell -->
-    <div style="position: absolute; top: 10px; left: 120px;">
-      <table>
-        <tr>
-          <td style="width: 14em; height: 14em;">
-            <math>
-              <mspace height="7em" depth="7em"/>
-              <mspace width="10px" height="1em" depth="1em" mathbackground="red"/>
-              <msubsup>
-                <mspace width="10px" height="1em" depth="1em" mathbackground="green"/>
-                <mspace height="4em"/>
-                <mspace height="1em"/>
-              </msubsup>
-              <msubsup>
-                <mspace width="10px" height="1em" depth="1em" mathbackground="blue"/>
-                <mspace height="1em"/>
-                <mspace height="4em"/>
-              </msubsup>
-              <msubsup>
-                <mspace width="10px" height="1em" depth="1em" mathbackground="yellow"/>
-                <mspace height="4em"/>
-                <mspace height="4em"/>
-              </msubsup>
-            </math>
-          </td>
-        </tr>
-      </table>
-    </div>
-    
-  </body>
-</html>
index be1a1ec..3a0ef47 100644 (file)
@@ -675,9 +675,6 @@ mathml/opentype/large-operators-italic-correction.html [ Skip ]
 mathml/presentation/attributes-mathvariant.html [ Skip ]
 mathml/presentation/tokenElements-mathvariant.html [ Skip ]
 
-# MathML tests that fail:
-mathml/presentation/scripts-height.html [ ImageOnlyFailure ]
-
 # <rdar://problem/19215305> ASSERT(m_cgFont.get()) fails in FontPlatformData::ctFont()
 svg/text/svg-fallback-font-crash.html
 svg/css/font-face-variant-crash.html