2 // Depends on common.js
6 test("Permalink format - /download/{itemid}/page/{page specifier}.jpg", function() {
8 var page = 'page4.jpg';
9 var itemId = 'handbookofdorking00denn';
11 var pageURI = imagePermalink(itemId, null, page);
12 equals(pageURI, common.testHost + '/download/handbookofdorking00denn/page/page4.jpg');
16 var page = 'page4.jpg';
17 var itemId = 'handbookofdorking00denn';
19 asyncTest("Page " + page + " from " + itemId, function() {
23 var pageURI = imagePermalink(itemId, null, page);
25 var img = new Image();
26 $(img).bind( 'load error', function(eventObj) {
27 equals(eventObj.type, 'load', 'Load image (' + pageURI + '). Event handler called');
28 equals(this.width, 1566, 'Image width');
31 .attr('src', pageURI);
38 var itemId = 'SubBookTest';
40 var subPrefix = 'subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume';
42 asyncTest("Sub-dir book - Page " + page + " from " + itemId + '/' + subPrefix, function() {
45 var pageURI = imagePermalink(itemId, subPrefix, page);
47 var img = new Image();
48 $(img).bind( 'load error', function(eventObj) {
49 equals(eventObj.type, 'load', 'Load image (' + pageURI + '). Event handler called');
50 equals(this.width, 5100, 'Image width');
53 .attr('src', pageURI);
60 var itemId = 'nasa_techdoc_20050157919';
61 var page = 'n20_thumb_rot90.jpg';
62 var subPrefix = '20050157919';
64 asyncTest("Rotated thumbnail - Page " + page + " from " + itemId + '/' + subPrefix, function() {
67 var pageURI = imagePermalink(itemId, subPrefix, page);
69 var img = new Image();
70 $(img).bind( 'load error', function(eventObj) {
71 equals(eventObj.type, 'load', 'Load image (' + pageURI + '). Event handler called');
72 equals(this.width, 179, 'Image width');
75 .attr('src', pageURI);
82 var itemId = 'nasa_techdoc_20050157919';
83 var page = 'preview_thumb.jpg';
86 asyncTest("Preview image for book in subdir without specifying sub-dir - Page " + page + " from " + itemId, function() {
89 var pageURI = imagePermalink(itemId, subPrefix, page);
91 var img = new Image();
92 $(img).bind( 'load error', function(eventObj) {
93 equals(eventObj.type, 'load', 'Load image (' + pageURI + '). Event handler called');
94 equals(this.width, 122, 'Image width');
97 .attr('src', pageURI);