summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/mathml/relations/css-styling/displaystyle-2.html
blob: 68566cfc25b80efe5a6d15fc842b412583a90f84 (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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>displaystyle</title>
<link rel="help" href="https://w3c.github.io/mathml-core/#css-styling">
<link rel="help" href="https://w3c.github.io/mathml-core/#the-displaystyle-and-scriptlevel-attributes">
<link rel="help" href="https://w3c.github.io/mathml-core/#the-math-style-property">
<meta name="assert" content="Verify interaction between automatic displaystyle and specified displaystyle on descendants.">
<style>
  @font-face {
    font-family: TestFont;
    src: url("/fonts/math/largeop-displayoperatorminheight5000.woff");
  }
  math, math *  {
    font-family: TestFont;
    font-size: 10px;
  }
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mathml/support/attribute-values.js"></script>
<script src="/mathml/support/fonts.js"></script>
<script>
  setup({ explicit_done: true });
  var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
  var epsilon = 5;
  function verify_displaystyle(elementId, displaystyle, description) {
      var expectedSize = (displaystyle ? 5000 : 1000) * emToPx;
      var elementSize = document.getElementById(elementId).
          getBoundingClientRect().height;
      assert_approx_equals(elementSize, expectedSize, epsilon, description);
  }

  window.addEventListener("load", () => { loadAllFonts().then(runTests); });

  function runTests() {
      for (transform in AttributeValueTransforms) {
          TransformAttributeValues(transform, ["display", "displaystyle"]);
          test(function() {
              verify_displaystyle("cell_false", false, "cell with displaystyle false");
              verify_displaystyle("cell_true", true, "cell with displaystyle true");
          }, `mtable element (${transform})`);
          test(function() {
              verify_displaystyle("mfrac_numerator", true, "numerator");
              verify_displaystyle("mfrac_denominator", true, "denominator");
          }, `mfrac element (${transform})`);
          test(function() {
              verify_displaystyle("mroot_base", false, "base");
              verify_displaystyle("mroot_index", true, "index");
          }, `mroot element (${transform})`);
          test(function() {
              verify_displaystyle("msub_base", false, "base");
              verify_displaystyle("msub_subscript", true, "subscript");
          }, `msub element (${transform})`);
          test(function() {
              verify_displaystyle("msup_base", false, "base");
              verify_displaystyle("msup_superscript", true, "superscript");
          }, `msup element (${transform})`);
          test(function() {
              verify_displaystyle("msubsup_base", false, "base");
              verify_displaystyle("msubsup_subscript", true, "subscript");
              verify_displaystyle("msubsup_superscript", true, "superscript");
          }, `msubsup element (${transform})`);
          test(function() {
              verify_displaystyle("munder_base", false, "base");
              verify_displaystyle("munder_underscript", true, "underscript");
          }, `munder element (${transform})`);
          test(function() {
              verify_displaystyle("mover_base", false, "base");
              verify_displaystyle("mover_overscript", true, "overscript");
          }, `mover element (${transform})`);
          test(function() {
              verify_displaystyle("munderover_base", false, "base");
              verify_displaystyle("munderover_underscript", true, "underscript");
              verify_displaystyle("munderover_overscript", true, "overscript");
          }, `munderover element (${transform})`);
      }
      done();
  }
</script>
</head>
<body>
  <div id="log"></div>
  <math displaystyle="true">
    <mtable>
      <mtr>
        <mtd>
          <mstyle displaystyle="false">
            <mo id="cell_false">&#x2AFF;</mo>
          </mstyle>
        </mtd>
        <mtd>
          <mstyle displaystyle="true">
            <mo id="cell_true">&#x2AFF;</mo>
          </mstyle>
        </mtd>
      </mtr>
    </mtable>
  </math>
  <math>
    <mfrac>
      <mstyle displaystyle="true">
        <mo id="mfrac_numerator">&#x2AFF;</mo>
      </mstyle>
      <mstyle displaystyle="true">
        <mo id="mfrac_denominator">&#x2AFF;</mo>
      </mstyle>
    </mfrac>
  </math>
  <math displaystyle="true">
    <mroot>
      <mstyle displaystyle="false">
        <mo id="mroot_base">&#x2AFF;</mo>
      </mstyle>
      <mstyle displaystyle="true">
        <mo id="mroot_index">&#x2AFF;</mo>
      </mstyle>
    </mroot>
  </math>
  <math displaystyle="true">
    <msub>
      <mstyle displaystyle="false">
        <mo id="msub_base">&#x2AFF;</mo>
      </mstyle>
      <mstyle displaystyle="true">
        <mo id="msub_subscript">&#x2AFF;</mo>
      </mstyle>
    </msub>
  </math>
  <math displaystyle="true">
    <msup>
      <mstyle displaystyle="false">
        <mo id="msup_base">&#x2AFF;</mo>
      </mstyle>
      <mstyle displaystyle="true">
        <mo id="msup_superscript">&#x2AFF;</mo>
      </mstyle>
    </msup>
  </math>
  <math displaystyle="true">
    <msubsup>
      <mstyle displaystyle="false">
        <mo id="msubsup_base">&#x2AFF;</mo>
      </mstyle>
      <mstyle displaystyle="true">
        <mo id="msubsup_subscript">&#x2AFF;</mo>
      </mstyle>
      <mstyle displaystyle="true">
        <mo id="msubsup_superscript">&#x2AFF;</mo>
      </mstyle>
    </msubsup>
  </math>
  <math displaystyle="true">
    <mmultiscripts>
      <mstyle displaystyle="false">
        <mo id="mmultiscripts_base">&#x2AFF;</mo>
      </mstyle>
      <mstyle displaystyle="true">
        <mo id="mmultiscripts_subscript">&#x2AFF;</mo>
      </mstyle>
      <mstyle displaystyle="true">
        <mo id="mmultiscripts_superscript">&#x2AFF;</mo>
      </mstyle>
      <mprescripts/>
      <mstyle displaystyle="true">
        <mo id="mmultiscripts_presubscript">&#x2AFF;</mo>
      </mstyle>
      <mstyle displaystyle="true">
        <mo id="mmultiscripts_presuperscript">&#x2AFF;</mo>
      </mstyle>
    </mmultiscripts>
  </math>
  <math displaystyle="true">
    <munder>
      <mstyle displaystyle="false">
        <mo id="munder_base">&#x2AFF;</mo>
      </mstyle>
      <mstyle displaystyle="true">
        <mo id="munder_underscript">&#x2AFF;</mo>
      </mstyle>
    </munder>
  </math>
  <math displaystyle="true">
    <mover>
      <mstyle displaystyle="false">
        <mo id="mover_base">&#x2AFF;</mo>
      </mstyle>
      <mstyle displaystyle="true">
        <mo id="mover_overscript">&#x2AFF;</mo>
      </mstyle>
    </mover>
  </math>
  <math displaystyle="true">
    <munderover>
      <mstyle displaystyle="false">
        <mo id="munderover_base">&#x2AFF;</mo>
      </mstyle>
      <mstyle displaystyle="true">
        <mo id="munderover_underscript">&#x2AFF;</mo>
      </mstyle>
      <mstyle displaystyle="true">
        <mo id="munderover_overscript">&#x2AFF;</mo>
      </mstyle>
    </munderover>
  </math>
</body>
</html>