blob: b5bdcd38353f7db62aeeacb4c22ef99819c11a58 [file] [log] [blame]
<!doctype html>
<script src="../../resources/js-test.js"></script>
<script>
description('Test FontFace constructor with invalid parameters');
window.jsTestIsAsync = true;
function step1() {
faceWithWrongSrc = new FontFace('test', 'invalid_src');
shouldBeEqualToString('faceWithWrongSrc.status', 'error');
faceWithWrongSrc.loaded.catch(function(e) {
rejectionValue = e;
shouldBeEqualToString('rejectionValue.name', 'SyntaxError');
step2();
});
}
function step2() {
faceWithWrongDescriptors = new FontFace('test', 'local(Arial)', {
'style': 'x',
'weight': 'x',
'unicodeRange': 'x',
'variant': 'x',
'featureSettings': 'x'
});
shouldBeEqualToString('faceWithWrongDescriptors.status', 'error');
shouldBeEqualToString('faceWithWrongDescriptors.style', 'normal');
shouldBeEqualToString('faceWithWrongDescriptors.weight', 'normal');
shouldBeEqualToString('faceWithWrongDescriptors.unicodeRange', 'U+0-10FFFF');
shouldBeEqualToString('faceWithWrongDescriptors.variant', 'normal');
shouldBeEqualToString('faceWithWrongDescriptors.featureSettings', 'normal');
faceWithWrongDescriptors.loaded.catch(function(e) {
rejectionValue = e;
shouldBeEqualToString('rejectionValue.name', 'SyntaxError');
finishJSTest();
});
}
step1();
</script>