Browse Source

Fix CMap unit tests

When the binary CMaps were added, some of the relevant unit tests were not changed. This patch updates them, so that we actually test the current implementation.
What's somewhat troubling here is that we currently have CMap unit tests that passes, *despite* not working as intended (the CMap files doesn't load).
Jonas Jenwald 11 years ago
parent
commit
1fb404aff2
  1. 15
      test/unit/cmap_spec.js

15
test/unit/cmap_spec.js

@ -4,6 +4,9 @@
'use strict'; 'use strict';
var cMapUrl = '../../external/bcmaps/';
var cMapPacked = true;
describe('cmap', function() { describe('cmap', function() {
it('parses beginbfchar', function() { it('parses beginbfchar', function() {
var str = '2 beginbfchar\n' + var str = '2 beginbfchar\n' +
@ -87,8 +90,10 @@ describe('cmap', function() {
it('read usecmap', function() { it('read usecmap', function() {
var str = '/Adobe-Japan1-1 usecmap\n'; var str = '/Adobe-Japan1-1 usecmap\n';
var stream = new StringStream(str); var stream = new StringStream(str);
var cmap = CMapFactory.create(stream, null, '../../external/cmaps/'); var cmap = CMapFactory.create(stream,
expect(cmap.useCMap).toBeDefined(); { url: cMapUrl, packed: cMapPacked }, null);
expect(cmap.useCMap).not.toBeNull();
expect(cmap.builtInCMap).toBeUndefined();
}); });
it('parses wmode', function() { it('parses wmode', function() {
var str = '/WMode 1 def\n'; var str = '/WMode 1 def\n';
@ -97,8 +102,10 @@ describe('cmap', function() {
expect(cmap.vertical).toEqual(true); expect(cmap.vertical).toEqual(true);
}); });
it('loads built in cmap', function() { it('loads built in cmap', function() {
CMapFactory.create(new Name('Adobe-Japan1-1'), '../../external/cmaps/', var cmap = CMapFactory.create(new Name('Adobe-Japan1-1'),
null); { url: cMapUrl, packed: cMapPacked }, null);
expect(cmap.useCMap).toBeNull();
expect(cmap.builtInCMap).toBeTruthy();
}); });
}); });

Loading…
Cancel
Save