OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <title>Test that baseline-shift is unaffected by zoom level</title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <svg width="250" height="140" viewBox="0 0 250 140" |
| 6 xmlns="http://www.w3.org/2000/svg" version="1.1"> |
| 7 <style> |
| 8 text { |
| 9 font-family: ahem; |
| 10 font-size: 20px; |
| 11 } |
| 12 </style> |
| 13 <text x="15" y="40">before<tspan>inter</tspan>after</text> |
| 14 <script> |
| 15 var expectedHeight = 20 + 10; // font-size + half a step up or down |
| 16 var baselineShiftValues = ["sub", "super", "10px", "-50%" ]; // Shift half a
step up or down |
| 17 var zoomLevels = [1, 4, 16]; |
| 18 var html = document.documentElement; |
| 19 baselineShiftValues.forEach(function (baselineShiftValue) { |
| 20 document.querySelector('tspan').setAttribute('baseline-shift', baselineS
hiftValue); |
| 21 zoomLevels.forEach(function (zoom) { |
| 22 html.style.zoom = zoom; |
| 23 var bounds = document.querySelector('text').getBoundingClientRect(); |
| 24 test(function () { |
| 25 assert_equals(bounds.height, expectedHeight); |
| 26 }, "text bound height at zoom " + zoom + " with baseline-shift=" + b
aselineShiftValue); |
| 27 }); |
| 28 }); |
| 29 html.style.zoom = 1; |
| 30 </script> |
| 31 </svg> |
| 32 <p>This test requires the Ahem font</p> |
OLD | NEW |