| 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 } | |
| 35 </style> | 25 </style> |
| 36 <script> | 26 <script> |
| 37 description('Tests that only necessary fonts are loaded when font faces have ove
rlapping unicode ranges.'); | 27 description('Tests that only necessary fonts are loaded when font faces have ove
rlapping unicode ranges.'); |
| 38 | 28 |
| 39 window.jsTestIsAsync = true; | 29 window.jsTestIsAsync = true; |
| 40 | 30 |
| 41 function getDocumentFontFaces() { | 31 function getDocumentFontFaces() { |
| 42 var faces = []; | 32 var faces = []; |
| 43 document.fonts.forEach(function(face) { faces.push(face); }); | 33 document.fonts.forEach(function(face) { faces.push(face); }); |
| 44 return faces; | 34 return faces; |
| 45 } | 35 } |
| 46 | 36 |
| 47 document.fonts.ready().then(function() { | 37 document.fonts.ready().then(function() { |
| 48 faces = getDocumentFontFaces(); | 38 faces = getDocumentFontFaces(); |
| 49 shouldBe('faces.length', '6'); | 39 shouldBe('faces.length', '4'); |
| 50 shouldBeEqualToString('faces[0].status', 'unloaded'); | 40 shouldBeEqualToString('faces[0].status', 'unloaded'); |
| 51 shouldBeEqualToString('faces[1].status', 'loaded'); | 41 shouldBeEqualToString('faces[1].status', 'loaded'); |
| 52 shouldBeEqualToString('faces[2].status', 'loaded'); | 42 shouldBeEqualToString('faces[2].status', 'loaded'); |
| 53 shouldBeEqualToString('faces[3].status', 'unloaded'); | 43 shouldBeEqualToString('faces[3].status', 'unloaded'); |
| 54 shouldBeEqualToString('faces[4].status', 'unloaded'); | |
| 55 shouldBeEqualToString('faces[5].status', 'loaded'); | |
| 56 finishJSTest(); | 44 finishJSTest(); |
| 57 }); | 45 }); |
| 58 </script> | 46 </script> |
| 59 </head> | 47 </head> |
| 60 <body> | 48 <body> |
| 61 <p style="font-family: Test1">I</p> | 49 <p style="font-family: Test1">I</p> |
| 62 <p style="font-family: Test2">J</p> | 50 <p style="font-family: Test2">J</p> |
| 63 <p style="font-family: Test3">K</p> | |
| 64 </body> | 51 </body> |
| 65 </html> | 52 </html> |
| OLD | NEW |