Merge pull request #7175 from Snuffleupagus/issue-6905-font_spec
Use `beforeAll`/`afterAll` in font_spec.js (issue 6905)
This commit is contained in:
commit
44c63bca28
@ -1,9 +1,21 @@
|
|||||||
/* globals expect, it, describe, CFFCompiler, CFFParser, CFFIndex, CFFStrings,
|
/* globals expect, it, describe, CFFCompiler, CFFParser, CFFIndex, CFFStrings,
|
||||||
Type1Parser, StringStream, SEAC_ANALYSIS_ENABLED */
|
Type1Parser, StringStream, SEAC_ANALYSIS_ENABLED, Stream, beforeAll,
|
||||||
|
afterAll */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
describe('font', function() {
|
describe('font', function() {
|
||||||
|
function createWithNullProto(obj) {
|
||||||
|
var result = Object.create(null);
|
||||||
|
for (var i in obj) {
|
||||||
|
result[i] = obj[i];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
var fontData;
|
||||||
|
|
||||||
|
beforeAll(function (done) {
|
||||||
// This example font comes from the CFF spec:
|
// This example font comes from the CFF spec:
|
||||||
// http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5176.CFF.pdf
|
// http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5176.CFF.pdf
|
||||||
var exampleFont = '0100040100010101134142434445462b' +
|
var exampleFont = '0100040100010101134142434445462b' +
|
||||||
@ -16,29 +28,31 @@ describe('font', function() {
|
|||||||
'8b06f79a93fc7c8c077d99f85695f75e' +
|
'8b06f79a93fc7c8c077d99f85695f75e' +
|
||||||
'9908fb6e8cf87393f7108b09a70adf0b' +
|
'9908fb6e8cf87393f7108b09a70adf0b' +
|
||||||
'f78e14';
|
'f78e14';
|
||||||
var fontData = [];
|
var fontArr = [];
|
||||||
for (var i = 0; i < exampleFont.length; i += 2) {
|
for (var i = 0, ii = exampleFont.length; i < ii; i += 2) {
|
||||||
var hex = exampleFont.substr(i, 2);
|
var hex = exampleFont.substr(i, 2);
|
||||||
fontData.push(parseInt(hex, 16));
|
fontArr.push(parseInt(hex, 16));
|
||||||
}
|
}
|
||||||
var bytes = new Uint8Array(fontData);
|
fontData = new Stream(fontArr);
|
||||||
fontData = {
|
done();
|
||||||
getBytes: function() {
|
});
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function createWithNullProto(obj) {
|
afterAll(function () {
|
||||||
var result = Object.create(null);
|
fontData = null;
|
||||||
for (var i in obj) {
|
});
|
||||||
result[i] = obj[i];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('CFFParser', function() {
|
describe('CFFParser', function() {
|
||||||
var parser = new CFFParser(fontData, {}, SEAC_ANALYSIS_ENABLED);
|
var parser, cff;
|
||||||
var cff = parser.parse();
|
|
||||||
|
beforeAll(function (done) {
|
||||||
|
parser = new CFFParser(fontData, {}, SEAC_ANALYSIS_ENABLED);
|
||||||
|
cff = parser.parse();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(function () {
|
||||||
|
parser = cff = null;
|
||||||
|
});
|
||||||
|
|
||||||
it('parses header', function() {
|
it('parses header', function() {
|
||||||
var header = cff.header;
|
var header = cff.header;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user