| OLD | NEW |
| (Empty) |
| 1 library fontface_loaded_test; | |
| 2 | |
| 3 import 'package:unittest/unittest.dart'; | |
| 4 import 'package:unittest/html_config.dart'; | |
| 5 | |
| 6 import 'dart:async'; | |
| 7 import 'dart:isolate'; | |
| 8 import 'dart:html'; | |
| 9 | |
| 10 class NullTreeSanitizer implements NodeTreeSanitizer { | |
| 11 void sanitizeTree(Node node) {} | |
| 12 } | |
| 13 | |
| 14 main() { | |
| 15 useHtmlConfiguration(); | |
| 16 | |
| 17 var style = new Element.html(''' | |
| 18 <style> | |
| 19 @font-face { | |
| 20 font-family: 'Ahem'; | |
| 21 src: url(../../resources/Ahem.ttf); | |
| 22 font-style: italic; | |
| 23 font-weight: 300; | |
| 24 unicode-range: U+0-3FF; | |
| 25 font-variant: small-caps; | |
| 26 -webkit-font-feature-settings: "dlig" 1; | |
| 27 /* font-stretch property is not supported */ | |
| 28 } | |
| 29 </style> | |
| 30 ''', treeSanitizer: new NullTreeSanitizer()); | |
| 31 document.head.append(style); | |
| 32 | |
| 33 | |
| 34 test('document fonts - temporary', () { | |
| 35 var atLeastOneFont = false; | |
| 36 document.fonts.forEach((FontFace fontFace, _, __) { | |
| 37 atLeastOneFont = true; | |
| 38 Future f1 = fontFace.loaded; | |
| 39 Future f2 = fontFace.loaded; | |
| 40 expect(f1, equals(f2)); // Repeated calls should answer the same Future. | |
| 41 | |
| 42 expect(fontFace.load(), throws); | |
| 43 }); | |
| 44 expect(atLeastOneFont, isTrue); | |
| 45 }); | |
| 46 } | |
| OLD | NEW |