OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../../resources/js-test.js"></script> |
| 4 <style> |
| 5 @font-face { |
| 6 font-family: Font1; |
| 7 src: local(Arial); |
| 8 } |
| 9 |
| 10 @font-face { |
| 11 font-family: Font2; |
| 12 src: local(Arial); |
| 13 } |
| 14 |
| 15 @font-face { |
| 16 font-family: Font3; |
| 17 src: local(Arial); |
| 18 } |
| 19 </style> |
| 20 <script> |
| 21 description('Tests set operations of FontFaceSet.'); |
| 22 |
| 23 function runTests() { |
| 24 shouldBe('document.fonts.size', '3'); |
| 25 |
| 26 faces = []; |
| 27 document.fonts.forEach(function(face) { faces.push(face); }); |
| 28 shouldBe('faces.length', '3'); |
| 29 |
| 30 shouldBeEqualToString('faces[0].family', 'Font1'); |
| 31 shouldBeEqualToString('faces[1].family', 'Font2'); |
| 32 shouldBeEqualToString('faces[2].family', 'Font3'); |
| 33 |
| 34 shouldBeTrue('document.fonts.has(faces[0])'); |
| 35 shouldBeTrue('document.fonts.has(faces[1])'); |
| 36 shouldBeTrue('document.fonts.has(faces[2])'); |
| 37 shouldBeFalse('document.fonts.has(new FontFace("MyFont", "local(Arial)", {})
)'); |
| 38 shouldThrow('document.fonts.has("Font1")', '"TypeError: Failed to execute \'
has\' on \'FontFaceSet\': The argument is not a FontFace."'); |
| 39 } |
| 40 |
| 41 if (document.fonts) |
| 42 runTests(); |
| 43 else |
| 44 testFailed('document.fonts does not exist'); |
| 45 |
| 46 </script> |
| 47 </head> |
| 48 <body> |
| 49 </body> |
| 50 </html> |
OLD | NEW |