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: 'Ahem'; | 6 font-family: 'Ahem'; |
7 src: url(../../resources/Ahem.ttf); | 7 src: url(../../resources/Ahem.ttf); |
8 font-style: italic; | 8 font-style: italic; |
9 font-weight: 300; | 9 font-weight: 300; |
10 unicode-range: U+0-3FF; | 10 unicode-range: U+0-3FF; |
11 font-variant: small-caps; | 11 font-variant: small-caps; |
12 -webkit-font-feature-settings: "dlig" 1; | 12 -webkit-font-feature-settings: "dlig" 1; |
13 /* font-stretch property is not supported */ | 13 /* font-stretch property is not supported */ |
14 } | 14 } |
15 </style> | 15 </style> |
16 <script> | 16 <script> |
17 description('Test getting/setting FontFace properties.'); | 17 description('Test getting/setting FontFace properties.'); |
18 | 18 |
19 function getDocumentFontFaces() { | 19 function getDocumentFontFaces() { |
20 var faces = []; | 20 var faces = []; |
21 document.fonts.forEach(function(face) { faces.push(face); }); | 21 document.fonts.forEach(function(face) { faces.push(face); }); |
22 return faces; | 22 return faces; |
23 } | 23 } |
24 | 24 |
25 function runTests() { | 25 function runTests() { |
| 26 window.jsTestIsAsync = true; |
26 ahemFace = getDocumentFontFaces()[0]; | 27 ahemFace = getDocumentFontFaces()[0]; |
27 shouldBeEqualToString('ahemFace.family', 'Ahem'); | 28 shouldBeEqualToString('ahemFace.family', 'Ahem'); |
28 shouldBeEqualToString('ahemFace.style', 'italic'); | 29 shouldBeEqualToString('ahemFace.style', 'italic'); |
29 shouldBeEqualToString('ahemFace.weight', '300'); | 30 shouldBeEqualToString('ahemFace.weight', '300'); |
30 shouldBeEqualToString('ahemFace.unicodeRange', 'U+0-3FF'); | 31 shouldBeEqualToString('ahemFace.unicodeRange', 'U+0-3FF'); |
31 shouldBeEqualToString('ahemFace.variant', 'small-caps'); | 32 shouldBeEqualToString('ahemFace.variant', 'small-caps'); |
32 shouldBeEqualToString('ahemFace.featureSettings', "'dlig' 1"); | 33 shouldBeEqualToString('ahemFace.featureSettings', "'dlig' 1"); |
33 | 34 |
34 debug(''); | 35 debug(''); |
35 defaultFace = new FontFace('defaultFace', 'local(foo)'); | 36 defaultFace = new FontFace('defaultFace', 'local(foo)'); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 promise2 = face.load(); | 83 promise2 = face.load(); |
83 promise3 = face.loaded; | 84 promise3 = face.loaded; |
84 shouldBeTrue('promise1 === promise2'); | 85 shouldBeTrue('promise1 === promise2'); |
85 shouldBeTrue('promise1 === promise3'); | 86 shouldBeTrue('promise1 === promise3'); |
86 | 87 |
87 promise1.then( | 88 promise1.then( |
88 function() { | 89 function() { |
89 debug('FAIL: Expected NetworkError'); | 90 debug('FAIL: Expected NetworkError'); |
90 }).catch(function(err) { | 91 }).catch(function(err) { |
91 shouldBeEqualToString('"' + err.message + '"' , 'A network error oc
curred.'); | 92 shouldBeEqualToString('"' + err.message + '"' , 'A network error oc
curred.'); |
92 }); | 93 }).then(finishJSTest); |
93 } | 94 } |
94 | 95 |
95 if (document.fonts) | 96 if (document.fonts) |
96 runTests(); | 97 runTests(); |
97 else { | 98 else { |
98 testFailed('document.fonts does not exist'); | 99 testFailed('document.fonts does not exist'); |
99 } | 100 } |
100 </script> | 101 </script> |
101 </head> | 102 </head> |
102 <body> | 103 <body> |
103 </body> | 104 </body> |
104 </html> | 105 </html> |
OLD | NEW |