|
|
@ -1,6 +1,7 @@ |
|
|
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
|
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
|
|
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ |
|
|
|
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ |
|
|
|
/* globals expect, it, describe, StringStream, CMapFactory, Name */ |
|
|
|
/* globals expect, it, describe, StringStream, CMapFactory, Name, CMap, |
|
|
|
|
|
|
|
IdentityCMap */ |
|
|
|
|
|
|
|
|
|
|
|
'use strict'; |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
|
@ -92,8 +93,16 @@ describe('cmap', function() { |
|
|
|
var stream = new StringStream(str); |
|
|
|
var stream = new StringStream(str); |
|
|
|
var cmap = CMapFactory.create(stream, |
|
|
|
var cmap = CMapFactory.create(stream, |
|
|
|
{ url: cMapUrl, packed: cMapPacked }, null); |
|
|
|
{ url: cMapUrl, packed: cMapPacked }, null); |
|
|
|
|
|
|
|
expect(cmap instanceof CMap).toEqual(true); |
|
|
|
expect(cmap.useCMap).not.toBeNull(); |
|
|
|
expect(cmap.useCMap).not.toBeNull(); |
|
|
|
expect(cmap.builtInCMap).toBeUndefined(); |
|
|
|
expect(cmap.builtInCMap).toBeFalsy(); |
|
|
|
|
|
|
|
expect(cmap.isIdentityCMap).toEqual(false); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
it('parses cmapname', function() { |
|
|
|
|
|
|
|
var str = '/CMapName /Identity-H def\n'; |
|
|
|
|
|
|
|
var stream = new StringStream(str); |
|
|
|
|
|
|
|
var cmap = CMapFactory.create(stream); |
|
|
|
|
|
|
|
expect(cmap.name).toEqual('Identity-H'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
it('parses wmode', function() { |
|
|
|
it('parses wmode', function() { |
|
|
|
var str = '/WMode 1 def\n'; |
|
|
|
var str = '/WMode 1 def\n'; |
|
|
@ -104,7 +113,17 @@ describe('cmap', function() { |
|
|
|
it('loads built in cmap', function() { |
|
|
|
it('loads built in cmap', function() { |
|
|
|
var cmap = CMapFactory.create(new Name('Adobe-Japan1-1'), |
|
|
|
var cmap = CMapFactory.create(new Name('Adobe-Japan1-1'), |
|
|
|
{ url: cMapUrl, packed: cMapPacked }, null); |
|
|
|
{ url: cMapUrl, packed: cMapPacked }, null); |
|
|
|
|
|
|
|
expect(cmap instanceof CMap).toEqual(true); |
|
|
|
expect(cmap.useCMap).toBeNull(); |
|
|
|
expect(cmap.useCMap).toBeNull(); |
|
|
|
expect(cmap.builtInCMap).toBeTruthy(); |
|
|
|
expect(cmap.builtInCMap).toBeTruthy(); |
|
|
|
|
|
|
|
expect(cmap.isIdentityCMap).toEqual(false); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
it('loads built in identity cmap', function() { |
|
|
|
|
|
|
|
var cmap = CMapFactory.create(new Name('Identity-H'), |
|
|
|
|
|
|
|
{ url: cMapUrl, packed: cMapPacked }, null); |
|
|
|
|
|
|
|
expect(cmap instanceof IdentityCMap).toEqual(true); |
|
|
|
|
|
|
|
expect(cmap.vertical).toEqual(false); |
|
|
|
|
|
|
|
expect(function() { return cmap.isIdentityCMap; }).toThrow( |
|
|
|
|
|
|
|
new Error('should not access .isIdentityCMap')); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|