Browse Source

PDF.js version 1.8.585 - See mozilla/pdf.js@783d42ec2b92bb6cb953d8ee6f7764ba7ad74306

master v1.8.585
pdfjsbot 8 years ago
parent
commit
6adbfc165d
  1. 2
      bower.json
  2. 18
      build/pdf.combined.js
  3. 2
      build/pdf.combined.js.map
  4. 12
      build/pdf.js
  5. 2
      build/pdf.js.map
  6. 4
      build/pdf.min.js
  7. 10
      build/pdf.worker.js
  8. 2
      build/pdf.worker.js.map
  9. 6
      build/pdf.worker.min.js
  10. 6
      lib/core/colorspace.js
  11. 4
      lib/display/api.js
  12. 4
      lib/display/global.js
  13. 4
      lib/pdf.js
  14. 4
      lib/pdf.worker.js
  15. 303
      lib/test/unit/colorspace_spec.js
  16. 2
      lib/test/unit/jasmine-boot.js
  17. 2
      package.json

2
bower.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "1.8.583",
"version": "1.8.585",
"main": [
"build/pdf.js",
"build/pdf.worker.js"

18
build/pdf.combined.js

@ -4494,11 +4494,7 @@ var CalRGBCS = function CalRGBCSClosure() { @@ -4494,11 +4494,7 @@ var CalRGBCS = function CalRGBCSClosure() {
dest[destOffset + 2] = Math.round(sB * 255);
}
CalRGBCS.prototype = {
getRgb: function CalRGBCS_getRgb(src, srcOffset) {
var rgb = new Uint8Array(3);
this.getRgbItem(src, srcOffset, rgb, 0);
return rgb;
},
getRgb: ColorSpace.prototype.getRgb,
getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) {
convertToRgb(this, src, srcOffset, dest, destOffset, 1);
},
@ -7075,8 +7071,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -7075,8 +7071,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.583';
exports.build = build = '27b49a34';
exports.version = version = '1.8.585';
exports.build = build = '783d42ec';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -28161,8 +28157,8 @@ if (!_util.globalScope.PDFJS) { @@ -28161,8 +28157,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.583';
PDFJS.build = '27b49a34';
PDFJS.version = '1.8.585';
PDFJS.build = '783d42ec';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -47633,8 +47629,8 @@ exports.PDFDataTransportStream = PDFDataTransportStream; @@ -47633,8 +47629,8 @@ exports.PDFDataTransportStream = PDFDataTransportStream;
"use strict";
var pdfjsVersion = '1.8.583';
var pdfjsBuild = '27b49a34';
var pdfjsVersion = '1.8.585';
var pdfjsBuild = '783d42ec';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(24);
var pdfjsDisplayAPI = __w_pdfjs_require__(7);

2
build/pdf.combined.js.map

File diff suppressed because one or more lines are too long

12
build/pdf.js

@ -3322,8 +3322,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -3322,8 +3322,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.583';
exports.build = build = '27b49a34';
exports.version = version = '1.8.585';
exports.build = build = '783d42ec';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -6033,8 +6033,8 @@ if (!_util.globalScope.PDFJS) { @@ -6033,8 +6033,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.583';
PDFJS.build = '27b49a34';
PDFJS.version = '1.8.585';
PDFJS.build = '783d42ec';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -12311,8 +12311,8 @@ exports.PDFDataTransportStream = PDFDataTransportStream; @@ -12311,8 +12311,8 @@ exports.PDFDataTransportStream = PDFDataTransportStream;
"use strict";
var pdfjsVersion = '1.8.583';
var pdfjsBuild = '27b49a34';
var pdfjsVersion = '1.8.585';
var pdfjsBuild = '783d42ec';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(8);
var pdfjsDisplayAPI = __w_pdfjs_require__(2);

2
build/pdf.js.map

File diff suppressed because one or more lines are too long

4
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

10
build/pdf.worker.js vendored

@ -4206,11 +4206,7 @@ var CalRGBCS = function CalRGBCSClosure() { @@ -4206,11 +4206,7 @@ var CalRGBCS = function CalRGBCSClosure() {
dest[destOffset + 2] = Math.round(sB * 255);
}
CalRGBCS.prototype = {
getRgb: function CalRGBCS_getRgb(src, srcOffset) {
var rgb = new Uint8Array(3);
this.getRgbItem(src, srcOffset, rgb, 0);
return rgb;
},
getRgb: ColorSpace.prototype.getRgb,
getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) {
convertToRgb(this, src, srcOffset, dest, destOffset, 1);
},
@ -39936,8 +39932,8 @@ exports.Type1Parser = Type1Parser; @@ -39936,8 +39932,8 @@ exports.Type1Parser = Type1Parser;
"use strict";
var pdfjsVersion = '1.8.583';
var pdfjsBuild = '27b49a34';
var pdfjsVersion = '1.8.585';
var pdfjsBuild = '783d42ec';
var pdfjsCoreWorker = __w_pdfjs_require__(17);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

2
build/pdf.worker.js.map vendored

File diff suppressed because one or more lines are too long

6
build/pdf.worker.min.js vendored

File diff suppressed because one or more lines are too long

6
lib/core/colorspace.js

@ -806,11 +806,7 @@ var CalRGBCS = function CalRGBCSClosure() { @@ -806,11 +806,7 @@ var CalRGBCS = function CalRGBCSClosure() {
dest[destOffset + 2] = Math.round(sB * 255);
}
CalRGBCS.prototype = {
getRgb: function CalRGBCS_getRgb(src, srcOffset) {
var rgb = new Uint8Array(3);
this.getRgbItem(src, srcOffset, rgb, 0);
return rgb;
},
getRgb: ColorSpace.prototype.getRgb,
getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) {
convertToRgb(this, src, srcOffset, dest, destOffset, 1);
},

4
lib/display/api.js

@ -1567,8 +1567,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -1567,8 +1567,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.583';
exports.build = build = '27b49a34';
exports.version = version = '1.8.585';
exports.build = build = '783d42ec';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

4
lib/display/global.js

@ -39,8 +39,8 @@ if (!_util.globalScope.PDFJS) { @@ -39,8 +39,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.583';
PDFJS.build = '27b49a34';
PDFJS.version = '1.8.585';
PDFJS.build = '783d42ec';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

4
lib/pdf.js

@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
*/
'use strict';
var pdfjsVersion = '1.8.583';
var pdfjsBuild = '27b49a34';
var pdfjsVersion = '1.8.585';
var pdfjsBuild = '783d42ec';
var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayGlobal = require('./display/global.js');
var pdfjsDisplayAPI = require('./display/api.js');

4
lib/pdf.worker.js vendored

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
*/
'use strict';
var pdfjsVersion = '1.8.583';
var pdfjsBuild = '27b49a34';
var pdfjsVersion = '1.8.585';
var pdfjsBuild = '783d42ec';
var pdfjsCoreWorker = require('./core/worker.js');
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

303
lib/test/unit/colorspace_spec.js

@ -0,0 +1,303 @@ @@ -0,0 +1,303 @@
/* Copyright 2017 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _primitives = require('../../core/primitives');
var _stream = require('../../core/stream');
var _colorspace = require('../../core/colorspace');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
describe('colorspace', function () {
var XRefMock = function () {
function XRefMock(array) {
_classCallCheck(this, XRefMock);
this.map = Object.create(null);
for (var elem in array) {
var obj = array[elem];
var ref = obj.ref;
var data = obj.data;
this.map[ref.toString()] = data;
}
}
_createClass(XRefMock, [{
key: 'fetch',
value: function fetch(ref) {
return this.map[ref.toString()];
}
}, {
key: 'fetchIfRef',
value: function fetchIfRef(obj) {
if (!(0, _primitives.isRef)(obj)) {
return obj;
}
return this.fetch(obj);
}
}]);
return XRefMock;
}();
describe('ColorSpace', function () {
it('should be true if decode is not an array', function () {
expect(_colorspace.ColorSpace.isDefaultDecode('string', 0)).toBeTruthy();
});
it('should be true if length of decode array is not correct', function () {
expect(_colorspace.ColorSpace.isDefaultDecode([0], 1)).toBeTruthy();
expect(_colorspace.ColorSpace.isDefaultDecode([0, 1, 0], 1)).toBeTruthy();
});
it('should be true if decode map matches the default decode map', function () {
expect(_colorspace.ColorSpace.isDefaultDecode([], 0)).toBeTruthy();
expect(_colorspace.ColorSpace.isDefaultDecode([0, 0], 1)).toBeFalsy();
expect(_colorspace.ColorSpace.isDefaultDecode([0, 1], 1)).toBeTruthy();
expect(_colorspace.ColorSpace.isDefaultDecode([0, 1, 0, 1, 0, 1], 3)).toBeTruthy();
expect(_colorspace.ColorSpace.isDefaultDecode([0, 1, 0, 1, 1, 1], 3)).toBeFalsy();
expect(_colorspace.ColorSpace.isDefaultDecode([0, 1, 0, 1, 0, 1, 0, 1], 4)).toBeTruthy();
expect(_colorspace.ColorSpace.isDefaultDecode([1, 0, 0, 1, 0, 1, 0, 1], 4)).toBeFalsy();
});
});
describe('DeviceGrayCS', function () {
it('should handle the case when cs is a Name object', function () {
var cs = _primitives.Name.get('DeviceGray');
var xref = new XRefMock([{
ref: new _primitives.Ref(10, 0),
data: new _primitives.Dict()
}]);
var res = new _primitives.Dict();
var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res);
var testSrc = new Uint8Array([27, 125, 250, 131]);
var testDest = new Uint8Array(4 * 4 * 3);
var expectedDest = new Uint8Array([27, 27, 27, 27, 27, 27, 125, 125, 125, 125, 125, 125, 27, 27, 27, 27, 27, 27, 125, 125, 125, 125, 125, 125, 250, 250, 250, 250, 250, 250, 131, 131, 131, 131, 131, 131, 250, 250, 250, 250, 250, 250, 131, 131, 131, 131, 131, 131]);
colorSpace.fillRgb(testDest, 2, 2, 4, 4, 4, 8, testSrc, 0);
expect(colorSpace.getRgb(new Float32Array([0.1]), 0)).toEqual(new Uint8Array([25, 25, 25]));
expect(colorSpace.getOutputLength(2, 0)).toEqual(6);
expect(colorSpace.isPassthrough(8)).toBeFalsy();
expect(testDest).toEqual(expectedDest);
});
it('should handle the case when cs is an indirect object', function () {
var cs = new _primitives.Ref(10, 0);
var xref = new XRefMock([{
ref: cs,
data: _primitives.Name.get('DeviceGray')
}]);
var res = new _primitives.Dict();
var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res);
var testSrc = new Uint8Array([27, 125, 250, 131]);
var testDest = new Uint8Array(3 * 3 * 3);
var expectedDest = new Uint8Array([27, 27, 27, 27, 27, 27, 125, 125, 125, 27, 27, 27, 27, 27, 27, 125, 125, 125, 250, 250, 250, 250, 250, 250, 131, 131, 131]);
colorSpace.fillRgb(testDest, 2, 2, 3, 3, 3, 8, testSrc, 0);
expect(colorSpace.getRgb(new Float32Array([0.2]), 0)).toEqual(new Uint8Array([51, 51, 51]));
expect(colorSpace.getOutputLength(3, 1)).toEqual(12);
expect(colorSpace.isPassthrough(8)).toBeFalsy();
expect(testDest).toEqual(expectedDest);
});
});
describe('DeviceRgbCS', function () {
it('should handle the case when cs is a Name object', function () {
var cs = _primitives.Name.get('DeviceRGB');
var xref = new XRefMock([{
ref: new _primitives.Ref(10, 0),
data: new _primitives.Dict()
}]);
var res = new _primitives.Dict();
var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res);
var testSrc = new Uint8Array([27, 125, 250, 131, 139, 140, 111, 25, 198, 21, 147, 255]);
var testDest = new Uint8Array(4 * 4 * 3);
var expectedDest = new Uint8Array([27, 125, 250, 27, 125, 250, 131, 139, 140, 131, 139, 140, 27, 125, 250, 27, 125, 250, 131, 139, 140, 131, 139, 140, 111, 25, 198, 111, 25, 198, 21, 147, 255, 21, 147, 255, 111, 25, 198, 111, 25, 198, 21, 147, 255, 21, 147, 255]);
colorSpace.fillRgb(testDest, 2, 2, 4, 4, 4, 8, testSrc, 0);
expect(colorSpace.getRgb(new Float32Array([0.1, 0.2, 0.3]), 0)).toEqual(new Uint8Array([25, 51, 76]));
expect(colorSpace.getOutputLength(4, 0)).toEqual(4);
expect(colorSpace.isPassthrough(8)).toBeTruthy();
expect(testDest).toEqual(expectedDest);
});
it('should handle the case when cs is an indirect object', function () {
var cs = new _primitives.Ref(10, 0);
var xref = new XRefMock([{
ref: cs,
data: _primitives.Name.get('DeviceRGB')
}]);
var res = new _primitives.Dict();
var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res);
var testSrc = new Uint8Array([27, 125, 250, 131, 139, 140, 111, 25, 198, 21, 147, 255]);
var testDest = new Uint8Array(3 * 3 * 3);
var expectedDest = new Uint8Array([27, 125, 250, 27, 125, 250, 131, 139, 140, 27, 125, 250, 27, 125, 250, 131, 139, 140, 111, 25, 198, 111, 25, 198, 21, 147, 255]);
colorSpace.fillRgb(testDest, 2, 2, 3, 3, 3, 8, testSrc, 0);
expect(colorSpace.getRgb(new Float32Array([0.1, 0.2, 0.3]), 0)).toEqual(new Uint8Array([25, 51, 76]));
expect(colorSpace.getOutputLength(4, 1)).toEqual(5);
expect(colorSpace.isPassthrough(8)).toBeTruthy();
expect(testDest).toEqual(expectedDest);
});
});
describe('DeviceCmykCS', function () {
it('should handle the case when cs is a Name object', function () {
var cs = _primitives.Name.get('DeviceCMYK');
var xref = new XRefMock([{
ref: new _primitives.Ref(10, 0),
data: new _primitives.Dict()
}]);
var res = new _primitives.Dict();
var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res);
var testSrc = new Uint8Array([27, 125, 250, 128, 131, 139, 140, 45, 111, 25, 198, 78, 21, 147, 255, 69]);
var testDest = new Uint8Array(4 * 4 * 3);
var expectedDest = new Uint8Array([135, 80, 18, 135, 80, 18, 113, 102, 97, 113, 102, 97, 135, 80, 18, 135, 80, 18, 113, 102, 97, 113, 102, 97, 112, 143, 75, 112, 143, 75, 188, 98, 27, 188, 98, 27, 112, 143, 75, 112, 143, 75, 188, 98, 27, 188, 98, 27]);
colorSpace.fillRgb(testDest, 2, 2, 4, 4, 4, 8, testSrc, 0);
expect(colorSpace.getRgb(new Float32Array([0.1, 0.2, 0.3, 1]), 0)).toEqual(new Uint8Array([31, 27, 20]));
expect(colorSpace.getOutputLength(4, 0)).toEqual(3);
expect(colorSpace.isPassthrough(8)).toBeFalsy();
expect(testDest).toEqual(expectedDest);
});
it('should handle the case when cs is an indirect object', function () {
var cs = new _primitives.Ref(10, 0);
var xref = new XRefMock([{
ref: cs,
data: _primitives.Name.get('DeviceCMYK')
}]);
var res = new _primitives.Dict();
var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res);
var testSrc = new Uint8Array([27, 125, 250, 128, 131, 139, 140, 45, 111, 25, 198, 78, 21, 147, 255, 69]);
var testDest = new Uint8Array(3 * 3 * 3);
var expectedDest = new Uint8Array([135, 80, 18, 135, 80, 18, 113, 102, 97, 135, 80, 18, 135, 80, 18, 113, 102, 97, 112, 143, 75, 112, 143, 75, 188, 98, 27]);
colorSpace.fillRgb(testDest, 2, 2, 3, 3, 3, 8, testSrc, 0);
expect(colorSpace.getRgb(new Float32Array([0.1, 0.2, 0.3, 1]), 0)).toEqual(new Uint8Array([31, 27, 20]));
expect(colorSpace.getOutputLength(4, 1)).toEqual(4);
expect(colorSpace.isPassthrough(8)).toBeFalsy();
expect(testDest).toEqual(expectedDest);
});
});
describe('CalGrayCS', function () {
it('should handle the case when cs is an array', function () {
var params = new _primitives.Dict();
params.set('WhitePoint', [1, 1, 1]);
params.set('BlackPoint', [0, 0, 0]);
params.set('Gamma', 2.0);
var cs = [_primitives.Name.get('CalGray'), params];
var xref = new XRefMock([{
ref: new _primitives.Ref(10, 0),
data: new _primitives.Dict()
}]);
var res = new _primitives.Dict();
var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res);
var testSrc = new Uint8Array([27, 125, 250, 131]);
var testDest = new Uint8Array(4 * 4 * 3);
var expectedDest = new Uint8Array([25, 25, 25, 25, 25, 25, 143, 143, 143, 143, 143, 143, 25, 25, 25, 25, 25, 25, 143, 143, 143, 143, 143, 143, 251, 251, 251, 251, 251, 251, 148, 148, 148, 148, 148, 148, 251, 251, 251, 251, 251, 251, 148, 148, 148, 148, 148, 148]);
colorSpace.fillRgb(testDest, 2, 2, 4, 4, 4, 8, testSrc, 0);
expect(colorSpace.getRgb(new Float32Array([1.0]), 0)).toEqual(new Uint8Array([255, 255, 255]));
expect(colorSpace.getOutputLength(4, 0)).toEqual(12);
expect(colorSpace.isPassthrough(8)).toBeFalsy();
expect(testDest).toEqual(expectedDest);
});
});
describe('CalRGBCS', function () {
it('should handle the case when cs is an array', function () {
var params = new _primitives.Dict();
params.set('WhitePoint', [1, 1, 1]);
params.set('BlackPoint', [0, 0, 0]);
params.set('Gamma', [1, 1, 1]);
params.set('Matrix', [1, 0, 0, 0, 1, 0, 0, 0, 1]);
var cs = [_primitives.Name.get('CalRGB'), params];
var xref = new XRefMock([{
ref: new _primitives.Ref(10, 0),
data: new _primitives.Dict()
}]);
var res = new _primitives.Dict();
var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res);
var testSrc = new Uint8Array([27, 125, 250, 131, 139, 140, 111, 25, 198, 21, 147, 255]);
var testDest = new Uint8Array(3 * 3 * 3);
var expectedDest = new Uint8Array([0, 238, 255, 0, 238, 255, 185, 196, 195, 0, 238, 255, 0, 238, 255, 185, 196, 195, 235, 0, 243, 235, 0, 243, 0, 255, 255]);
colorSpace.fillRgb(testDest, 2, 2, 3, 3, 3, 8, testSrc, 0);
expect(colorSpace.getRgb(new Float32Array([0.1, 0.2, 0.3]), 0)).toEqual(new Uint8Array([0, 147, 151]));
expect(colorSpace.getOutputLength(4, 0)).toEqual(4);
expect(colorSpace.isPassthrough(8)).toBeFalsy();
expect(testDest).toEqual(expectedDest);
});
});
describe('LabCS', function () {
it('should handle the case when cs is an array', function () {
var params = new _primitives.Dict();
params.set('WhitePoint', [1, 1, 1]);
params.set('BlackPoint', [0, 0, 0]);
params.set('Range', [-100, 100, -100, 100]);
var cs = [_primitives.Name.get('Lab'), params];
var xref = new XRefMock([{
ref: new _primitives.Ref(10, 0),
data: new _primitives.Dict()
}]);
var res = new _primitives.Dict();
var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res);
var testSrc = new Uint8Array([27, 25, 50, 31, 19, 40, 11, 25, 98, 21, 47, 55]);
var testDest = new Uint8Array(3 * 3 * 3);
var expectedDest = new Uint8Array([0, 49, 101, 0, 49, 101, 0, 53, 116, 0, 49, 101, 0, 49, 101, 0, 53, 116, 0, 40, 39, 0, 40, 39, 0, 43, 90]);
colorSpace.fillRgb(testDest, 2, 2, 3, 3, 3, 8, testSrc, 0);
expect(colorSpace.getRgb([55, 25, 35], 0)).toEqual(new Uint8Array([188, 99, 61]));
expect(colorSpace.getOutputLength(4, 0)).toEqual(4);
expect(colorSpace.isPassthrough(8)).toBeFalsy();
expect(colorSpace.isDefaultDecode([0, 1])).toBeTruthy();
expect(testDest).toEqual(expectedDest);
});
});
describe('IndexedCS', function () {
it('should handle the case when cs is an array', function () {
var lookup = new Uint8Array([23, 155, 35, 147, 69, 93, 255, 109, 70]);
var cs = [_primitives.Name.get('Indexed'), _primitives.Name.get('DeviceRGB'), 2, lookup];
var xref = new XRefMock([{
ref: new _primitives.Ref(10, 0),
data: new _primitives.Dict()
}]);
var res = new _primitives.Dict();
var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res);
var testSrc = new Uint8Array([2, 2, 0, 1]);
var testDest = new Uint8Array(3 * 3 * 3);
var expectedDest = new Uint8Array([255, 109, 70, 255, 109, 70, 255, 109, 70, 255, 109, 70, 255, 109, 70, 255, 109, 70, 23, 155, 35, 23, 155, 35, 147, 69, 93]);
colorSpace.fillRgb(testDest, 2, 2, 3, 3, 3, 8, testSrc, 0);
expect(colorSpace.getRgb([2], 0)).toEqual(new Uint8Array([255, 109, 70]));
expect(colorSpace.isPassthrough(8)).toBeFalsy();
expect(colorSpace.isDefaultDecode([0, 1])).toBeTruthy();
expect(testDest).toEqual(expectedDest);
});
});
describe('AlternateCS', function () {
it('should handle the case when cs is an array', function () {
var fnDict = new _primitives.Dict();
fnDict.set('FunctionType', 4);
fnDict.set('Domain', [0.0, 1.0]);
fnDict.set('Range', [0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0]);
fnDict.set('Length', 58);
var fn = new _stream.StringStream('{ dup 0.84 mul ' + 'exch 0.00 exch ' + 'dup 0.44 mul ' + 'exch 0.21 mul }');
fn = new _stream.Stream(fn.bytes, 0, 58, fnDict);
var fnRef = new _primitives.Ref(10, 0);
var cs = [_primitives.Name.get('Separation'), _primitives.Name.get('LogoGreen'), _primitives.Name.get('DeviceCMYK'), fnRef];
var xref = new XRefMock([{
ref: fnRef,
data: fn
}]);
var res = new _primitives.Dict();
var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res);
var testSrc = new Uint8Array([27, 25, 50, 31]);
var testDest = new Uint8Array(3 * 3 * 3);
var expectedDest = new Uint8Array([227, 243, 242, 227, 243, 242, 228, 243, 242, 227, 243, 242, 227, 243, 242, 228, 243, 242, 203, 233, 229, 203, 233, 229, 222, 241, 239]);
colorSpace.fillRgb(testDest, 2, 2, 3, 3, 3, 8, testSrc, 0);
expect(colorSpace.getRgb([0.1], 0)).toEqual(new Uint8Array([228, 243, 241]));
expect(colorSpace.isPassthrough(8)).toBeFalsy();
expect(colorSpace.isDefaultDecode([0, 1])).toBeTruthy();
expect(testDest).toEqual(expectedDest);
});
});
});

2
lib/test/unit/jasmine-boot.js

@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
'use strict';
function initializePDFJS(callback) {
Promise.all(['pdfjs/display/global', 'pdfjs-test/unit/annotation_spec', 'pdfjs-test/unit/api_spec', 'pdfjs-test/unit/bidi_spec', 'pdfjs-test/unit/cff_parser_spec', 'pdfjs-test/unit/cmap_spec', 'pdfjs-test/unit/crypto_spec', 'pdfjs-test/unit/custom_spec', 'pdfjs-test/unit/display_svg_spec', 'pdfjs-test/unit/document_spec', 'pdfjs-test/unit/dom_utils_spec', 'pdfjs-test/unit/evaluator_spec', 'pdfjs-test/unit/fonts_spec', 'pdfjs-test/unit/function_spec', 'pdfjs-test/unit/metadata_spec', 'pdfjs-test/unit/murmurhash3_spec', 'pdfjs-test/unit/network_spec', 'pdfjs-test/unit/parser_spec', 'pdfjs-test/unit/primitives_spec', 'pdfjs-test/unit/stream_spec', 'pdfjs-test/unit/type1_parser_spec', 'pdfjs-test/unit/ui_utils_spec', 'pdfjs-test/unit/unicode_spec', 'pdfjs-test/unit/util_spec', 'pdfjs-test/unit/util_stream_spec'].map(function (moduleName) {
Promise.all(['pdfjs/display/global', 'pdfjs-test/unit/annotation_spec', 'pdfjs-test/unit/api_spec', 'pdfjs-test/unit/bidi_spec', 'pdfjs-test/unit/cff_parser_spec', 'pdfjs-test/unit/cmap_spec', 'pdfjs-test/unit/colorspace_spec', 'pdfjs-test/unit/crypto_spec', 'pdfjs-test/unit/custom_spec', 'pdfjs-test/unit/display_svg_spec', 'pdfjs-test/unit/document_spec', 'pdfjs-test/unit/dom_utils_spec', 'pdfjs-test/unit/evaluator_spec', 'pdfjs-test/unit/fonts_spec', 'pdfjs-test/unit/function_spec', 'pdfjs-test/unit/metadata_spec', 'pdfjs-test/unit/murmurhash3_spec', 'pdfjs-test/unit/network_spec', 'pdfjs-test/unit/parser_spec', 'pdfjs-test/unit/primitives_spec', 'pdfjs-test/unit/stream_spec', 'pdfjs-test/unit/type1_parser_spec', 'pdfjs-test/unit/ui_utils_spec', 'pdfjs-test/unit/unicode_spec', 'pdfjs-test/unit/util_spec', 'pdfjs-test/unit/util_stream_spec'].map(function (moduleName) {
return SystemJS.import(moduleName);
})).then(function (modules) {
var displayGlobal = modules[0];

2
package.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "1.8.583",
"version": "1.8.585",
"main": "build/pdf.js",
"description": "Generic build of Mozilla's PDF.js library.",
"keywords": [

Loading…
Cancel
Save