2 <title>Test that baseline-shift 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 baselineShiftValues
= ["10px", "-50%"]; // Shift half a step up or down
17 var zoomLevels
= [1, 4, 16];
19 var html
= document
.documentElement
;
20 baselineShiftValues
.forEach(function (baselineShiftValue
) {
21 document
.querySelector('tspan').setAttribute('baseline-shift', baselineShiftValue
);
22 zoomLevels
.forEach(function (zoom
) {
23 html
.style
.zoom
= zoom
;
24 var baselineShiftDelta
= (document
.querySelector('text').getStartPositionOfChar(0).y
-
25 document
.querySelector('tspan').getStartPositionOfChar(0).y
);
27 assert_equals(Math
.abs(baselineShiftDelta
), 10, "Baseline half a font-size up or down");
28 }, "Text bounds height at zoom " + zoom
+ " with baseline-shift=" + baselineShiftValue
);
32 // Clean up to avoid being classified as a text test; avoids an -expected.txt file.
33 document
.querySelector('text').remove();