Index: LayoutTests/svg/custom/zoomed-baseline-shift.html |
diff --git a/LayoutTests/svg/custom/zoomed-baseline-shift.html b/LayoutTests/svg/custom/zoomed-baseline-shift.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..eabbe46a8e508af4053f4a83529144077f35b7e5 |
--- /dev/null |
+++ b/LayoutTests/svg/custom/zoomed-baseline-shift.html |
@@ -0,0 +1,32 @@ |
+<!doctype html> |
+<title>Test that baseline-shift is unaffected by zoom level</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<svg width="250" height="140" viewBox="0 0 250 140" |
+ xmlns="http://www.w3.org/2000/svg" version="1.1"> |
+ <style> |
+ text { |
+ font-family: ahem; |
+ font-size: 20px; |
+ } |
+ </style> |
+ <text x="15" y="40">before<tspan>inter</tspan>after</text> |
+ <script> |
+ var expectedHeight = 20 + 10; // font-size + half a step up or down |
+ var baselineShiftValues = ["sub", "super", "10px", "-50%" ]; // Shift half a step up or down |
+ var zoomLevels = [1, 4, 16]; |
+ var html = document.documentElement; |
+ baselineShiftValues.forEach(function (baselineShiftValue) { |
+ document.querySelector('tspan').setAttribute('baseline-shift', baselineShiftValue); |
+ zoomLevels.forEach(function (zoom) { |
+ html.style.zoom = zoom; |
+ var bounds = document.querySelector('text').getBoundingClientRect(); |
+ test(function () { |
+ assert_equals(bounds.height, expectedHeight); |
+ }, "text bound height at zoom " + zoom + " with baseline-shift=" + baselineShiftValue); |
+ }); |
+ }); |
+ html.style.zoom = 1; |
+ </script> |
+</svg> |
+<p>This test requires the Ahem font</p> |