diff --git a/Gruntfile.js b/Gruntfile.js index 332f49d1..419752e4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -34,6 +34,7 @@ module.exports = function(grunt) { "src/tilesource.js", "src/dzitilesource.js", "src/iiiftilesource.js", + "src/iiif1_1tilesource.js", "src/osmtilesource.js", "src/tmstilesource.js", "src/legacytilesource.js", diff --git a/changelog.txt b/changelog.txt index e8098d36..ed49d13d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,12 +3,24 @@ OPENSEADRAGON CHANGELOG 1.0.0: (in progress) +* BREAKING CHANGE: TileSource 'ready' event handler signature changed for consistency to 'handlerMethod( eventSource, eventData)' (#239) * BREAKING CHANGE: Renamed EventHandler to EventSource (#225) * BREAKING CHANGE: MouseTracker event handler method signatures changed to 'handlerMethod( tracker, eventData)' (#23) +* BREAKING CHANGE: Event names changed for consistency: changed to lower case, compound names hyphenated, and "on" prefixes removed (#226): +* Viewer "animationstart" changed to "animation-start" +* Viewer "animationfinish" changed to "animation-finish" +* Button "onPress" changed to "press" +* Button "onRelease" changed to "release" +* Button "onClick" changed to "click" +* Button "onEnter" changed to "enter" +* Button "onExit" changed to "exit" +* Button "onFocus" changed to "focus" +* Button "onBlur" changed to "blur" * MouseTracker now passes the original event objects to its handler methods (#23) * MouseTracker now supports an optional 'moveHandler' method for tracking mousemove events (#215) * Fixed: Element-relative mouse coordinates now correct if the element and/or page is scrolled (using new OpenSeadragon.getElementOffset() method) (#131) * Added IIIF Image API 1.1 Tile Source (#230) +* Fixed: Touch event issue where no canvas-click events were being raised (#240) 0.9.131: diff --git a/src/button.js b/src/button.js index 86755a72..062abf8a 100644 --- a/src/button.js +++ b/src/button.js @@ -152,13 +152,13 @@ $.Button = function( options ) { } - this.addHandler( "onPress", this.onPress ); - this.addHandler( "onRelease", this.onRelease ); - this.addHandler( "onClick", this.onClick ); - this.addHandler( "onEnter", this.onEnter ); - this.addHandler( "onExit", this.onExit ); - this.addHandler( "onFocus", this.onFocus ); - this.addHandler( "onBlur", this.onBlur ); + this.addHandler( "press", this.onPress ); + this.addHandler( "release", this.onRelease ); + this.addHandler( "click", this.onClick ); + this.addHandler( "enter", this.onEnter ); + this.addHandler( "exit", this.onExit ); + this.addHandler( "focus", this.onFocus ); + this.addHandler( "blur", this.onBlur ); this.currentState = $.ButtonState.GROUP; @@ -178,7 +178,7 @@ $.Button = function( options ) { enterHandler: function( tracker, eventData ) { if ( eventData.insideElementPressed ) { inTo( _this, $.ButtonState.DOWN ); - _this.raiseEvent( "onEnter", _this ); + _this.raiseEvent( "enter", _this ); } else if ( !eventData.buttonDownAny ) { inTo( _this, $.ButtonState.HOVER ); } @@ -186,30 +186,30 @@ $.Button = function( options ) { focusHandler: function ( tracker, eventData ) { this.enterHandler( tracker, eventData ); - _this.raiseEvent( "onFocus", _this ); + _this.raiseEvent( "focus", _this ); }, exitHandler: function( tracker, eventData ) { outTo( _this, $.ButtonState.GROUP ); if ( eventData.insideElementPressed ) { - _this.raiseEvent( "onExit", _this ); + _this.raiseEvent( "exit", _this ); } }, blurHandler: function ( tracker, eventData ) { this.exitHandler( tracker, eventData ); - _this.raiseEvent( "onBlur", _this ); + _this.raiseEvent( "blur", _this ); }, pressHandler: function ( tracker, eventData ) { inTo( _this, $.ButtonState.DOWN ); - _this.raiseEvent( "onPress", _this ); + _this.raiseEvent( "press", _this ); }, releaseHandler: function( tracker, eventData ) { if ( eventData.insideElementPressed && eventData.insideElementReleased ) { outTo( _this, $.ButtonState.HOVER ); - _this.raiseEvent( "onRelease", _this ); + _this.raiseEvent( "release", _this ); } else if ( eventData.insideElementPressed ) { outTo( _this, $.ButtonState.GROUP ); } else { @@ -219,15 +219,15 @@ $.Button = function( options ) { clickHandler: function( tracker, eventData ) { if ( eventData.quick ) { - _this.raiseEvent("onClick", _this); + _this.raiseEvent("click", _this); } }, keyHandler: function( tracker, eventData ){ //console.log( "%s : handling key %s!", _this.tooltip, eventData.keyCode); if( 13 === eventData.keyCode ){ - _this.raiseEvent( "onClick", _this ); - _this.raiseEvent( "onRelease", _this ); + _this.raiseEvent( "click", _this ); + _this.raiseEvent( "release", _this ); return false; } return true; diff --git a/src/eventsource.js b/src/eventsource.js index 012ce68f..c5289777 100644 --- a/src/eventsource.js +++ b/src/eventsource.js @@ -36,12 +36,8 @@ /** * For use by classes which want to support custom, non-browser events. - * TODO: This is an awful name! This thing represents an "event source", - * not an "event handler". PLEASE change the to EventSource. Also please - * change 'addHandler', 'removeHandler' and 'raiseEvent' to 'bind', - * 'unbind', and 'trigger' respectively. Finally add a method 'one' which - * automatically unbinds a listener after the first triggered event that - * matches. + * TODO: Add a method 'one' which automatically unbinds a listener after + * the first triggered event that matches. * @class */ $.EventSource = function() { diff --git a/src/iiif1_1tilesource.js b/src/iiif1_1tilesource.js new file mode 100644 index 00000000..6e022d3b --- /dev/null +++ b/src/iiif1_1tilesource.js @@ -0,0 +1,163 @@ +/* + * OpenSeadragon - IIIF1_1TileSource + * + * Copyright (C) 2009 CodePlex Foundation + * Copyright (C) 2010-2013 OpenSeadragon contributors + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of CodePlex Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +(function( $ ){ + +/** + * A client implementation of the International Image Interoperability + * Format: Image API 1.1 - Please read more about the specification + * at + * + * @class + * @extends OpenSeadragon.TileSource + * @see http://library.stanford.edu/iiif/image-api/ + */ +$.IIIF1_1TileSource = function( options ){ + + $.extend( true, this, options ); + + if( !(this.height && this.width && this['@id'] ) ){ + throw new Error('IIIF required parameters not provided.'); + } + + options.tileSize = this.tile_width; + + if (! options.maxLevel ) { + var mf = -1; + var scfs = this.scale_factors || this.scale_factor; + if ( scfs instanceof Array ) { + for ( var i = 0; i < scfs.length; i++ ) { + var cf = Number( scfs[i] ); + if ( !isNaN( cf ) && cf > mf ) { mf = cf; } + } + } + if ( mf < 0 ) { options.maxLevel = Number(Math.ceil(Math.log(Math.max(this.width, this.height), 2))); } + else { options.maxLevel = mf; } + } + + $.TileSource.apply( this, [ options ] ); +}; + +$.extend( $.IIIF1_1TileSource.prototype, $.TileSource.prototype, { + /** + * Determine if the data and/or url imply the image service is supported by + * this tile source. + * @function + * @name OpenSeadragon.IIIF1_1TileSource.prototype.supports + * @param {Object|Array} data + * @param {String} optional - url + */ + supports: function( data, url ){ + return data.profile && ( + "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0" == data.profile || + "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1" == data.profile || + "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2" == data.profile || + "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level3" == data.profile || + "http://library.stanford.edu/iiif/image-api/1.1/compliance.html" == data.profile + ); + }, + + /** + * + * @function + * @name OpenSeadragon.IIIF1_1TileSource.prototype.configure + * @param {Object} data - the raw configuration + */ + // IIIF 1.1 Info Looks like this (XML syntax is no more): + // { + // "@context" : "http://library.stanford.edu/iiif/image-api/1.1/context.json", + // "@id" : "http://iiif.example.com/prefix/1E34750D-38DB-4825-A38A-B60A345E591C", + // "width" : 6000, + // "height" : 4000, + // "scale_factors" : [ 1, 2, 4 ], + // "tile_width" : 1024, + // "tile_height" : 1024, + // "formats" : [ "jpg", "png" ], + // "qualities" : [ "native", "grey" ] + // "profile" : "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0" + // } + configure: function( data ){ + return data; + }, + /** + * Responsible for retreiving the url which will return an image for the + * region specified by the given x, y, and level components. + * @function + * @name OpenSeadragon.IIIF1_1TileSource.prototype.getTileUrl + * @param {Number} level - z index + * @param {Number} x + * @param {Number} y + * @throws {Error} + */ + getTileUrl: function( level, x, y ){ + + //# constants + var IIIF_ROTATION = '0', + IIIF_QUALITY = 'native.jpg', + + //## get the scale (level as a decimal) + scale = Math.pow( 0.5, this.maxLevel - level ), + + //# image dimensions at this level + level_width = Math.ceil( this.width * scale ), + level_height = Math.ceil( this.height * scale ), + + //## iiif region + iiif_tile_size_width = Math.ceil( this.tileSize / scale ), + iiif_tile_size_height = Math.ceil( this.tileSize / scale ), + iiif_region, + iiif_tile_x, + iiif_tile_y, + iiif_tile_w, + iiif_tile_h, + iiif_size, + uri; + + if ( level_width < this.tile_width && level_height < this.tile_height ){ + iiif_size = level_width + "," + level_height; + iiif_region = 'full'; + } else { + iiif_tile_x = x * iiif_tile_size_width; + iiif_tile_y = y * iiif_tile_size_height; + iiif_tile_w = Math.min( iiif_tile_size_width, this.width - iiif_tile_x ); + iiif_tile_h = Math.min( iiif_tile_size_height, this.height - iiif_tile_y ); + iiif_size = Math.ceil(iiif_tile_w * scale) + "," + Math.ceil(iiif_tile_h * scale); + iiif_region = [ iiif_tile_x, iiif_tile_y, iiif_tile_w, iiif_tile_h ].join(','); + } + uri = [ this['@id'], iiif_region, iiif_size, IIIF_ROTATION, IIIF_QUALITY ].join('/'); + return uri; + } + }); + +}( OpenSeadragon )); diff --git a/src/mousetracker.js b/src/mousetracker.js index 5161c879..66e2a458 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -1020,7 +1020,7 @@ function onMouseUpCaptured( tracker, event, noRelease, isTouch ) { isTouch = isTouch || false; - if ( !THIS[ tracker.hash ].insideElement ) { + if ( !THIS[ tracker.hash ].insideElement || isTouch ) { onMouseUp( tracker, event, isTouch ); } diff --git a/src/strings.js b/src/strings.js index 9616850a..8e473dc5 100644 --- a/src/strings.js +++ b/src/strings.js @@ -46,7 +46,7 @@ var I18N = { Security: "It looks like a security restriction stopped us from " + "loading this Deep Zoom Image.", Status: "This space unintentionally left blank ({0} {1}).", - "Open-Failed": "Unable to open {0}: {1}" + OpenFailed: "Unable to open {0}: {1}" }, Tooltips: { diff --git a/src/tilesource.js b/src/tilesource.js index 9352487e..641f0e65 100644 --- a/src/tilesource.js +++ b/src/tilesource.js @@ -117,15 +117,8 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve for ( i = 0; i < arguments.length; i++ ) { if ( $.isFunction( arguments[ i ] ) ) { callback = arguments[ i ]; - // TODO Send generic object wrapping readySource as a property (breaking change) - // TODO Maybe placeHolderSource should be passed to callback as well for consistency - // with event handler signature? - // Should be this (although technically it works as-is): - //this.addHandler( 'ready', function ( placeHolderSource, placeHolderArgs ) { - // callback( placeHolderArgs ); - //} ); - this.addHandler( 'ready', function ( placeHolderSource, readySource ) { - callback( readySource ); + this.addHandler( 'ready', function ( placeHolderSource, placeHolderEventData ) { + callback( placeHolderSource, placeHolderEventData ); } ); //only one callback per constructor break; @@ -308,10 +301,7 @@ $.TileSource.prototype = { options = $TileSource.prototype.configure.apply( _this, [ data, url ]); readySource = new $TileSource( options ); _this.ready = true; - // TODO Send generic object wrapping readySource as a property (breaking change) - // Should be this: - //_this.raiseEvent( 'ready', { tileSource: readySource } ); - _this.raiseEvent( 'ready', readySource ); + _this.raiseEvent( 'ready', { tileSource: readySource } ); }; if( url.match(/\.js$/) ){ diff --git a/src/viewer.js b/src/viewer.js index 4887d844..ecd8560f 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -173,7 +173,7 @@ $.Viewer = function( options ) { $.EventSource.call( this ); this.addHandler( 'open-failed', function (source, args) { - var msg = $.getString( "Errors.Open-Failed", args.source, args.message); + var msg = $.getString( "Errors.OpenFailed", args.source, args.message); _this._showMessage( msg ); }); @@ -438,8 +438,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, setTimeout(function(){ if ( $.type( tileSource ) == 'string') { //If its still a string it means it must be a url at this point - tileSource = new $.TileSource( tileSource, function( readySource ){ - openTileSource( _this, readySource ); + tileSource = new $.TileSource( tileSource, function( eventSource, eventData ){ + openTileSource( _this, eventData.tileSource ); }); tileSource.addHandler( 'open-failed', function ( name, args ) { _this.raiseEvent( 'open-failed', args ); @@ -1589,7 +1589,7 @@ function updateOnce( viewer ) { } if ( !THIS[ viewer.hash ].animating && animated ) { - viewer.raiseEvent( "animationstart" ); + viewer.raiseEvent( "animation-start" ); abortControlsAutoHide( viewer ); } @@ -1608,7 +1608,7 @@ function updateOnce( viewer ) { } if ( THIS[ viewer.hash ].animating && !animated ) { - viewer.raiseEvent( "animationfinish" ); + viewer.raiseEvent( "animation-finish" ); if ( !THIS[ viewer.hash ].mouseInside ) { beginControlsAutoHide( viewer ); diff --git a/test/basic.js b/test/basic.js index 50e51cab..eb75b947 100644 --- a/test/basic.js +++ b/test/basic.js @@ -73,12 +73,12 @@ equal(viewport.getZoom(), 1, 'We start out unzoomed'); var zoomHandler = function() { - viewer.removeHandler('animationfinish', zoomHandler); + viewer.removeHandler('animation-finish', zoomHandler); equal(viewport.getZoom(), 2, 'Zoomed correctly'); start(); }; - viewer.addHandler('animationfinish', zoomHandler); + viewer.addHandler('animation-finish', zoomHandler); viewport.zoomTo(2); }); viewer.open('/test/data/testpattern.dzi'); @@ -93,13 +93,13 @@ ok(center.x === 0.5 && center.y === 0.5, 'We start out unpanned'); var panHandler = function() { - viewer.removeHandler('animationfinish', panHandler); + viewer.removeHandler('animation-finish', panHandler); center = viewport.getCenter(); ok(center.x === 0.1 && center.y === 0.1, 'Panned correctly'); start(); }; - viewer.addHandler('animationfinish', panHandler); + viewer.addHandler('animation-finish', panHandler); viewport.panTo(new OpenSeadragon.Point(0.1, 0.1)); }); @@ -119,25 +119,25 @@ var viewport = viewer.viewport, center = viewport.getCenter(); - viewer.removeHandler('animationfinish', stage1); + viewer.removeHandler('animation-finish', stage1); ok(center.x !== 0.5 && center.y !== 0.5, 'We start out panned'); notEqual(viewport.getZoom(), 1, 'We start out zoomed'); var homeHandler = function() { - viewer.removeHandler('animationfinish', homeHandler); + viewer.removeHandler('animation-finish', homeHandler); center = viewport.getCenter(); ok(center.x === 0.5 && center.y === 0.5, 'We end up unpanned'); equal(viewport.getZoom(), 1, 'We end up unzoomed'); start(); }; - viewer.addHandler('animationfinish', homeHandler); + viewer.addHandler('animation-finish', homeHandler); viewport.goHome(true); } viewer.addHandler("open", opener); - viewer.addHandler("animationfinish", stage1); + viewer.addHandler("animation-finish", stage1); viewer.open('/test/data/testpattern.dzi'); }); @@ -152,14 +152,14 @@ equal(viewport.getZoom(), 1, 'We start out unzoomed'); var clickHandler = function() { - viewer.removeHandler('animationfinish', clickHandler); + viewer.removeHandler('animation-finish', clickHandler); center = viewport.getCenter(); ok(center.x > 0.37 && center.x < 0.38 && center.y > 0.37 && center.y < 0.38, 'Panned correctly'); equal(viewport.getZoom(), 2, 'Zoomed correctly'); start(); }; - viewer.addHandler('animationfinish', clickHandler); + viewer.addHandler('animation-finish', clickHandler); Util.simulateViewerClickWithDrag( { viewer: viewer, widthFactor: 0.25, diff --git a/test/data/iiif1_0.json b/test/data/iiif1_0.json new file mode 100644 index 00000000..73b91061 --- /dev/null +++ b/test/data/iiif1_0.json @@ -0,0 +1,26 @@ +{ + "identifier": "iiif_1_0_files", + "width": 775, + "height": 1024, + "scale_factors": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "tile_width": 256, + "tile_height": 256, + "formats": [ + "jpg", + "png" + ], + "qualities": [ + "native", + "bitonal", + "grey", + "color" + ], + "profile": "http://library.stanford.edu/iiif/image-api/compliance.html#level1" +} diff --git a/test/data/iiif1_0.xml b/test/data/iiif1_0.xml new file mode 100644 index 00000000..6dab2b4f --- /dev/null +++ b/test/data/iiif1_0.xml @@ -0,0 +1,26 @@ + + iiif_1_0_files + 775 + 1024 + + 1 + 2 + 3 + 4 + 5 + 6 + + 256 + 256 + + jpg + png + + + native + bitonal + grey + color + + http://library.stanford.edu/iiif/image-api/compliance.html#level1 + diff --git a/test/data/iiif1_1.json b/test/data/iiif1_1.json new file mode 100644 index 00000000..1ad7a6fa --- /dev/null +++ b/test/data/iiif1_1.json @@ -0,0 +1,28 @@ +{ + "profile": "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2", + "scale_factors": [ + 1, + 2, + 4, + 8, + 16, + 32 + ], + "tile_height": 256, + "height": 1024, + "width": 775, + "tile_width": 256, + "qualities": [ + "native", + "bitonal", + "grey", + "color" + ], + "formats": [ + "jpg", + "png", + "gif" + ], + "@context": "http://library.stanford.edu/iiif/image-api/1.1/context.json", + "@id": "http://localhost:8000/test/data/iiif_1_1_files" +} diff --git a/test/data/iiif_1_0_files/0,0,1024,1024/pct:25/0/native.jpg b/test/data/iiif_1_0_files/0,0,1024,1024/pct:25/0/native.jpg new file mode 100644 index 00000000..cdaeeb98 Binary files /dev/null and b/test/data/iiif_1_0_files/0,0,1024,1024/pct:25/0/native.jpg differ diff --git a/test/data/iiif_1_0_files/0,0,2048,2048/pct:12.5/0/native.jpg b/test/data/iiif_1_0_files/0,0,2048,2048/pct:12.5/0/native.jpg new file mode 100644 index 00000000..b30c22fb Binary files /dev/null and b/test/data/iiif_1_0_files/0,0,2048,2048/pct:12.5/0/native.jpg differ diff --git a/test/data/iiif_1_0_files/0,0,512,512/pct:50/0/native.jpg b/test/data/iiif_1_0_files/0,0,512,512/pct:50/0/native.jpg new file mode 100644 index 00000000..c0ede910 Binary files /dev/null and b/test/data/iiif_1_0_files/0,0,512,512/pct:50/0/native.jpg differ diff --git a/test/data/iiif_1_0_files/0,0,775,1024/pct:25/0/native.jpg b/test/data/iiif_1_0_files/0,0,775,1024/pct:25/0/native.jpg new file mode 100644 index 00000000..cdaeeb98 Binary files /dev/null and b/test/data/iiif_1_0_files/0,0,775,1024/pct:25/0/native.jpg differ diff --git a/test/data/iiif_1_0_files/0,512,512,512/pct:50/0/native.jpg b/test/data/iiif_1_0_files/0,512,512,512/pct:50/0/native.jpg new file mode 100644 index 00000000..59ec177b Binary files /dev/null and b/test/data/iiif_1_0_files/0,512,512,512/pct:50/0/native.jpg differ diff --git a/test/data/iiif_1_0_files/512,0,263,512/pct:50/0/native.jpg b/test/data/iiif_1_0_files/512,0,263,512/pct:50/0/native.jpg new file mode 100644 index 00000000..2426215c Binary files /dev/null and b/test/data/iiif_1_0_files/512,0,263,512/pct:50/0/native.jpg differ diff --git a/test/data/iiif_1_0_files/512,512,263,512/pct:50/0/native.jpg b/test/data/iiif_1_0_files/512,512,263,512/pct:50/0/native.jpg new file mode 100644 index 00000000..f3113543 Binary files /dev/null and b/test/data/iiif_1_0_files/512,512,263,512/pct:50/0/native.jpg differ diff --git a/test/data/iiif_1_0_files/full/pct:1.5625/0/native.jpg b/test/data/iiif_1_0_files/full/pct:1.5625/0/native.jpg new file mode 100644 index 00000000..a5cfdec0 Binary files /dev/null and b/test/data/iiif_1_0_files/full/pct:1.5625/0/native.jpg differ diff --git a/test/data/iiif_1_0_files/full/pct:12.5/0/native.jpg b/test/data/iiif_1_0_files/full/pct:12.5/0/native.jpg new file mode 100644 index 00000000..b30c22fb Binary files /dev/null and b/test/data/iiif_1_0_files/full/pct:12.5/0/native.jpg differ diff --git a/test/data/iiif_1_0_files/full/pct:3.125/0/native.jpg b/test/data/iiif_1_0_files/full/pct:3.125/0/native.jpg new file mode 100644 index 00000000..09817ed6 Binary files /dev/null and b/test/data/iiif_1_0_files/full/pct:3.125/0/native.jpg differ diff --git a/test/data/iiif_1_0_files/full/pct:6.25/0/native.jpg b/test/data/iiif_1_0_files/full/pct:6.25/0/native.jpg new file mode 100644 index 00000000..c7467382 Binary files /dev/null and b/test/data/iiif_1_0_files/full/pct:6.25/0/native.jpg differ diff --git a/test/data/iiif_1_1_files/0,0,256,256/256,256/0/b0.jpg b/test/data/iiif_1_1_files/0,0,256,256/256,256/0/b0.jpg new file mode 100644 index 00000000..a29c5568 Binary files /dev/null and b/test/data/iiif_1_1_files/0,0,256,256/256,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/0,0,512,512/256,256/0/b0.jpg b/test/data/iiif_1_1_files/0,0,512,512/256,256/0/b0.jpg new file mode 100644 index 00000000..edb856cc Binary files /dev/null and b/test/data/iiif_1_1_files/0,0,512,512/256,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/0,0,512,512/256,256/0/native.jpg b/test/data/iiif_1_1_files/0,0,512,512/256,256/0/native.jpg new file mode 100644 index 00000000..edb856cc Binary files /dev/null and b/test/data/iiif_1_1_files/0,0,512,512/256,256/0/native.jpg differ diff --git a/test/data/iiif_1_1_files/0,0,775,1024/194,256/0/b0.jpg b/test/data/iiif_1_1_files/0,0,775,1024/194,256/0/b0.jpg new file mode 100644 index 00000000..be76af06 Binary files /dev/null and b/test/data/iiif_1_1_files/0,0,775,1024/194,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/0,0,775,1024/194,256/0/native.jpg b/test/data/iiif_1_1_files/0,0,775,1024/194,256/0/native.jpg new file mode 100644 index 00000000..be76af06 Binary files /dev/null and b/test/data/iiif_1_1_files/0,0,775,1024/194,256/0/native.jpg differ diff --git a/test/data/iiif_1_1_files/0,256,256,256/256,256/0/b0.jpg b/test/data/iiif_1_1_files/0,256,256,256/256,256/0/b0.jpg new file mode 100644 index 00000000..cb38ba74 Binary files /dev/null and b/test/data/iiif_1_1_files/0,256,256,256/256,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/0,512,256,256/256,256/0/b0.jpg b/test/data/iiif_1_1_files/0,512,256,256/256,256/0/b0.jpg new file mode 100644 index 00000000..0b44da15 Binary files /dev/null and b/test/data/iiif_1_1_files/0,512,256,256/256,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/0,512,512,512/256,256/0/b0.jpg b/test/data/iiif_1_1_files/0,512,512,512/256,256/0/b0.jpg new file mode 100644 index 00000000..250e76d1 Binary files /dev/null and b/test/data/iiif_1_1_files/0,512,512,512/256,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/0,512,512,512/256,256/0/native.jpg b/test/data/iiif_1_1_files/0,512,512,512/256,256/0/native.jpg new file mode 100644 index 00000000..250e76d1 Binary files /dev/null and b/test/data/iiif_1_1_files/0,512,512,512/256,256/0/native.jpg differ diff --git a/test/data/iiif_1_1_files/0,768,256,256/256,256/0/b0.jpg b/test/data/iiif_1_1_files/0,768,256,256/256,256/0/b0.jpg new file mode 100644 index 00000000..8cf078fa Binary files /dev/null and b/test/data/iiif_1_1_files/0,768,256,256/256,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/0,768,256,256/256,256/0/native.jpg b/test/data/iiif_1_1_files/0,768,256,256/256,256/0/native.jpg new file mode 100644 index 00000000..8cf078fa Binary files /dev/null and b/test/data/iiif_1_1_files/0,768,256,256/256,256/0/native.jpg differ diff --git a/test/data/iiif_1_1_files/256,0,256,256/256,256/0/b0.jpg b/test/data/iiif_1_1_files/256,0,256,256/256,256/0/b0.jpg new file mode 100644 index 00000000..36ecb717 Binary files /dev/null and b/test/data/iiif_1_1_files/256,0,256,256/256,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/256,256,256,256/256,256/0/b0.jpg b/test/data/iiif_1_1_files/256,256,256,256/256,256/0/b0.jpg new file mode 100644 index 00000000..b57469a8 Binary files /dev/null and b/test/data/iiif_1_1_files/256,256,256,256/256,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/256,512,256,256/256,256/0/b0.jpg b/test/data/iiif_1_1_files/256,512,256,256/256,256/0/b0.jpg new file mode 100644 index 00000000..7fd76a78 Binary files /dev/null and b/test/data/iiif_1_1_files/256,512,256,256/256,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/256,768,256,256/256,256/0/b0.jpg b/test/data/iiif_1_1_files/256,768,256,256/256,256/0/b0.jpg new file mode 100644 index 00000000..cf96a405 Binary files /dev/null and b/test/data/iiif_1_1_files/256,768,256,256/256,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/512,0,256,256/256,256/0/b0.jpg b/test/data/iiif_1_1_files/512,0,256,256/256,256/0/b0.jpg new file mode 100644 index 00000000..ca605428 Binary files /dev/null and b/test/data/iiif_1_1_files/512,0,256,256/256,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/512,0,263,512/132,256/0/b0.jpg b/test/data/iiif_1_1_files/512,0,263,512/132,256/0/b0.jpg new file mode 100644 index 00000000..ca48f792 Binary files /dev/null and b/test/data/iiif_1_1_files/512,0,263,512/132,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/512,0,263,512/132,256/0/native.jpg b/test/data/iiif_1_1_files/512,0,263,512/132,256/0/native.jpg new file mode 100644 index 00000000..ca48f792 Binary files /dev/null and b/test/data/iiif_1_1_files/512,0,263,512/132,256/0/native.jpg differ diff --git a/test/data/iiif_1_1_files/512,256,256,256/256,256/0/b0.jpg b/test/data/iiif_1_1_files/512,256,256,256/256,256/0/b0.jpg new file mode 100644 index 00000000..41dd14bb Binary files /dev/null and b/test/data/iiif_1_1_files/512,256,256,256/256,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/512,512,256,256/256,256/0/b0.jpg b/test/data/iiif_1_1_files/512,512,256,256/256,256/0/b0.jpg new file mode 100644 index 00000000..1b42d53c Binary files /dev/null and b/test/data/iiif_1_1_files/512,512,256,256/256,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/512,512,263,512/132,256/0/b0.jpg b/test/data/iiif_1_1_files/512,512,263,512/132,256/0/b0.jpg new file mode 100644 index 00000000..baa4ee5d Binary files /dev/null and b/test/data/iiif_1_1_files/512,512,263,512/132,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/512,512,263,512/132,256/0/native.jpg b/test/data/iiif_1_1_files/512,512,263,512/132,256/0/native.jpg new file mode 100644 index 00000000..baa4ee5d Binary files /dev/null and b/test/data/iiif_1_1_files/512,512,263,512/132,256/0/native.jpg differ diff --git a/test/data/iiif_1_1_files/512,768,256,256/256,256/0/b0.jpg b/test/data/iiif_1_1_files/512,768,256,256/256,256/0/b0.jpg new file mode 100644 index 00000000..b3e0f5cb Binary files /dev/null and b/test/data/iiif_1_1_files/512,768,256,256/256,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/768,0,7,256/7,256/0/b0.jpg b/test/data/iiif_1_1_files/768,0,7,256/7,256/0/b0.jpg new file mode 100644 index 00000000..7f08427a Binary files /dev/null and b/test/data/iiif_1_1_files/768,0,7,256/7,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/768,256,7,256/7,256/0/b0.jpg b/test/data/iiif_1_1_files/768,256,7,256/7,256/0/b0.jpg new file mode 100644 index 00000000..b21f307b Binary files /dev/null and b/test/data/iiif_1_1_files/768,256,7,256/7,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/768,512,7,256/7,256/0/b0.jpg b/test/data/iiif_1_1_files/768,512,7,256/7,256/0/b0.jpg new file mode 100644 index 00000000..4a92be8c Binary files /dev/null and b/test/data/iiif_1_1_files/768,512,7,256/7,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/768,768,7,256/7,256/0/b0.jpg b/test/data/iiif_1_1_files/768,768,7,256/7,256/0/b0.jpg new file mode 100644 index 00000000..f167fa29 Binary files /dev/null and b/test/data/iiif_1_1_files/768,768,7,256/7,256/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/full/1,1/0/b0.jpg b/test/data/iiif_1_1_files/full/1,1/0/b0.jpg new file mode 100644 index 00000000..6b3670c8 Binary files /dev/null and b/test/data/iiif_1_1_files/full/1,1/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/full/1,1/0/native.jpg b/test/data/iiif_1_1_files/full/1,1/0/native.jpg new file mode 100644 index 00000000..6b3670c8 Binary files /dev/null and b/test/data/iiif_1_1_files/full/1,1/0/native.jpg differ diff --git a/test/data/iiif_1_1_files/full/13,16/0/b0.jpg b/test/data/iiif_1_1_files/full/13,16/0/b0.jpg new file mode 100644 index 00000000..f9cb6979 Binary files /dev/null and b/test/data/iiif_1_1_files/full/13,16/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/full/13,16/0/native.jpg b/test/data/iiif_1_1_files/full/13,16/0/native.jpg new file mode 100644 index 00000000..f9cb6979 Binary files /dev/null and b/test/data/iiif_1_1_files/full/13,16/0/native.jpg differ diff --git a/test/data/iiif_1_1_files/full/2,2/0/b0.jpg b/test/data/iiif_1_1_files/full/2,2/0/b0.jpg new file mode 100644 index 00000000..a335cd34 Binary files /dev/null and b/test/data/iiif_1_1_files/full/2,2/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/full/2,2/0/native.jpg b/test/data/iiif_1_1_files/full/2,2/0/native.jpg new file mode 100644 index 00000000..a335cd34 Binary files /dev/null and b/test/data/iiif_1_1_files/full/2,2/0/native.jpg differ diff --git a/test/data/iiif_1_1_files/full/25,32/0/b0.jpg b/test/data/iiif_1_1_files/full/25,32/0/b0.jpg new file mode 100644 index 00000000..18a43a03 Binary files /dev/null and b/test/data/iiif_1_1_files/full/25,32/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/full/25,32/0/native.jpg b/test/data/iiif_1_1_files/full/25,32/0/native.jpg new file mode 100644 index 00000000..18a43a03 Binary files /dev/null and b/test/data/iiif_1_1_files/full/25,32/0/native.jpg differ diff --git a/test/data/iiif_1_1_files/full/4,4/0/b0.jpg b/test/data/iiif_1_1_files/full/4,4/0/b0.jpg new file mode 100644 index 00000000..ce882561 Binary files /dev/null and b/test/data/iiif_1_1_files/full/4,4/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/full/4,4/0/native.jpg b/test/data/iiif_1_1_files/full/4,4/0/native.jpg new file mode 100644 index 00000000..ce882561 Binary files /dev/null and b/test/data/iiif_1_1_files/full/4,4/0/native.jpg differ diff --git a/test/data/iiif_1_1_files/full/49,64/0/b0.jpg b/test/data/iiif_1_1_files/full/49,64/0/b0.jpg new file mode 100644 index 00000000..68b8eb9c Binary files /dev/null and b/test/data/iiif_1_1_files/full/49,64/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/full/49,64/0/native.jpg b/test/data/iiif_1_1_files/full/49,64/0/native.jpg new file mode 100644 index 00000000..68b8eb9c Binary files /dev/null and b/test/data/iiif_1_1_files/full/49,64/0/native.jpg differ diff --git a/test/data/iiif_1_1_files/full/7,8/0/b0.jpg b/test/data/iiif_1_1_files/full/7,8/0/b0.jpg new file mode 100644 index 00000000..4c234847 Binary files /dev/null and b/test/data/iiif_1_1_files/full/7,8/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/full/7,8/0/native.jpg b/test/data/iiif_1_1_files/full/7,8/0/native.jpg new file mode 100644 index 00000000..4c234847 Binary files /dev/null and b/test/data/iiif_1_1_files/full/7,8/0/native.jpg differ diff --git a/test/data/iiif_1_1_files/full/97,128/0/b0.jpg b/test/data/iiif_1_1_files/full/97,128/0/b0.jpg new file mode 100644 index 00000000..4afad0bf Binary files /dev/null and b/test/data/iiif_1_1_files/full/97,128/0/b0.jpg differ diff --git a/test/data/iiif_1_1_files/full/97,128/0/native.jpg b/test/data/iiif_1_1_files/full/97,128/0/native.jpg new file mode 100644 index 00000000..4afad0bf Binary files /dev/null and b/test/data/iiif_1_1_files/full/97,128/0/native.jpg differ diff --git a/test/formats.js b/test/formats.js index 0c673bcf..7a81c4f7 100644 --- a/test/formats.js +++ b/test/formats.js @@ -65,4 +65,19 @@ testOpen('testpattern.xml'); }); + // ---------- + asyncTest('IIIF 1.0 JSON', function() { + testOpen('iiif1_0.json'); + }); + + // ---------- + asyncTest('IIIF 1.0 XML', function() { + testOpen('iiif1_0.xml'); + }); + + // ---------- + asyncTest('IIIF 1.1 JSON', function() { + testOpen('iiif1_1.json'); + }); + })(); diff --git a/test/strings.js b/test/strings.js index 1c740a8a..0cc0d8d4 100644 --- a/test/strings.js +++ b/test/strings.js @@ -15,7 +15,7 @@ }); test("getStringWithPlaceholders", function() { - equal(OpenSeadragon.getString("Errors.Open-Failed", "foo", "bar"), + equal(OpenSeadragon.getString("Errors.OpenFailed", "foo", "bar"), "Unable to open foo: bar", "String placeholder replacement"); });