| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/js-test.js"></script> |
| 4 <style> | 4 <style> |
| 5 @font-face { | 5 @font-face { |
| 6 font-family: Test1; | 6 font-family: Test1; |
| 7 src: url('../../resources/Ahem.ttf'); | 7 src: url('../../resources/Ahem.ttf'); |
| 8 unicode-range: U+41-5A; /* 'A'-'Z' */ | 8 unicode-range: U+41-5A; /* 'A'-'Z' */ |
| 9 } | 9 } |
| 10 @font-face { | 10 @font-face { |
| 11 font-family: Test1; | 11 font-family: Test1; |
| 12 src: url('../../resources/Ahem.otf'); | 12 src: url('../../resources/Ahem.otf'); |
| 13 unicode-range: U+49; /* 'I' */ | 13 unicode-range: U+49; /* 'I' */ |
| 14 } | 14 } |
| 15 @font-face { | 15 @font-face { |
| 16 font-family: Test2; | 16 font-family: Test2; |
| 17 src: url('../../resources/Ahem.woff'); | 17 src: url('../../resources/Ahem.woff'); |
| 18 unicode-range: U+41-5A; /* 'A'-'Z' */ | 18 unicode-range: U+41-5A; /* 'A'-'Z' */ |
| 19 } | 19 } |
| 20 @font-face { | 20 @font-face { |
| 21 font-family: Test2; | 21 font-family: Test2; |
| 22 src: url('../../resources/Ahem.woff2'); | 22 src: url('../../resources/Ahem.woff2'); |
| 23 unicode-range: U+49; /* 'I' */ | 23 unicode-range: U+49; /* 'I' */ |
| 24 } | 24 } |
| 25 @font-face { |
| 26 font-family: Test3; |
| 27 src: url('../../resources/Ahem.ttf'); |
| 28 /* no unicode-range */ |
| 29 } |
| 30 @font-face { |
| 31 font-family: Test3; |
| 32 src: url('../../resources/Ahem.otf'); |
| 33 unicode-range: U+00-FF; |
| 34 } |
| 25 </style> | 35 </style> |
| 26 <script> | 36 <script> |
| 27 description('Tests that only necessary fonts are loaded when font faces have ove
rlapping unicode ranges.'); | 37 description('Tests that only necessary fonts are loaded when font faces have ove
rlapping unicode ranges.'); |
| 28 | 38 |
| 29 window.jsTestIsAsync = true; | 39 window.jsTestIsAsync = true; |
| 30 | 40 |
| 31 function getDocumentFontFaces() { | 41 function getDocumentFontFaces() { |
| 32 var faces = []; | 42 var faces = []; |
| 33 document.fonts.forEach(function(face) { faces.push(face); }); | 43 document.fonts.forEach(function(face) { faces.push(face); }); |
| 34 return faces; | 44 return faces; |
| 35 } | 45 } |
| 36 | 46 |
| 37 document.fonts.ready().then(function() { | 47 document.fonts.ready().then(function() { |
| 38 faces = getDocumentFontFaces(); | 48 faces = getDocumentFontFaces(); |
| 39 shouldBe('faces.length', '4'); | 49 shouldBe('faces.length', '6'); |
| 40 shouldBeEqualToString('faces[0].status', 'unloaded'); | 50 shouldBeEqualToString('faces[0].status', 'unloaded'); |
| 41 shouldBeEqualToString('faces[1].status', 'loaded'); | 51 shouldBeEqualToString('faces[1].status', 'loaded'); |
| 42 shouldBeEqualToString('faces[2].status', 'loaded'); | 52 shouldBeEqualToString('faces[2].status', 'loaded'); |
| 43 shouldBeEqualToString('faces[3].status', 'unloaded'); | 53 shouldBeEqualToString('faces[3].status', 'unloaded'); |
| 54 shouldBeEqualToString('faces[4].status', 'unloaded'); |
| 55 shouldBeEqualToString('faces[5].status', 'loaded'); |
| 44 finishJSTest(); | 56 finishJSTest(); |
| 45 }); | 57 }); |
| 46 </script> | 58 </script> |
| 47 </head> | 59 </head> |
| 48 <body> | 60 <body> |
| 49 <p style="font-family: Test1">I</p> | 61 <p style="font-family: Test1">I</p> |
| 50 <p style="font-family: Test2">J</p> | 62 <p style="font-family: Test2">J</p> |
| 63 <p style="font-family: Test3">K</p> |
| 51 </body> | 64 </body> |
| 52 </html> | 65 </html> |
| OLD | NEW |