OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Test that ex, em, rem and ch font sizes are unaffected by zoom level</tit
le> |
| 3 <script src="../../resources/ahem.js"></script> |
| 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <style> |
| 7 svg { |
| 8 font-size: 100px; |
| 9 font-family: ahem; |
| 10 } |
| 11 </style> |
| 12 <svg width="100%" height="1em" xmlns="http://www.w3.org/2000/svg" version="1.1"> |
| 13 |
| 14 <text id="em" y="1em" dy="4em">XXXXXX XXX</text> |
| 15 <text id="rem" y="1em" dy="25rem">XXXXXX XXX</text> |
| 16 <text id="ex" y="1em" dy="5ex">XXXXXX XXX</text> |
| 17 <text id="ch" y="1em" dy="4ch">XXXXXX XXX</text> |
| 18 |
| 19 <script> |
| 20 var zoomLevels = [0.3, 4]; |
| 21 var html = document.documentElement; |
| 22 var textElements = document.querySelectorAll('text'); |
| 23 |
| 24 [].forEach.call(textElements, function(elm) { |
| 25 html.style.zoom = 1; |
| 26 var reference_y = elm.getStartPositionOfChar(0).y; |
| 27 |
| 28 zoomLevels.forEach(function (zoom) { |
| 29 html.style.zoom = zoom; |
| 30 test(function () { |
| 31 assert_approx_equals(elm.getStartPositionOfChar(0).y, reference_
y, 1); |
| 32 }, "Unit " + elm.id + " not affected by zoom level " + zoom); |
| 33 }); |
| 34 |
| 35 // Clean up to avoid being classified as a text test; avoids an -expecte
d.txt file. |
| 36 elm.remove(); |
| 37 }); |
| 38 html.style.zoom = 1; |
| 39 </script> |
| 40 </svg> |
OLD | NEW |