[Pkg-javascript-commits] [pdf.js] 178/246: Add even more unit tests for the API

David Prévot taffit at moszumanska.debian.org
Sun Sep 7 15:36:38 UTC 2014


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

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

commit fc5ad8a8d6efec4f1d3e5e7a57344e503a6487ba
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Tue Aug 12 12:04:00 2014 +0200

    Add even more unit tests for the API
    
    This patch replaces most of the remaining TODOs in test/unit/api_spec.js with actual tests.
---
 test/unit/api_spec.js | 42 ++++++++++++++++++++++++++++++++++--------
 1 file changed, 34 insertions(+), 8 deletions(-)

diff --git a/test/unit/api_spec.js b/test/unit/api_spec.js
index ab7a47a..67790dc 100644
--- a/test/unit/api_spec.js
+++ b/test/unit/api_spec.js
@@ -126,11 +126,41 @@ describe('api', function() {
     waitsForPromise(promise, function(data) {
       page = data;
     });
-
-    it('gets ref', function() {
-      expect(page.ref).toEqual({num: 15, gen: 0});
+    it('gets page number', function () {
+      expect(page.pageNumber).toEqual(1);
+    });
+    it('gets rotate', function () {
+      expect(page.rotate).toEqual(0);
+    });
+    it('gets ref', function () {
+      expect(page.ref).toEqual({ num: 15, gen: 0 });
+    });
+    it('gets view', function () {
+      expect(page.view).toEqual([0, 0, 595.28, 841.89]);
+    });
+    it('gets viewport', function () {
+      var viewport = page.getViewport(1.5, 90);
+      expect(viewport.viewBox).toEqual(page.view);
+      expect(viewport.scale).toEqual(1.5);
+      expect(viewport.rotation).toEqual(90);
+      expect(viewport.transform).toEqual([0, 1.5, 1.5, 0, 0, 0]);
+      expect(viewport.width).toEqual(1262.835);
+      expect(viewport.height).toEqual(892.92);
+    });
+    it('gets annotations', function () {
+      var promise = page.getAnnotations();
+      waitsForPromise(promise, function (data) {
+        expect(data.length).toEqual(4);
+      });
+    });
+    it('gets text content', function () {
+      var promise = page.getTextContent();
+      waitsForPromise(promise, function (data) {
+        expect(!!data.items).toEqual(true);
+        expect(data.items.length).toEqual(7);
+        expect(!!data.styles).toEqual(true);
+      });
     });
-
     it('gets operator list', function() {
       var promise = page.getOperatorList();
       waitsForPromise(promise, function (oplist) {
@@ -139,9 +169,5 @@ describe('api', function() {
         expect(oplist.lastChunk).toEqual(true);
       });
     });
-    // TODO rotate
-    // TODO viewport
-    // TODO annotaions
-    // TOOD text content
   });
 });

-- 
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