comunic/3rdparty/pdf.js/test/font/font_os2_spec.js

41 lines
39 KiB
JavaScript
Raw Normal View History

2016-11-19 11:08:12 +00:00
'use strict';
describe('font_post', function() {
var font2154 = decodeFontData('AAEAAAANAIAAAwBQT1MvMpxkBm8AAADcAAAAVmNtYXDwD/A1AAABNAAAAC5jdnQgJsYFBAAAAWQAAADuZnBnbTQnXAoAAAJUAAACh2dseWbDL/rtAAAE3AAAAGBoZWFkxW7T6QAABTwAAAA2aGhlYQ37B2cAAAV0AAAAJGhtdHhvP0naAAAFmAAAA8hsb2NhFrAWsAAACWAAAAHmbWF4cAJLAyUAAAtIAAAAIG5hbWUnzzMmAAALaAAAA3pwb3N0AAMAAAAADuQAAAAgcHJlcFbFIB8AAA8EAAABhwABAxMBkAAFAAYFmgUzAAABJQWaBTMAAAOgAGYCEgAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAABHbHlmsUAAIPtPBeH94QAABeECBgAAACAAAAAAAAAAAAABAAMAAQAAAAwABAAiAAAABAAEAAEAAPAA//8AAPAA//8AAAABAAQAAAAAAAAFeQAIBYAAFQSP/9sD1AAVAAD/6wAA/+v/4f/3/s//9wTyAJP/K//nA/gAKAQ5ABEEVgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMgCbAMMA0gDhAKAArwBkAAAAAAAAAAAAMgCMAJsArwC+ANcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////////wAAAAAAAAAAAABAGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAsigNFioqHsAErsEcjRLBHeuQYLSwgabBAYbAAiyCxAsCKjLgQAGJgKwxkI2RhXFiwA2FZLSwhIQxkI2SLuEAAYi0sIbCAUVgMZCNki7ggAGIbsgBABStZsAJgLSwhsMBRWAxkI2SLuB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AWAP8ADUENQBSA4sAEgUXABkEqAA5AAAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAAAAAQAAAPIAWwAHAAAAAAACABAAQACWAAAApQKHAAYAAQAAAAoAfgABAAAAAAAAAMMAAAABAAAAAAADAA8AwwABAAAAAAAEAA8A0gABAAAAAAAGAA8A4QADAAEECQAAAYYA8AADAAEECQABAB4CdgADAAEECQACAA4ClAADAAEECQADAB4CogADAAEECQAEAB4CwAADAAEECQAGAB4C3l
var font1282 = decodeFontData('AAEAAAANAIAAAwBQT1MvMlJpU/gAAADcAAAATmNtYXCFppKjAAABLAAACnpjdnQglnDSdgAAC6gAAAYwZnBnbcx5WZoAABHYAAAGbmdseWYHpqdrAAAYSAAAEkZoZWFkzS3ungAAKpAAAAA2aGhlYRJtEaoAACrIAAAAJGhtdHjKonNAAAAq7AAAFKBsb2NhAFYgrgAAP4wAABSkbWF4cAnkAZUAAFQwAAAAIG5hbWWb1Qw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ZgRnBGgEaQRqBGsEbARtBG4EbwRwBHEEcgRzBHQEdQR2BHcEeAR5BHoEewR8BH0EfgR/BIAEgQSCBIMEhASFBIYEhwSIBIkEigSLBIwEjQSOBI8EkASRBJIEkwSUBJUElgSXBJgEmQSaBJsEnASdBJ4EnwSgBKEEogSjBKQEpQSmBKcEqASpBKoEqwSsBK0ErgSvBLAEsQSyBLMEtAS1BLYEtwS4BLkEugS7BLwEvQS+BL8EwATBBMIEwwTEBMUExgTHBMgEyQTKBMsEzATNBM4EzwTQBNEE0gTTBNQE1QTWBNcE2ATZBNoE2wTcBN0E3gTfBOAE4QTiBOME5ATlBOYE5wToBOkE6gTrBOwE7QTuBO8E8ATxBPIE8wT0BPUE9gT3BPgE+QT6BPsE/AT9BP4E/wUABQEFAgUDBQQFBQUGBQcFCAUJBQoFCwUMBQ0FDgUPBRAFEQUSBRMFFAUVBRYFFwUYBRkFGgUbBRwFHQUeBR8FIAUhBSIFIwUkBSUFJgUnAAAFugAZBboAGgWnABkEJgAYAAD/5wAA/+gAAP/n/mn/6AW6ABn+af/oAuoAAAC4AAAAuAAAAAAAqACtAWkArQ
describe('OS/2 table removal on bad post table values', function() {
it('has invalid version number', function() {
var output;
waitsFor(function() { return output; }, 10000);
var font = new Font("font", new Stream(font2154), {
loadedName: 'font',
type: 'TrueType',
differences: [],
defaultEncoding: []
});
ttx(font.data, function(result) { output = result; });
runs(function() {
verifyTtxOutput(output);
expect(/<OS_2>\s*<version value="3"\/>/.test(output)).toEqual(true);
});
});
it('has invalid selection attributes presence', function() {
var output;
waitsFor(function() { return output; }, 10000);
var font = new Font("font", new Stream(font1282), {
loadedName: 'font',
type: 'CIDFontType2',
differences: [],
defaultEncoding: [],
cMap: CMapFactory.create(new Name('Identity-H'))
});
ttx(font.data, function(result) { output = result; });
runs(function() {
verifyTtxOutput(output);
expect(/<OS_2>\s*<version value="3"\/>/.test(output)).toEqual(true);
});
});
});
});