3 <script src=
"../../resources/js-test.js"></script>
7 src: url('../../resources/DownLoadErrorAhem.ttf'), url(../../resources/Ahem.ttf);
11 font-family: TestFont;
12 src: url('../../resources/DownLoadErrorAhem.otf');
13 unicode-range: u+
61-
7a; /* 'a'-'z' */
17 description('Test load events for a font family consists of multiple @font-faces, including download error.');
19 window
.jsTestIsAsync
= true;
22 document
.fonts
.addEventListener('loading', onLoading
);
23 document
.fonts
.addEventListener('loadingdone', onLoadingDone
);
24 document
.fonts
.addEventListener('loadingerror', onLoadingError
);
25 document
.fonts
.ready
.then(finish
);
27 document
.fonts
.load('10px TestFont', 'abc').catch(function() {});
33 function onLoading(e
) {
34 firedEvents
.push(e
.type
);
37 function onLoadingDone(e
) {
38 firedEvents
.push(e
.type
);
40 shouldBe("event.fontfaces.length", "1");
41 shouldBeEqualToString("event.fontfaces[0].unicodeRange", "U+0-10FFFF");
42 shouldBeEqualToString("event.fontfaces[0].status", "loaded");
43 loadingdoneFired
= true;
46 function onLoadingError(e
) {
47 firedEvents
.push(e
.type
);
49 shouldBe("event.fontfaces.length", "1");
50 shouldBeEqualToString("event.fontfaces[0].unicodeRange", "U+61-7A");
51 shouldBeEqualToString("event.fontfaces[0].status", "error");
52 shouldBeFalse("document.fonts.check('10px TestFont', 'abc')");
56 shouldBe("firedEvents", "['loading', 'loadingdone', 'loadingerror']");
63 testFailed('document.fonts does not exist');