From 1fb404aff2ee61e04b8b74f489154be21086ad06 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 14 Aug 2014 01:31:18 +0200 Subject: [PATCH 1/2] 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). --- test/unit/cmap_spec.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/test/unit/cmap_spec.js b/test/unit/cmap_spec.js index e3c2a0bfa..e7ad60acc 100644 --- a/test/unit/cmap_spec.js +++ b/test/unit/cmap_spec.js @@ -4,6 +4,9 @@ 'use strict'; +var cMapUrl = '../../external/bcmaps/'; +var cMapPacked = true; + describe('cmap', function() { it('parses beginbfchar', function() { var str = '2 beginbfchar\n' + @@ -87,8 +90,10 @@ describe('cmap', function() { it('read usecmap', function() { var str = '/Adobe-Japan1-1 usecmap\n'; var stream = new StringStream(str); - var cmap = CMapFactory.create(stream, null, '../../external/cmaps/'); - expect(cmap.useCMap).toBeDefined(); + var cmap = CMapFactory.create(stream, + { url: cMapUrl, packed: cMapPacked }, null); + expect(cmap.useCMap).not.toBeNull(); + expect(cmap.builtInCMap).toBeUndefined(); }); it('parses wmode', function() { var str = '/WMode 1 def\n'; @@ -97,8 +102,10 @@ describe('cmap', function() { expect(cmap.vertical).toEqual(true); }); it('loads built in cmap', function() { - CMapFactory.create(new Name('Adobe-Japan1-1'), '../../external/cmaps/', - null); + var cmap = CMapFactory.create(new Name('Adobe-Japan1-1'), + { url: cMapUrl, packed: cMapPacked }, null); + expect(cmap.useCMap).toBeNull(); + expect(cmap.builtInCMap).toBeTruthy(); }); }); From b201cc4940da392246d46ccb71d1998e8a6c6c09 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 14 Aug 2014 02:16:35 +0200 Subject: [PATCH 2/2] Remove the remaining references to cidmaps.js from the test suite --- test/font/font_test.html | 1 - test/unit/unit_test.html | 1 - 2 files changed, 2 deletions(-) diff --git a/test/font/font_test.html b/test/font/font_test.html index d0575fffa..ba53249b6 100644 --- a/test/font/font_test.html +++ b/test/font/font_test.html @@ -24,7 +24,6 @@ - diff --git a/test/unit/unit_test.html b/test/unit/unit_test.html index 0b04ff704..94d27eb90 100644 --- a/test/unit/unit_test.html +++ b/test/unit/unit_test.html @@ -23,7 +23,6 @@ -