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

Side by Side Diff: third_party/WebKit/LayoutTests/svg/css/glyph-orientation-rounding-test.xhtml

Issue 1419583002: Remove SVG glyph-orientation-horizontal and glyph-orientation-vertical (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove glyph-orientation-rounding-test Created 5 years, 2 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
(Empty)
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head>
3 <script src="../../resources/js-test.js"/>
4 </head>
5 <body>
6 <svg display="none" xmlns="http://www.w3.org/2000/svg"><text id="text"/></svg>
7 <p id="description"></p>
8 <div id="console"/>
9 <script>
10 var textElement = document.getElementById("text");
11 var computedStyle;
12
13 function parseGlyphOrientationHelper(property, angleValue, expectedValue)
14 {
15 textElement.setAttributeNS(null, property, angleValue);
16 computedStyle = textElement.ownerDocument.defaultView.getComputedStyle(textE lement);
17
18 debug("Test angleValue: '" + angleValue + "'");
19
20 if (expectedValue == "auto") {
21 shouldBe("computedStyle.getPropertyValue('" + property + "')", '"auto"') ;
22 } else {
23 shouldBe("parseFloat(computedStyle.getPropertyValue('" + property + "')) ", "" + expectedValue);
24 }
25
26 debug("");
27 }
28
29 function parseGlyphOrientation(angleValue, expectedValue)
30 {
31 if (expectedValue == undefined) {
32 parseGlyphOrientationHelper("glyph-orientation-horizontal", angleValue, 0.0);
33 parseGlyphOrientationHelper("glyph-orientation-vertical", angleValue, "a uto");
34 } else {
35 parseGlyphOrientationHelper("glyph-orientation-horizontal", angleValue, expectedValue);
36 parseGlyphOrientationHelper("glyph-orientation-vertical", angleValue, ex pectedValue);
37 }
38 }
39
40 description('Stress test glyph-orientation SVG CSS properties');
41 debug('');
42
43 debug('Strings that fail to parse, and hence parse as "0" for horziontal and "au to" as vertical.');
44 debug('');
45
46 parseGlyphOrientation(" 0,1");
47 parseGlyphOrientation(" 0,00000.1");
48 parseGlyphOrientation(" 0 1");
49 parseGlyphOrientation("0.1 0.2");
50
51 parseGlyphOrientation(" 270,1");
52 parseGlyphOrientation(" 270,00000.1");
53 parseGlyphOrientation(" 270 1");
54 parseGlyphOrientation("270.1 0.2");
55
56
57 debug('This tests the rounding of glyph orientation values to the only allowed v alues 0, 90, 180, 270.');
58 debug('');
59
60 parseGlyphOrientation("-0.0", 0.0);
61 parseGlyphOrientation("-10.0", 0.0);
62 parseGlyphOrientation("-45.0", 0.0);
63 parseGlyphOrientation("0.0", 0.0);
64 parseGlyphOrientation("10.0", 0.0);
65 parseGlyphOrientation("45.0", 0.0);
66
67 parseGlyphOrientation("-90.0", 90.0);
68 parseGlyphOrientation("-100.0", 90.0);
69 parseGlyphOrientation("-135.0", 90.0);
70 parseGlyphOrientation("90.0", 90.0);
71 parseGlyphOrientation("100.0", 90.0);
72 parseGlyphOrientation("135.0", 90.0);
73
74 parseGlyphOrientation("-180.0", 180.0);
75 parseGlyphOrientation("-190.0", 180.0);
76 parseGlyphOrientation("-225.0", 180.0);
77 parseGlyphOrientation("180.0", 180.0);
78 parseGlyphOrientation("190.0", 180.0);
79 parseGlyphOrientation("225.0", 180.0);
80
81 parseGlyphOrientation("-270.0", 270.0);
82 parseGlyphOrientation("-280.0", 270.0);
83 parseGlyphOrientation("-305.0", 270.0);
84 parseGlyphOrientation("270.0", 270.0);
85 parseGlyphOrientation("280.0", 270.0);
86 parseGlyphOrientation("305.0", 270.0);
87
88 debug('Tests angles bigger than 360.');
89 debug('');
90
91 parseGlyphOrientation("449.0", 90.0);
92 parseGlyphOrientation("450.0", 90.0);
93 parseGlyphOrientation("451.0", 90.0);
94
95 parseGlyphOrientation("539.0", 180.0);
96 parseGlyphOrientation("540.0", 180.0);
97 parseGlyphOrientation("541.0", 180.0);
98
99 parseGlyphOrientation("629.0", 270.0);
100 parseGlyphOrientation("630.0", 270.0);
101 parseGlyphOrientation("631.0", 270.0);
102
103 debug('Tests whitespace before/after angle value.');
104 debug('');
105
106 parseGlyphOrientation(" .0 ", 0.0);
107 parseGlyphOrientation(" 0 ", 0.0);
108 parseGlyphOrientation(" 90.0 ", 90.0);
109 parseGlyphOrientation(" 180.0 ", 180.0);
110 parseGlyphOrientation(" 270.0 ", 270.0);
111
112 debug('Tests rounding of fractional angle values.');
113 debug('');
114
115 parseGlyphOrientation("45.0000", 0.0);
116 parseGlyphOrientation("45.0001", 90.0);
117 parseGlyphOrientation("135.000", 90.0);
118 parseGlyphOrientation("135.001", 180.0);
119
120
121 </script>
122
123 </body>
124 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698