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 thisArg = {}; |
| 27 faces = []; |
| 28 document.fonts.forEach(function(face, faceAgain, set) { |
| 29 if (faces.length == 0) { |
| 30 callbackArgs = arguments; |
| 31 thisValue = this; |
| 32 shouldBeTrue('callbackArgs[0] === callbackArgs[1]'); |
| 33 shouldBeTrue('callbackArgs[2] === document.fonts'); |
| 34 shouldBeTrue('thisValue === thisArg'); |
| 35 } |
| 36 faces.push(face); |
| 37 }, thisArg); |
| 38 shouldBe('faces.length', '3'); |
| 39 |
| 40 shouldBeEqualToString('faces[0].family', 'Font1'); |
| 41 shouldBeEqualToString('faces[1].family', 'Font2'); |
| 42 shouldBeEqualToString('faces[2].family', 'Font3'); |
| 43 |
| 44 shouldBeTrue('document.fonts.has(faces[0])'); |
| 45 shouldBeTrue('document.fonts.has(faces[1])'); |
| 46 shouldBeTrue('document.fonts.has(faces[2])'); |
| 47 shouldBeFalse('document.fonts.has(new FontFace("MyFont", "local(Arial)", {})
)'); |
| 48 shouldThrow('document.fonts.has("Font1")', '"TypeError: Failed to execute \'
has\' on \'FontFaceSet\': The argument is not a FontFace."'); |
| 49 } |
| 50 |
| 51 if (document.fonts) |
| 52 runTests(); |
| 53 else |
| 54 testFailed('document.fonts does not exist'); |
| 55 |
| 56 </script> |
| 57 </head> |
| 58 <body> |
| 59 </body> |
| 60 </html> |
OLD | NEW |