| 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 <script> | 4 <script> |
| 5 description('Tests that FontFaceSet is correctly updated when added or removed a
FontFace while loading.'); | 5 description('Tests that FontFaceSet is correctly updated when added or removed a
FontFace while loading.'); |
| 6 | 6 |
| 7 window.jsTestIsAsync = true; | 7 window.jsTestIsAsync = true; |
| 8 | 8 |
| 9 function testStep1() { | 9 function testStep1() { |
| 10 face1 = new FontFace('face1', 'url(../../resources/Ahem.ttf)', {}); | 10 face1 = new FontFace('face1', 'url(../../resources/Ahem.ttf)', {}); |
| 11 shouldBeEqualToString('face1.status', 'unloaded'); | 11 shouldBeEqualToString('face1.status', 'unloaded'); |
| 12 | 12 |
| 13 face1.load(); | 13 face1.load(); |
| 14 shouldBeEqualToString('face1.status', 'loading'); | 14 shouldBeEqualToString('face1.status', 'loading'); |
| 15 shouldBeEqualToString('document.fonts.status', 'loaded'); | 15 shouldBeEqualToString('document.fonts.status', 'loaded'); |
| 16 | 16 |
| 17 document.fonts.add(face1); | 17 document.fonts.add(face1); |
| 18 shouldBeEqualToString('document.fonts.status', 'loading'); | 18 shouldBeEqualToString('document.fonts.status', 'loading'); |
| 19 document.fonts.ready().then(testStep2); | 19 document.fonts.ready.then(testStep2); |
| 20 } | 20 } |
| 21 | 21 |
| 22 function testStep2() { | 22 function testStep2() { |
| 23 shouldBeEqualToString('face1.status', 'loaded'); | 23 shouldBeEqualToString('face1.status', 'loaded'); |
| 24 shouldBeEqualToString('document.fonts.status', 'loaded'); | 24 shouldBeEqualToString('document.fonts.status', 'loaded'); |
| 25 | 25 |
| 26 face2 = new FontFace('face2', 'url(../../resources/Ahem.ttf)', {}); | 26 face2 = new FontFace('face2', 'url(../../resources/Ahem.ttf)', {}); |
| 27 shouldBeEqualToString('face2.status', 'unloaded'); | 27 shouldBeEqualToString('face2.status', 'unloaded'); |
| 28 | 28 |
| 29 document.fonts.add(face2); | 29 document.fonts.add(face2); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 56 if (document.fonts) | 56 if (document.fonts) |
| 57 testStep1(); | 57 testStep1(); |
| 58 else | 58 else |
| 59 testFailed('document.fonts does not exist'); | 59 testFailed('document.fonts does not exist'); |
| 60 | 60 |
| 61 </script> | 61 </script> |
| 62 </head> | 62 </head> |
| 63 <body> | 63 <body> |
| 64 </body> | 64 </body> |
| 65 </html> | 65 </html> |
| OLD | NEW |