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..fc89f1494324a95b2df2de73710a8a0dd617f384 |
--- /dev/null |
+++ b/LayoutTests/svg/custom/zoomed-baseline-shift.html |
@@ -0,0 +1,33 @@ |
+<!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 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 baselineShiftDelta = (document.querySelector('text').getStartPositionOfChar(0).y - |
+ document.querySelector('tspan').getStartPositionOfChar(0).y); |
+ test(function () { |
+ assert_equals(Math.abs(baselineShiftDelta), 10, "Baseline half a font-size up or down"); |
+ }, "Text bounds height at zoom " + zoom + " with baseline-shift=" + baselineShiftValue); |
+ }); |
+ }); |
+ html.style.zoom = 1; |
+ </script> |
+</svg> |
+<p>This test requires the Ahem font</p> |