Fixed test breakages

This commit is contained in:
Ian Gilman 2014-11-03 17:14:17 -08:00
parent f8156991ef
commit 00c2881c64
7 changed files with 35 additions and 12 deletions

View File

@ -504,11 +504,6 @@ $.Viewer = function( options ) {
}); });
} }
// Create initial overlays
for ( i = 0; i < this.overlays.length; i++ ) {
this.currentOverlays[ i ] = getOverlayObject( this, this.overlays[ i ] );
}
// Open initial tilesources // Open initial tilesources
if ( this.tileSources ) { if ( this.tileSources ) {
this.open( this.tileSources ); this.open( this.tileSources );
@ -606,6 +601,11 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
source = source.tileSource; source = source.tileSource;
} }
// Global overlays
for ( var i = 0; i < _this.overlays.length; i++ ) {
_this.currentOverlays[ i ] = getOverlayObject( _this, _this.overlays[ i ] );
}
/** /**
* Raised when the viewer has opened and loaded one or more TileSources. * Raised when the viewer has opened and loaded one or more TileSources.
* *
@ -683,6 +683,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
} }
}; };
// TileSources
for (var i = 0; i < tileSources.length; i++) { for (var i = 0; i < tileSources.length; i++) {
doOne(tileSources[i]); doOne(tileSources[i]);
} }

View File

@ -272,7 +272,7 @@ $.extend( $.World.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.W
var box; var box;
for ( var i = 1; i < this._items.length; i++ ) { for ( var i = 1; i < this._items.length; i++ ) {
box = this._items[i].getWorldBounds(); box = this._items[i].getWorldBounds();
this._contentFactor = Math.max(this._contentFactor, this._items[i].getContentSize().x / bounds.width); this._contentFactor = Math.max(this._contentFactor, this._items[i].getContentSize().x / box.width);
left = Math.min( left, box.x ); left = Math.min( left, box.x );
top = Math.min( top, box.y ); top = Math.min( top, box.y );
right = Math.max( right, box.x + box.width ); right = Math.max( right, box.x + box.width );

View File

@ -95,7 +95,8 @@
var panHandler = function() { var panHandler = function() {
viewer.removeHandler('animation-finish', panHandler); viewer.removeHandler('animation-finish', panHandler);
center = viewport.getCenter(); center = viewport.getCenter();
ok(center.x === 0.1 && center.y === 0.1, 'Panned correctly'); Util.assessNumericValue(center.x, 0.1, 0.00001, 'panned horizontally');
Util.assessNumericValue(center.y, 0.1, 0.00001, 'panned vertically');
start(); start();
}; };
@ -260,9 +261,8 @@
viewer.removeHandler('close', closeHandler); viewer.removeHandler('close', closeHandler);
ok(!viewer.source, 'no source'); ok(!viewer.source, 'no source');
ok(true, 'Close event was sent'); ok(true, 'Close event was sent');
ok(!viewer._updateRequestId, 'timer is off');
setTimeout(function() { setTimeout(function() {
ok(!viewer._updateRequestId, 'timer is still off'); ok(!viewer._updateRequestId, 'timer is off');
start(); start();
}, 100); }, 100);
}; };

View File

@ -14,6 +14,10 @@
height: 100%; height: 100%;
} }
.openseadragon-overlay {
background-color: rgba(255, 0, 0, 0.3);
}
</style> </style>
</head> </head>
<body> <body>

View File

@ -27,7 +27,25 @@
showNavigator: true, showNavigator: true,
id: "contentDiv", id: "contentDiv",
tileSources: tileSources, tileSources: tileSources,
prefixUrl: "../../../build/openseadragon/images/" prefixUrl: "../../../build/openseadragon/images/",
overlays: [ {
px: 13,
py: 120,
width: 124,
height: 132,
id: "overlay"
}, {
px: 400,
py: 500,
width: 400,
height: 400,
id: "fixed-overlay",
placement: "TOP_LEFT"
} ]
} );
this.viewer.addHandler( "open", function() {
// console.log(self.viewer.viewport.contentSize);
}); });
// this.crossTest3(); // this.crossTest3();

View File

@ -144,7 +144,7 @@
viewer.addHandler( "add-item-failed", viewer.addHandler( "add-item-failed",
function addItemFailedHandler( event ) { function addItemFailedHandler( event ) {
viewer.removeHandler( "add-item-failed", addItemFailedHandler ); viewer.removeHandler( "add-item-failed", addItemFailedHandler );
equal( event.message, "[Viewer.addTiledImage] Sequences can not be added." ); equal( event.message, "[Viewer.addTiledImage] Sequences can not be added; add them one at a time instead." );
equal( event.options, options, "Item failed event should give the options." ); equal( event.options, options, "Item failed event should give the options." );
start(); start();
} ); } );