summaryrefslogtreecommitdiffstats
path: root/layout/mathml/tests/test_opentype-limits.html
blob: 596838789c723c86a260209b0b70002f4f71d8ba (plain)
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
<!doctype html>
<html>
  <head>
    <title>Open Type MATH - limits</title>
    <script type="application/javascript"
            src="/tests/SimpleTest/SimpleTest.js"></script>
    <script type="application/javascript"
            src="/tests/SimpleTest/EventUtils.js"></script>
    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    <meta charset="utf-8"/>
    <style type="text/css">
      math {
        font-size: 10px;
      }
      @font-face {
        font-family: limits-1;
        src: url(/tests/fonts/math/limits-1.otf);
      }
      @font-face {
        font-family: limits-2;
        src: url(/tests/fonts/math/limits-2.otf);
      }
      @font-face {
        font-family: limits-3;
        src: url(/tests/fonts/math/limits-3.otf);
      }
      @font-face {
        font-family: limits-4;
        src: url(/tests/fonts/math/limits-4.otf);
      }
      @font-face {
        font-family: limits-5;
        src: url(/tests/fonts/math/limits-5.otf);
      }
    </style>
    <script type="text/javascript">
      SimpleTest.waitForExplicitFinish();

      var epsilon = 5;
      function almostEqual(x, y) { return Math.abs(x - y) < epsilon; }

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

      function doTest() {
        ok(almostEqual(getBox("base1").top - getBox("over1").bottom, 7 * 10) &&
           almostEqual(getBox("base2").top - getBox("over2").bottom, 7 * 10),
           "Bad UpperLimitGapMin");

        ok(almostEqual(getBox("under3").top - getBox("base3").bottom, 5 * 10) &&
           almostEqual(getBox("under4").top - getBox("base4").bottom, 5 * 10),
           "Bad LowerLimitGapMin");

        ok(almostEqual(getBox("ref3").top - getBox("over5").bottom, 9 * 10) &&
           almostEqual(getBox("ref3").top - getBox("over6").bottom, 9 * 10),
           "UpperLimitBaselineRiseMin");

        ok(almostEqual(getBox("under7").top - getBox("ref4").bottom, 2 * 10) &&
           almostEqual(getBox("under8").top - getBox("ref4").bottom, 2 * 10),
           "LowerLimitBaselineDropMin");

        ok(almostEqual(getBox("base9").top - getBox("over9").bottom,
                       (6 - 2) * 10) &&
           almostEqual(getBox("base10").top - getBox("over10").bottom,
                       (6 - 2) * 10),
           "Bad AccentBaseHeight");

        SimpleTest.finish();
      }
    </script>
  </head>
  <body onload="doTest()">

    <a target="_blank"
       href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365">
      Mozilla Bug 961365
    </a>

    <p id="display"></p>

    <p>
      <math style="font-family: limits-1;" displaystyle="true">
        <mover>
          <mo id="base1">∑</mo>
          <mspace id="over1" height="1em" width="1em" mathbackground="red"/>
        </mover>
      </math>
      <math style="font-family: limits-1;" displaystyle="true">
        <munderover>
          <mo id="base2">∑</mo>
          <mspace id="under2" height="1em" width="1em" mathbackground="red"/>
          <mspace id="over2" height="1em" width="1em" mathbackground="red"/>
        </munderover>
      </math>
    </p>

    <p>
      <math style="font-family: limits-2;" displaystyle="true">
        <munder>
          <mo id="base3">∑</mo>
          <mspace id="under3" height="1em" width="1em" mathbackground="red"/>
        </munder>
      </math>
      <math style="font-family: limits-2;" displaystyle="true">
        <munderover>
          <mo id="base4">∑</mo>
          <mspace id="under4" height="1em" width="1em" mathbackground="red"/>
          <mspace id="over4" height="1em" width="1em" mathbackground="red"/>
        </munderover>
      </math>
    </p>

    <p>
      <math style="font-family: limits-3;" displaystyle="true">
        <mspace id="ref3" height="1em" width="1em" mathbackground="green"/>
      </math>
      <math style="font-family: limits-3;" displaystyle="true">
        <mover>
          <mo id="base5">∑</mo>
          <mspace id="over5" height="1em" width="1em" mathbackground="red"/>
        </mover>
      </math>
      <math style="font-family: limits-3;" displaystyle="true">
        <munderover>
          <mo id="base6">∑</mo>
          <mspace id="under6" height="1em" width="1em" mathbackground="red"/>
          <mspace id="over6" height="1em" width="1em" mathbackground="red"/>
        </munderover>
      </math>
    </p>

    <p>
      <math style="font-family: limits-4;" displaystyle="true">
        <mspace id="ref4" height="1em" width="1em" mathbackground="green"/>
      </math>
      <math style="font-family: limits-4;" displaystyle="true">
        <munder>
          <mo id="base7">∑</mo>
          <mspace id="under7" height="1em" width="1em" mathbackground="red"/>
        </munder>
      </math>
      <math style="font-family: limits-4;" displaystyle="true">
        <munderover>
          <mo id="base8">∑</mo>
          <mspace id="under8" height="1em" width="1em" mathbackground="red"/>
          <mspace id="over8" height="1em" width="1em" mathbackground="red"/>
        </munderover>
      </math>
    </p>

    <p>
      <math style="font-family: limits-5;" displaystyle="true">
        <mspace id="ref5" height="1em" width="1em" mathbackground="green"/>
      </math>
      <math style="font-family: limits-5;" displaystyle="true">
        <mover>
          <mspace id="base9" height="2em" width="2em" mathbackground="blue"/>
          <mo id="over9" stretchy="false">~</mo>
        </mover>
      </math>
      <math style="font-family: limits-5;" displaystyle="true">
        <munderover>
          <mspace id="base10" height="2em" width="2em" mathbackground="blue"/>
          <mspace id="under10" height="1em" width="1em" mathbackground="red"/>
          <mo id="over10" stretchy="false">~</mo>
        </munderover>
      </math>
    </p>

  </body>
</html>