Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / font-face-unicode-range-load.html
blobc357d2c9984ce0fb1251774ecd67ebdd581b0107
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <script>
5 description('Tests that unicode-range descriptor is used to selectively download fonts that are used in document.');
7 window.jsTestIsAsync = true;
9 var latin1Loaded = false;
10 var cyrillicLoaded = false;
11 var arabicLoaded = false;
12 var iconLoaded = false;
14 function runTests() {
15 document.fonts.addEventListener('loadingdone', onloadingdone);
18 function onloadingdone(e) {
19 for (var i = 0; i < e.fontfaces.length; i++) {
20 var range = e.fontfaces[i].unicodeRange;
21 if (range == 'U+0-FF')
22 latin1Loaded = true;
23 if (range == 'U+400-4FF')
24 cyrillicLoaded = true;
25 if (range == 'U+600-6FF')
26 arabicLoaded = true;
27 if (range == 'U+E000')
28 iconLoaded = true;
31 shouldBeFalse('latin1Loaded');
32 shouldBeTrue('cyrillicLoaded');
33 shouldBeFalse('arabicLoaded');
34 shouldBeFalse('iconLoaded');
35 finishJSTest();
38 if (document.fonts)
39 runTests();
40 else {
41 testFailed('document.fonts does not exist');
42 finishJSTest();
44 </script>
45 <style>
46 @font-face {
47 font-family: TestFont;
48 src: url('../../resources/Ahem.ttf');
49 unicode-range: U+00-0FF; /* Latin-1 */
51 @font-face {
52 font-family: TestFont;
53 src: url('../../resources/Ahem.otf');
54 unicode-range: U+0400-04FF; /* Cyrillic */
56 @font-face {
57 font-family: TestFont;
58 src: url('../../resources/Ahem.woff');
59 unicode-range: U+0600-06FF; /* Arabic */
61 #test {
62 font-family: TestFont;
65 @font-face {
66 font-family: SingleCharacterOverride;
67 src: url('../../resources/Ahem.woff');
68 unicode-range: U+E000;
70 #test2 {
71 font-family: SingleCharacterOverride;
73 </style>
74 </head>
75 <body>
76 <p id="test">&#x41F;&#x440;&#x43E;&#x432;&#x435;&#x440;&#x43A;&#x430;</p>
77 <p id="test2">hello</p>
78 </body>
79 </html>