Update unit tests
[bookreader.git] / BookReaderIA / test / unit / Images.js
index 8334cdc..14fb114 100644 (file)
@@ -157,7 +157,7 @@ asyncTest("Load tiff image from zip", function() {
     var img = new Image();
     $(img).bind( 'load error', function(eventObj) {
         equals(eventObj.type, 'load', 'Load image (' + pageURI + '). Event handler called');
-        equals(this.width, 702, 'Image width');
+        equals(this.width, 701, 'Image width');
         start();
     })
     .attr('src', pageURI);
@@ -179,8 +179,27 @@ asyncTest('Load jpg image from tar file - https://bugs.launchpad.net/bookreader/
     var img = new Image();
     $(img).bind( 'load error', function(eventObj) {
         equals(eventObj.type, 'load', 'Load image (' + pageURI + '). Event handler called');
-        equals(this.width, 244, 'Image width');
+        equals(this.width, 243, 'Image width');
         start();
     })
     .attr('src', pageURI);
 });
+
+asyncTest('Load image region from tiff - archive.org/download/fightingflyingc00rickgoog/page/n17_x1944_y1708_w668_h584.jpg', function() {
+
+    $.getScript( jsLocateURL('fightingflyingc00rickgoog'), function() {
+
+        expect(3);
+        var pageURI = br.getRegionURI(17, undefined, undefined, 1944, 1708, 668, 584);
+        
+        var img = new Image();
+        $(img).bind( 'load error', function(eventObj) {
+            equals(eventObj.type, 'load', 'Load image (' + pageURI + '). Event handler called');
+            equals(this.width, 668, 'Image width');
+            equals(this.height, 584, 'Image height');
+            start();
+        })
+        .attr('src', pageURI);
+        
+    });
+});