| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../js/resources/js-test-pre.js"></script> | 3 <script src="../js/resources/js-test-pre.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 window.jsTestIsAsync = true; | |
| 20 | |
| 21 function runTests() { | 19 function runTests() { |
| 22 document.fonts.onloadingdone = verify; | 20 ahemFace = document.fonts.match('italic small-caps 10px Ahem')[0]; |
| 23 document.fonts.loadFont({'font': 'italic small-caps 10px Ahem'}); | |
| 24 } | |
| 25 | |
| 26 function verify(e) { | |
| 27 ahemFace = e.fontfaces[0]; | |
| 28 shouldBeEqualToString('ahemFace.family', 'Ahem'); | 21 shouldBeEqualToString('ahemFace.family', 'Ahem'); |
| 29 shouldBeEqualToString('ahemFace.style', 'italic'); | 22 shouldBeEqualToString('ahemFace.style', 'italic'); |
| 30 shouldBeEqualToString('ahemFace.weight', '300'); | 23 shouldBeEqualToString('ahemFace.weight', '300'); |
| 31 shouldBeEqualToString('ahemFace.unicodeRange', 'U+0-3FF'); | 24 shouldBeEqualToString('ahemFace.unicodeRange', 'U+0-3FF'); |
| 32 shouldBeEqualToString('ahemFace.variant', 'small-caps'); | 25 shouldBeEqualToString('ahemFace.variant', 'small-caps'); |
| 33 shouldBeEqualToString('ahemFace.featureSettings', "'dlig' 1"); | 26 shouldBeEqualToString('ahemFace.featureSettings', "'dlig' 1"); |
| 34 | 27 |
| 35 debug(''); | 28 debug(''); |
| 36 defaultFace = new FontFace('defaultFace', 'local(foo)', {}); | 29 defaultFace = new FontFace('defaultFace', 'local(foo)', {}); |
| 37 shouldBeEqualToString('defaultFace.family', 'defaultFace'); | 30 shouldBeEqualToString('defaultFace.family', 'defaultFace'); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 67 |
| 75 debug(''); | 68 debug(''); |
| 76 var syntaxError = "'SyntaxError: An invalid or illegal string was specified.
'"; | 69 var syntaxError = "'SyntaxError: An invalid or illegal string was specified.
'"; |
| 77 shouldThrow("new FontFace('test', 'invalid_src', {})", syntaxError); | 70 shouldThrow("new FontFace('test', 'invalid_src', {})", syntaxError); |
| 78 face = new FontFace('test', 'local(foo)', {}); | 71 face = new FontFace('test', 'local(foo)', {}); |
| 79 shouldThrow("face.style = ''", syntaxError); | 72 shouldThrow("face.style = ''", syntaxError); |
| 80 shouldThrow("face.weight = 'a'", syntaxError); | 73 shouldThrow("face.weight = 'a'", syntaxError); |
| 81 shouldThrow("face.unicodeRange = 'U+'", syntaxError); | 74 shouldThrow("face.unicodeRange = 'U+'", syntaxError); |
| 82 shouldThrow("face.variant = '???'", syntaxError); | 75 shouldThrow("face.variant = '???'", syntaxError); |
| 83 shouldThrow("face.featureSettings = null", syntaxError); | 76 shouldThrow("face.featureSettings = null", syntaxError); |
| 84 | |
| 85 finishJSTest(); | |
| 86 } | 77 } |
| 87 | 78 |
| 88 if (document.fonts) | 79 if (document.fonts) |
| 89 runTests(); | 80 runTests(); |
| 90 else { | 81 else { |
| 91 testFailed('document.fonts does not exist'); | 82 testFailed('document.fonts does not exist'); |
| 92 finishJSTest(); | |
| 93 } | 83 } |
| 94 </script> | 84 </script> |
| 95 </head> | 85 </head> |
| 96 <body> | 86 <body> |
| 97 <script src="../js/resources/js-test-post.js"></script> | 87 <script src="../js/resources/js-test-post.js"></script> |
| 98 </body> | 88 </body> |
| 99 </html> | 89 </html> |
| OLD | NEW |