DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (6863f516ba38)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Stack parameters</title>
<link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S3.html#SS3.SSS2">
<meta name="assert" content="Element mfrac correctly uses the stack parameters from the MATH table.">
<!-- Copyright 2016 MathML Association
     Licensed under 3-Clause BSD-License -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
  math, mspace {
    font-size: 10px;
  }
  @font-face {
    font-family: axisheight7000;
    src: url("fonts/stack-axisheight7000.woff");
  }
  @font-face {
    font-family: bottomdisplaystyleshiftdown5000;
    src: url("fonts/stack-bottomdisplaystyleshiftdown5000.woff");
  }
  @font-face {
    font-family: bottomshiftdown6000;
    src: url("fonts/stack-bottomshiftdown6000.woff");
  }
  @font-face {
    font-family: displaystylegapmin4000;
    src: url("fonts/stack-displaystylegapmin4000.woff");
  }
  @font-face {
    font-family: gapmin8000;
    src: url("fonts/stack-gapmin8000.woff");
  }
  @font-face {
    font-family: topdisplaystyleshiftup3000;
    src: url("fonts/stack-topdisplaystyleshiftup3000.woff");
  }
  @font-face {
    font-family: topshiftup9000;
    src: url("fonts/stack-topshiftup9000.woff");
  }
</style>
<script>
  var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
  var epsilon = 1;

  function getBox(aId) {
    return document.getElementById(aId).getBoundingClientRect();
  }

  var test_loaded = async_test("Page Loaded");
  window.addEventListener("load", function() {
    // FIXME: Use an API to wait for the Web fonts to arrive.
    window.setTimeout(runTests, 250);
  });

  function runTests() {
    test(function() {
      var v = 7000 * emToPx;
      assert_approx_equals(getBox("ref0001").top - getBox("num0001").bottom,
                           v, epsilon, "mfrac: axis height");
    }, "AxisHeight");

    test(function() {
      var v = 5000 * emToPx;
      assert_approx_equals(getBox("den0002").top - getBox("ref0002").bottom,
                           v, epsilon, "mfrac: denominator shift");
    }, "BottomDisplayStyleShiftDown");

    test(function() {
      var v = 6000 * emToPx;
      assert_approx_equals(getBox("den0003").top - getBox("ref0003").bottom,
                           v, epsilon, "mfrac: denominator shift");
    }, "BottomShiftDown");

    test(function() {
      var v = 4000 * emToPx;
      assert_approx_equals(getBox("den0004").top - getBox("num0004").bottom,
                           v, epsilon, "mfrac: gap");
    }, "DisplayStyleGapMin");

    test(function() {
      var v = 8000 * emToPx;
      assert_approx_equals(getBox("den0005").top - getBox("num0005").bottom,
                           v, epsilon, "mfrac: gap");
    }, "GapMin");

    test(function() {
      var v = 3000 * emToPx;
      assert_approx_equals(getBox("ref0006").top - getBox("num0006").bottom,
                           v, epsilon, "mfrac: numerator shift");
    }, "TopDisplayStyleShiftUp");

    test(function() {
      var v = 9000 * emToPx;
      assert_approx_equals(getBox("ref0007").top - getBox("num0007").bottom,
                           v, epsilon, "mfrac: numerator shift");
    }, "ToShiftUp");

    test_loaded.done();
  }
</script>
</head>
<body>
  <p>
    <math style="font-family: axisheight7000;">
      <mspace id="ref0001" depth="1em" width="3em" mathbackground="green"/>
      <mfrac linethickness="0px">
        <mspace width="3em" height="1em" id="num0001" mathbackground="blue"/>
        <mspace width="3em"/>
      </mfrac>
    </math>
  </p>
  <hr/>
  <p>
    <math display="block" style="font-family: bottomdisplaystyleshiftdown5000;">
      <mspace id="ref0002" width="3em" height="1em" mathbackground="green"/>
      <mfrac linethickness="0px">
        <mspace width="3em"/>
        <mspace width="3em" depth="1em" id="den0002" mathbackground="blue"/>
      </mfrac>
    </math>
  </p>
  <hr/>
  <p>
    <math style="font-family: bottomshiftdown6000;">
      <mspace id="ref0003" width="3em" height="1em" mathbackground="green"/>
      <mfrac linethickness="0px">
        <mspace width="3em"/>
        <mspace width="3em" depth="1em" id="den0003" mathbackground="blue"/>
      </mfrac>
    </math>
  </p>
  <hr/>
  <p>
    <math display="block" style="font-family: displaystylegapmin4000;">
      <mfrac linethickness="0px">
        <mspace width="3em" height="1em" id="num0004" mathbackground="blue"/>
        <mspace width="3em" depth="1em" id="den0004" mathbackground="green"/>
      </mfrac>
    </math>
  </p>
  <hr/>
  <p>
    <math style="font-family: gapmin8000;">
      <mfrac linethickness="0px">
        <mspace width="3em" height="1em" id="num0005" mathbackground="blue"/>
        <mspace width="3em" depth="1em" id="den0005" mathbackground="green"/>
      </mfrac>
    </math>
  </p>
  <hr/>
  <p>
    <math display="block" style="font-family: topdisplaystyleshiftup3000;">
      <mspace id="ref0006" width="3em" depth="1em" mathbackground="green"/>
      <mfrac linethickness="0px">
        <mspace width="3em" height="1em" id="num0006" mathbackground="blue"/>
        <mspace width="3em"/>
      </mfrac>
    </math>
  </p>
  <hr/>
  <p>
    <math style="font-family: topshiftup9000;">
      <mspace id="ref0007" width="3em" depth="1em" mathbackground="green"/>
      <mfrac linethickness="0px">
        <mspace width="3em" height="1em" id="num0007" mathbackground="blue"/>
        <mspace width="3em"/>
      </mfrac>
    </math>
  </p>
  <hr/>
</body>
</html>