Closes #14, closes #15. Fix recovery path used when jp2 is requested at less than...
authorMichael Ang <mang@archive.org>
Mon, 7 Nov 2011 21:53:46 +0000 (21:53 +0000)
committerMichael Ang <mang@archive.org>
Mon, 7 Nov 2011 21:53:46 +0000 (21:53 +0000)
BookReaderIA/datanode/BookReaderImages.inc.php
BookReaderIA/test/unit/Images.js
BookReaderIA/test/unit/Preview.js

index e44a1f8..39b6673 100644 (file)
@@ -474,7 +474,8 @@ class BookReaderImages
                 $cmd = $unzipCmd . $this->getDecompressCmd($imageInfo, $powReduce, $rotate, $scale, $region, $stdoutLink) . $compressCmd;
                 trigger_error('BookReader rerunning with new cmd: ' . $cmd, E_USER_WARNING);
                 
-                //if ($this->passthruIfSuccessful($headers, $cmd, $errorMessage)) { // $$$ move to BookReaderRequest
+                $tempFile = $this->getTempFilename($ext);
+                array_push($this->tempFiles, $tempFile);
                 $imageCreated = $this->createOutputImage($cmd, $tempFile, $errorMessage);
                 if ($imageCreated) {
                     $recovered = true;
index 85cb92f..3aaa234 100644 (file)
@@ -316,3 +316,21 @@ asyncTest('Same image rotated 90 degrees, br.getRegionURI - fightingflyingc00ric
     });
 });
 
+
+asyncTest('Book that needs jp2 recovery since it does not contain enough reduction levels', function() {
+
+    var identifier = 'Magic-Mouse-2010-12';
+
+    expect(3);
+    var pageURI = previewURL(identifier, null, 'cover_thumb.jpg');
+    
+    var img = new Image();
+    $(img).bind( 'load error', function(eventObj) {
+        equals(eventObj.type, 'load', 'Load image (' + pageURI + '). Event handler called');
+        equals(this.width, 160, 'Image width');
+        equals(this.height, 207, 'Image height');
+        start();
+    })
+    .attr('src', pageURI);
+
+});
index 5f7b09f..468867c 100644 (file)
@@ -4,7 +4,7 @@
 
 module("Preview");
 
-function Book(identifier, previewWidth, coverWidth, titleWidth, bookId) {
+function Book(identifier, previewWidth, coverWidth, titleWidth, imageSize, bookId) {
     this.identifier = identifier;
     this.previewWidth = previewWidth;
     this.coverWidth = coverWidth;
@@ -23,6 +23,7 @@ var books = [
     
     // Protected book with marked cover returned as cover
     new Book('joyofsoaringtrai00conw', 2571, 2571, 2419)
+    
 ];
 
 for (index in books) {