Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / css3 / font-feature-settings-parsing.html
blob0580aa08648e9d52a3952029f9accd9954d9dcc3
1 <html>
2 <head>
3 <style>
4 #valid_normal {
5 -webkit-font-feature-settings: normal;
8 #valid_value_1 {
9 -webkit-font-feature-settings: "dlig" 1;
12 #valid_value_2 {
13 -webkit-font-feature-settings: "swsh" 2;
16 #valid_value_on {
17 -webkit-font-feature-settings: "smcp" on;
20 #valid_value_off {
21 -webkit-font-feature-settings: "liga" off;
24 #valid_value_omit {
25 -webkit-font-feature-settings: "c2sc";
28 #valid_valuelist {
29 -webkit-font-feature-settings: "tnum", 'hist';
32 #valid_singlequote {
33 -webkit-font-feature-settings: 'PKRN';
36 #valid_unusual_tag {
37 -webkit-font-feature-settings: "!@#$";
40 #valid_tag_space {
41 -webkit-font-feature-settings: "a bc";
44 #valid_composite {
45 -webkit-font-feature-settings: "dlig" 1, 'smcp' on, 'lig ' off;
48 #invalid_ident {
49 -webkit-font-feature-settings: dlig;
52 #invalid_cases {
53 -webkit-font-feature-settings: dlig, DLIG, DLig;
56 #invalid_1 {
57 -webkit-font-feature-settings: 1;
60 #invalid_off {
61 -webkit-font-feature-settings: off;
64 #invalid_normal_duplicate {
65 -webkit-font-feature-settings: normal, normal;
68 #invalid_normal_list {
69 -webkit-font-feature-settings: normal, aaaa;
72 #invalid_longer_ident {
73 -webkit-font-feature-settings: aaaaa;
76 #invalid_longer_quote {
77 -webkit-font-feature-settings: "aaaaa";
80 #invalid_negative {
81 -webkit-font-feature-settings: aaaa -1;
84 #invalid_float {
85 -webkit-font-feature-settings: aaaa 1.5;
88 #invalid_missing_comma {
89 -webkit-font-feature-settings: aaaa "bbbb";
92 #invalid_missing_comma_ident {
93 -webkit-font-feature-settings: aaaa bbbb;
96 #invalid_comma {
97 -webkit-font-feature-settings: ,;
100 #invalid_ending_comma {
101 -webkit-font-feature-settings: aaaa,;
104 #invalid_beginning_comma {
105 -webkit-font-feature-settings: ,aaaa;
108 #invalid_on {
109 -webkit-font-feature-settings: aaaa, on;
112 #invalid_0 {
113 -webkit-font-feature-settings: "aaaa" 1, "bbbb", 0;
116 #invalid_composite {
117 -webkit-font-feature-settings: aaaaa on, dlig on, PKRN -1;
119 </style>
120 <style>
121 @font-face {
122 -webkit-font-feature-settings: 'liga';
125 @font-face {
126 -webkit-font-feature-settings: aaaaa;
128 </style>
129 <script src="../resources/js-test.js"></script>
130 </head>
131 <body>
132 <div id="valid_normal"></div>
133 <div id="valid_value_1"></div>
134 <div id="valid_value_2"></div>
135 <div id="valid_value_on"></div>
136 <div id="valid_value_off"></div>
137 <div id="valid_value_omit"></div>
138 <div id="valid_valuelist"></div>
139 <div id="valid_singlequote"></div>
140 <div id="valid_unusual_tag"></div>
141 <div id="valid_tag_space"></div>
142 <div id="valid_composite"></div>
144 <div id="invalid_ident"></div>
145 <div id="invalid_cases"></div>
146 <div id="invalid_1"></div>
147 <div id="invalid_off"></div>
148 <div id="invalid_normal_duplicate"></div>
149 <div id="invalid_normal_list"></div>
150 <div id="invalid_longer_ident"></div>
151 <div id="invalid_longer_quote"></div>
152 <div id="invalid_negative"></div>
153 <div id="invalid_float"></div>
154 <div id="invalid_missing_comma"></div>
155 <div id="invalid_missing_comma_ident"></div>
156 <div id="invalid_comma"></div>
157 <div id="invalid_ending_comma"></div>
158 <div id="invalid_beginning_comma"></div>
159 <div id="invalid_on"></div>
160 <div id="invalid_0"></div>
162 <div id="outer" style="-webkit-font-feature-settings: 'dlig';">
163 <div id="inner"></div>
164 </div>
166 <p id="description"></p>
167 <div id="console"></div>
168 <script>
169 description('Test parsing of the CSS3 font-feature-settings property.');
171 function parseResultOf(id) {
172 var element = document.getElementById(id);
173 return window.getComputedStyle(element)['-webkit-font-feature-settings'];
176 debug('- Tests valid inputs.');
177 shouldBeEqualToString('parseResultOf("valid_normal")', "normal");
178 shouldBeEqualToString('parseResultOf("valid_value_1")', "'dlig' 1");
179 shouldBeEqualToString('parseResultOf("valid_value_2")', "'swsh' 2");
180 shouldBeEqualToString('parseResultOf("valid_value_on")', "'smcp' 1");
181 shouldBeEqualToString('parseResultOf("valid_value_off")', "'liga' 0");
182 shouldBeEqualToString('parseResultOf("valid_value_omit")', "'c2sc' 1");
183 shouldBeEqualToString('parseResultOf("valid_valuelist")', "'tnum' 1, 'hist' 1");
184 shouldBeEqualToString('parseResultOf("valid_singlequote")', "'PKRN' 1");
185 shouldBeEqualToString('parseResultOf("valid_unusual_tag")', "'!@#$' 1");
186 shouldBeEqualToString('parseResultOf("valid_tag_space")', "'a bc' 1");
187 shouldBeEqualToString('parseResultOf("valid_composite")', "'dlig' 1, 'smcp' 1, 'lig ' 0");
189 debug('- Tests invalid inputs. Results should be "normal".');
190 shouldBe('parseResultOf("invalid_ident")', '"normal"');
191 shouldBe('parseResultOf("invalid_cases")', '"normal"');
192 shouldBe('parseResultOf("invalid_1")', '"normal"');
193 shouldBe('parseResultOf("invalid_off")', '"normal"');
194 shouldBe('parseResultOf("invalid_normal_duplicate")', '"normal"');
195 shouldBe('parseResultOf("invalid_normal_list")', '"normal"');
196 shouldBe('parseResultOf("invalid_longer_ident")', '"normal"');
197 shouldBe('parseResultOf("invalid_longer_quote")', '"normal"');
198 shouldBe('parseResultOf("invalid_negative")', '"normal"');
199 shouldBe('parseResultOf("invalid_float")', '"normal"');
200 shouldBe('parseResultOf("invalid_missing_comma")', '"normal"');
201 shouldBe('parseResultOf("invalid_missing_comma_ident")', '"normal"');
202 shouldBe('parseResultOf("invalid_comma")', '"normal"');
203 shouldBe('parseResultOf("invalid_ending_comma")', '"normal"');
204 shouldBe('parseResultOf("invalid_beginning_comma")', '"normal"');
205 shouldBe('parseResultOf("invalid_on")', '"normal"');
206 shouldBe('parseResultOf("invalid_0")', '"normal"');
208 debug('- Tests inherit.');
209 shouldBeEqualToString('parseResultOf("outer")', "'dlig' 1");
210 shouldBeEqualToString('parseResultOf("inner")', "'dlig' 1");
212 debug('- Tests @font-face.');
213 var fontFaceRuleValid = document.styleSheets[1].cssRules[0].style['-webkit-font-feature-settings'];
214 var fontFaceRuleInvalid = document.styleSheets[1].cssRules[1].style['-webkit-font-feature-settings'];
215 shouldBeEqualToString('fontFaceRuleValid', "'liga' 1");
216 shouldBeEqualToString('fontFaceRuleInvalid', "");
218 </script>
219 </body>
220 </html>