Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: LayoutTests/svg/custom/zoomed-baseline-shift.html

Issue 1052373007: Limit recent SVG baseline tests to a stable subset (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <title>Test that baseline-shift is unaffected by zoom level</title> 2 <title>Test that baseline-shift is unaffected by zoom level</title>
3 <script src="../../resources/testharness.js"></script> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 <svg width="250" height="140" viewBox="0 0 250 140" 5 <svg width="250" height="140" viewBox="0 0 250 140"
6 xmlns="http://www.w3.org/2000/svg" version="1.1"> 6 xmlns="http://www.w3.org/2000/svg" version="1.1">
7 <style> 7 <style>
8 text { 8 text {
9 font-family: ahem; 9 font-family: ahem;
10 font-size: 20px; 10 font-size: 20px;
11 } 11 }
12 </style> 12 </style>
13 <text x="15" y="40">before<tspan>inter</tspan>after</text> 13 <text x="15" y="40">before<tspan>inter</tspan>after</text>
14 <script> 14 <script>
15 var baselineShiftValues = ["sub", "super", "10px", "-50%"]; // Shift half a step up or down 15 var baselineShiftValues = ["10px", "-50%"]; // Shift half a step up or down
16 var zoomLevels = [1, 4, 16]; 16 var zoomLevels = [1, 4, 16];
17 17
18 var html = document.documentElement; 18 var html = document.documentElement;
19 baselineShiftValues.forEach(function (baselineShiftValue) { 19 baselineShiftValues.forEach(function (baselineShiftValue) {
20 document.querySelector('tspan').setAttribute('baseline-shift', baselineS hiftValue); 20 document.querySelector('tspan').setAttribute('baseline-shift', baselineS hiftValue);
21 zoomLevels.forEach(function (zoom) { 21 zoomLevels.forEach(function (zoom) {
22 html.style.zoom = zoom; 22 html.style.zoom = zoom;
23 var baselineShiftDelta = (document.querySelector('text').getStartPos itionOfChar(0).y - 23 var baselineShiftDelta = (document.querySelector('text').getStartPos itionOfChar(0).y -
24 document.querySelector('tspan').getStartPositionOfChar(0).y); 24 document.querySelector('tspan').getStartPositionOfChar(0).y);
25 test(function () { 25 test(function () {
26 assert_equals(Math.abs(baselineShiftDelta), 10, "Baseline half a font-size up or down"); 26 assert_equals(Math.abs(baselineShiftDelta), 10, "Baseline half a font-size up or down");
27 }, "Text bounds height at zoom " + zoom + " with baseline-shift=" + baselineShiftValue); 27 }, "Text bounds height at zoom " + zoom + " with baseline-shift=" + baselineShiftValue);
28 }); 28 });
29 }); 29 });
30 html.style.zoom = 1; 30 html.style.zoom = 1;
31 </script> 31 </script>
32 </svg> 32 </svg>
33 <p>This test requires the Ahem font</p> 33 <p>This test requires the Ahem font</p>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698