Index: LayoutTests/svg/custom/zoomed-alignment-baseline.html |
diff --git a/LayoutTests/svg/custom/zoomed-alignment-baseline.html b/LayoutTests/svg/custom/zoomed-alignment-baseline.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bd655c815222ffb3f9f5e27a87afa6d0edb1fcd8 |
--- /dev/null |
+++ b/LayoutTests/svg/custom/zoomed-alignment-baseline.html |
@@ -0,0 +1,47 @@ |
+<!doctype html> |
+<title>Test that alignment-baseline 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 alignmentBaselineValues = ["baseline", "before-edge", "text-before-edge", "middle", |
+ "central", "after-edge", "text-after-edge", |
+ "ideograpic", "alphabetic", "hanging", "mathematical"]; |
+ var expectedHeights = { |
+ "baseline" : 20, |
+ "before-edge": 36, |
+ "text-before-edge": 36, |
+ "middle": 28, |
+ "central": 26, |
+ "after-edge": 24, |
+ "text-after-edge": 24, |
+ "ideograpic": 20, |
+ "alphabetic": 20, |
+ "hanging": 32, |
+ "mathematical": 28 |
+ }; |
+ |
+ var zoomLevels = [1, 4, 16]; |
+ var html = document.documentElement; |
+ alignmentBaselineValues.forEach(function (alignmentBaselineValue) { |
+ document.querySelector('tspan').setAttribute('alignment-baseline', alignmentBaselineValue); |
+ zoomLevels.forEach(function (zoom) { |
+ html.style.zoom = zoom; |
+ var bounds = document.querySelector('text').getBoundingClientRect(); |
+ test(function () { |
+ assert_approx_equals(bounds.height, expectedHeights[alignmentBaselineValue], 1); |
+ }, "Text bounds height at zoom " + zoom + " with alignment-baseline=" + alignmentBaselineValue); |
+ }); |
+ }); |
+ html.style.zoom = 1; |
+ </script> |
+</svg> |
+<p>This test requires the Ahem font</p> |