2 <title>Test that alignment-baseline is unaffected by zoom level
</title>
3 <script src=
"../../resources/ahem.js"></script>
4 <script src=
"../../resources/testharness.js"></script>
5 <script src=
"../../resources/testharnessreport.js"></script>
6 <svg width=
"250" height=
"140" viewBox=
"0 0 250 140"
7 xmlns=
"http://www.w3.org/2000/svg" version=
"1.1">
14 <text x=
"15" y=
"40">before
<tspan>inter
</tspan>after
</text>
16 var alignmentBaselineValues
= ["baseline", "central", "after-edge", "text-after-edge",
17 "ideograpic", "alphabetic", "mathematical"];
18 var expectedDeltas
= {
21 "text-before-edge": -16,
32 var zoomLevels
= [1, 4, 16];
33 var html
= document
.documentElement
;
34 alignmentBaselineValues
.forEach(function (alignmentBaselineValue
) {
35 document
.querySelector('tspan').setAttribute('alignment-baseline', alignmentBaselineValue
);
36 zoomLevels
.forEach(function (zoom
) {
37 html
.style
.zoom
= zoom
;
38 var baselineShiftDelta
= (document
.querySelector('text').getStartPositionOfChar(0).y
-
39 document
.querySelector('tspan').getStartPositionOfChar(0).y
);
41 assert_approx_equals(baselineShiftDelta
, expectedDeltas
[alignmentBaselineValue
], 1);
42 }, "Text bounds height at zoom " + zoom
+ " with alignment-baseline=" + alignmentBaselineValue
);
46 // Clean up to avoid being classified as a text test; avoids an -expected.txt file.
47 document
.querySelector('text').remove();