Bug 1642656 [wpt PR 23915] - Add a test to check edge cases of radical kerning., a=testonly draft
authorFrédéric Wang <fwang@igalia.com>
Mon, 08 Jun 2020 20:06:02 +0000
changeset 2968280 80acb57fed1624e635286fe2b17fa3603a9c2124
parent 2968279 6d80deb227c109c90690849052545dd488b092fa
child 2968281 3a26739e6628e6614299509c1308bccac1f6e652
push id550671
push userreviewbot
push dateMon, 08 Jun 2020 20:06:41 +0000
treeherdertry@000ed010e51c [default view] [failures only]
reviewerstestonly
bugs1642656, 23915
milestone79.0a1
Bug 1642656 [wpt PR 23915] - Add a test to check edge cases of radical kerning., a=testonly Automatic update from web-platform-tests Add a test to check edge cases of radical kerning. (#23915) https://github.com/mathml-refresh/mathml/issues/213 -- wpt-commits: 0546635a0f399f57b0f26d804926c2ca5049e376 wpt-pr: 23915 Differential Diff: PHID-DIFF-kb2otypk7zjicl53ywfy
testing/web-platform/tests/fonts/math/radical-negativekernbeforedegree1000-rulethickness1000.woff
testing/web-platform/tests/mathml/presentation-markup/radicals/root-parameters-2.html
testing/web-platform/tests/mathml/tools/radicals.py
new file mode 100644
index 0000000000000000000000000000000000000000..ef00335b1cbedcafa934dcab1fae9fe2e17715fa
GIT binary patch
literal 1380
zc${sNdsNbA7{}iqKLk9WVw(F|ilo)LfC6G_s|K0BC5l=j?P3B3=uFL%oiuGuKvNJG
zXemxBS8Uz3vf8F;p24)zDQa0KY}MSVvvkXqnwREfKb_lOd(Qd1=Y78KbDsBkubELO
z8YL1%0bnNsWPlmj6+qyBEd)jB0Kf+TfL3BO8H3$^Mp2Ov0DKKLya>ZX7Z`g%$QNzK
zv>TXTj>Tz%m(t`>ANp~yejKLpFeEMr2frs(nvUf|W>aHhf=w%ad6FcT%CJ5O(|j@3
zAk(VgBuvD#p!qqLlGek&C#4?9!fF;_K6MsiHvp;9EG!>1s}bfPM1wSGsvOg*F><h)
zYFFaHq4a$j*c#y3THG+`Ge>}bR`ni<Od<gZb%zaQuP4`t-RmpGAQVZPGSnAD_<!F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Cf@((C+*kVgqRgr*FNy$dGm?jdn>Kz-wt9zIbHu
z=GQoo!KvB`!2CJLfNJmP1u=i*>-QJbNw`2*K(ze#2Ky4S%;#=X&64KqLM1mHC)m5-
z^Mi|Ec#ntkfR3JQ;p$3c1Z|Mc!LGxPKH_CxPbI1my$HIilWg!oP7jIljD`FnzKZX7
z_9A_iJ2Hv<fEe=_P))LDeLV#x!!E<&1jT4Eh4JV;_w5t!c=t=efCRe!X%4Z~(BWqk
Y*NQ<qo6n}=!1)%JPV8rS@elvn-^KI?;{X5v
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/mathml/presentation-markup/radicals/root-parameters-2.html
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Radical parameters</title>
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#radicals-msqrt-mroot">
+<meta name="assert" content="Test edge kerning values for radicals.">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/mathml/support/feature-detection.js"></script>
+<style>
+  @font-face {
+      font-family: radical-negativekernbeforedegree1000-rulethickness1000;
+      src: url("/fonts/math/radical-negativekernbeforedegree1000-rulethickness1000.woff");
+  }
+  @font-face {
+      font-family: radical-kernafterdegreeminus5000-rulethickness1000;
+      src: url("/fonts/math/radical-kernafterdegreeminus5000-rulethickness1000.woff");
+  }
+  math, mspace {
+      font-size: 10px;
+  }
+  mspace {
+      opacity: .5;
+  }
+</style>
+<script>
+  var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+  var epsilon = 1;
+
+  function getBox(aId) {
+    return document.getElementById(aId).getBoundingClientRect();
+  }
+
+  function runTests() {
+      test(function() {
+          assert_true(MathMLFeatureDetection.has_mspace());
+          assert_approx_equals(getBox("index001").left - getBox("mroot001").left,
+                               0, epsilon, "should be clamped to 0");
+      }, "RadicalKernBeforeDegree = -1em < 0");
+
+      test(function() {
+          assert_true(MathMLFeatureDetection.has_mspace());
+          var radicalSymbolWidth = 1000 * emToPx;
+          var radicalLeft = getBox("base002").left - radicalSymbolWidth;
+          assert_approx_equals(getBox("index002").right - radicalLeft,
+                               30, epsilon, "should be clamped to 3em");
+      }, "RadicalKernBeforeAfterDegree = -5em < -3em = -degree's inline size");
+
+      done();
+  }
+
+  setup({ explicit_done: true });
+  window.addEventListener("load", () => { document.fonts.ready.then(runTests); });
+
+</script>
+</head>
+<body>
+  <div id="log"></div>
+  <p>
+    <math style="font-family: radical-negativekernbeforedegree1000-rulethickness1000">
+      <mroot id="mroot001">
+        <mspace id="base001" height="6em" width="6em" style="background: blue"/>
+        <mspace id="index001" height="6em" width="6em" style="background: green"/>
+      </mroot>
+    </math>
+  </p>
+  <hr/>
+  <p>
+    <math style="font-family: radical-kernafterdegreeminus5000-rulethickness1000">
+      <mroot id="mroot002">
+        <mspace id="base002" height="3em" width="3em" style="background: blue"/>
+        <mspace id="index002" height="3em" width="3em" style="background: green"/>
+      </mroot>
+    </math>
+  </p>
+</body>
+</html>
--- a/testing/web-platform/tests/mathml/tools/radicals.py
+++ b/testing/web-platform/tests/mathml/tools/radicals.py
@@ -110,8 +110,21 @@ createStretchyRadical(f)
 f.math.RadicalDegreeBottomRaisePercent = 0
 f.math.RadicalDisplayStyleVerticalGap = 0
 f.math.RadicalExtraAscender = 0
 f.math.RadicalKernAfterDegree = 0
 f.math.RadicalKernBeforeDegree = 0
 f.math.RadicalRuleThickness = v2
 f.math.RadicalVerticalGap = v1
 mathfont.save(f)
+
+v1 = 1 * mathfont.em
+v2 = 1 * mathfont.em
+f = mathfont.create("radical-negativekernbeforedegree%d-rulethickness%d" % (v1, v2), "Copyright (c) 2020 Igalia S.L.")
+createStretchyRadical(f)
+f.math.RadicalDegreeBottomRaisePercent = 0
+f.math.RadicalDisplayStyleVerticalGap = 0
+f.math.RadicalExtraAscender = 0
+f.math.RadicalKernAfterDegree = 0
+f.math.RadicalKernBeforeDegree = -v1
+f.math.RadicalRuleThickness = v2
+f.math.RadicalVerticalGap = 0
+mathfont.save(f)