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: Font1; | 6 font-family: Font1; |
7 src: url(../../resources/Ahem.ttf); | 7 src: url(../../resources/Ahem.ttf?font1); |
8 } | 8 } |
9 | 9 |
10 @font-face { | 10 @font-face { |
11 font-family: Font2; | 11 font-family: Font2; |
12 src: url(../../resources/DownLoadErrorAhem.otf); | 12 src: url(../../resources/DownLoadErrorAhem.otf); |
13 } | 13 } |
14 </style> | 14 </style> |
15 <script> | 15 <script> |
16 description('Tests load() method of FontFace.'); | 16 description('Tests load() method of FontFace.'); |
17 | 17 |
(...skipping 26 matching lines...) Expand all Loading... |
44 shouldBeEqualToString('face1.status', 'loaded'); | 44 shouldBeEqualToString('face1.status', 'loaded'); |
45 | 45 |
46 shouldBeEqualToString('face2.status', 'unloaded'); | 46 shouldBeEqualToString('face2.status', 'unloaded'); |
47 face2.load().then(fail('face2.load() fulfilled'), testStep3); | 47 face2.load().then(fail('face2.load() fulfilled'), testStep3); |
48 shouldBeEqualToString('face2.status', 'loading'); | 48 shouldBeEqualToString('face2.status', 'loading'); |
49 } | 49 } |
50 | 50 |
51 function testStep3() { | 51 function testStep3() { |
52 shouldBeEqualToString('face2.status', 'error'); | 52 shouldBeEqualToString('face2.status', 'error'); |
53 | 53 |
54 face3 = new FontFace('Font3', 'url(../../resources/Ahem.ttf)', {}); | 54 face3 = new FontFace('Font3', 'url(../../resources/Ahem.ttf?font3)', {}); |
55 shouldBeEqualToString('face3.status', 'unloaded'); | 55 shouldBeEqualToString('face3.status', 'unloaded'); |
56 face3.load(); | 56 face3.load(); |
57 shouldBeEqualToString('face3.status', 'loading'); | 57 shouldBeEqualToString('face3.status', 'loading'); |
58 face3.loaded.then(testStep4, fail('face3.load() rejected')); | 58 face3.loaded.then(testStep4, fail('face3.load() rejected')); |
59 } | 59 } |
60 | 60 |
61 function testStep4() { | 61 function testStep4() { |
62 shouldBeEqualToString('face3.status', 'loaded'); | 62 shouldBeEqualToString('face3.status', 'loaded'); |
63 | 63 |
64 face4 = new FontFace('Font4', 'url(../../resources/DownLoadErrorAhem.otf)',
{}); | 64 face4 = new FontFace('Font4', 'url(../../resources/DownLoadErrorAhem.otf)',
{}); |
65 shouldBeEqualToString('face4.status', 'unloaded'); | 65 shouldBeEqualToString('face4.status', 'unloaded'); |
66 face4.load(); | 66 face4.load(); |
67 shouldBeEqualToString('face4.status', 'loading'); | 67 shouldBeEqualToString('face4.status', 'loading'); |
68 face4.loaded.then(fail('face4.load() fulfilled'), testStep5); | 68 face4.loaded.then(fail('face4.load() fulfilled'), testStep5); |
69 } | 69 } |
70 | 70 |
71 function testStep5() { | 71 function testStep5() { |
72 shouldBeEqualToString('face4.status', 'error'); | 72 shouldBeEqualToString('face4.status', 'error'); |
73 | 73 |
74 face5 = new FontFace('Font5', 'url(data:font/truetype;base64,), url(../../re
sources/Ahem.ttf)', {}); | 74 face5 = new FontFace('Font5', 'url(data:font/truetype;base64,), url(../../re
sources/Ahem.ttf?font5)', {}); |
75 shouldBeEqualToString('face5.status', 'unloaded'); | 75 shouldBeEqualToString('face5.status', 'unloaded'); |
76 face5.load().then(testStep6, fail('face5.load() rejected')); | 76 face5.load().then(testStep6, fail('face5.load() rejected')); |
77 shouldBeEqualToString('face5.status', 'loading'); | 77 shouldBeEqualToString('face5.status', 'loading'); |
78 } | 78 } |
79 | 79 |
80 function testStep6() { | 80 function testStep6() { |
81 shouldBeEqualToString('face5.status', 'loaded'); | 81 shouldBeEqualToString('face5.status', 'loaded'); |
82 finishJSTest(); | 82 finishJSTest(); |
83 } | 83 } |
84 | 84 |
85 if (document.fonts) | 85 if (document.fonts) |
86 testStep1(); | 86 testStep1(); |
87 else | 87 else |
88 testFailed('document.fonts does not exist'); | 88 testFailed('document.fonts does not exist'); |
89 | 89 |
90 </script> | 90 </script> |
91 </head> | 91 </head> |
92 <body> | 92 <body> |
93 </body> | 93 </body> |
94 </html> | 94 </html> |
OLD | NEW |