[Pkg-javascript-commits] [pdf.js] 54/109: Add a unit-test for skipping `paintXObject` if `Subtype === PS` (PR 4861)

David Prévot taffit at moszumanska.debian.org
Fri Sep 25 03:04:17 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 0dde08554d4407f9b7e936aa7668eab27d9acbc1
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Sat Aug 29 18:21:00 2015 +0200

    Add a unit-test for skipping `paintXObject` if `Subtype === PS` (PR 4861)
---
 test/unit/evaluator_spec.js | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/test/unit/evaluator_spec.js b/test/unit/evaluator_spec.js
index 412a835..5bf007d 100644
--- a/test/unit/evaluator_spec.js
+++ b/test/unit/evaluator_spec.js
@@ -1,7 +1,7 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 /* globals expect, it, describe, PartialEvaluator, StringStream, OPS,
-           OperatorList, waitsFor, runs */
+           OperatorList, waitsFor, runs, Dict, Name, Stream */
 
 'use strict';
 
@@ -227,7 +227,7 @@ describe('evaluator', function() {
         expect(result.fnArray[3]).toEqual(OPS.restore);
       });
     });
-    it('should skip paint form XObject if name is missing', function() {
+    it('should skip paintXObject if name is missing', function() {
       var evaluator = new PartialEvaluator(new PdfManagerMock(),
                                            new XrefMock(), new HandlerMock(),
                                            'prefix');
@@ -238,5 +238,25 @@ describe('evaluator', function() {
         expect(result.fnArray).toEqual([]);
       });
     });
+    it('should skip paintXObject if subtype is PS', function() {
+      var evaluator = new PartialEvaluator(new PdfManagerMock(),
+                                           new XrefMock(), new HandlerMock(),
+                                           'prefix');
+      var xobjStreamDict = new Dict();
+      xobjStreamDict.set('Subtype', Name.get('PS'));
+      var xobjStream = new Stream([], 0, 0, xobjStreamDict);
+
+      var xobjs = new Dict();
+      xobjs.set('Res1', xobjStream);
+
+      var resources = new Dict();
+      resources.set('XObject', xobjs);
+
+      var stream = new StringStream('/Res1 Do');
+      runOperatorListCheck(evaluator, stream, resources, function (result) {
+        expect(result.argsArray).toEqual([]);
+        expect(result.fnArray).toEqual([]);
+      });
+    });
   });
 });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list