Transformed
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.proj.Projection');
|
||||
goog.require('ol.source.Zoomify');
|
||||
goog.require('ol.tilegrid.TileGrid');
|
||||
import _ol_ from '../../../../src/ol.js';
|
||||
import _ol_events_ from '../../../../src/ol/events.js';
|
||||
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
|
||||
import _ol_source_Zoomify_ from '../../../../src/ol/source/Zoomify.js';
|
||||
import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
|
||||
|
||||
|
||||
describe('ol.source.Zoomify', function() {
|
||||
@@ -13,32 +11,32 @@ describe('ol.source.Zoomify', function() {
|
||||
var size = [w, h];
|
||||
var zoomifyUrl = 'spec/ol/source/images/zoomify/{TileGroup}/{z}-{x}-{y}.jpg';
|
||||
var iipUrl = 'spec/ol/source/images/zoomify?JTL={z},{tileIndex}';
|
||||
var proj = new ol.proj.Projection({
|
||||
var proj = new _ol_proj_Projection_({
|
||||
code: 'ZOOMIFY',
|
||||
units: 'pixels',
|
||||
extent: [0, 0, w, h]
|
||||
});
|
||||
function getZoomifySource() {
|
||||
return new ol.source.Zoomify({
|
||||
return new _ol_source_Zoomify_({
|
||||
url: zoomifyUrl,
|
||||
size: size
|
||||
});
|
||||
}
|
||||
function getZoomifySourceWithExtentInFirstQuadrant() {
|
||||
return new ol.source.Zoomify({
|
||||
return new _ol_source_Zoomify_({
|
||||
url: zoomifyUrl,
|
||||
size: size,
|
||||
extent: [0, 0, size[0], size[1]]
|
||||
});
|
||||
}
|
||||
function getIIPSource() {
|
||||
return new ol.source.Zoomify({
|
||||
return new _ol_source_Zoomify_({
|
||||
url: iipUrl,
|
||||
size: size
|
||||
});
|
||||
}
|
||||
function getZoomifySourceWith1024pxTiles() {
|
||||
return new ol.source.Zoomify({
|
||||
return new _ol_source_Zoomify_({
|
||||
url: zoomifyUrl,
|
||||
size: size,
|
||||
tileSize: 1024
|
||||
@@ -52,29 +50,29 @@ describe('ol.source.Zoomify', function() {
|
||||
|
||||
// undefined config object
|
||||
expect(function() {
|
||||
source = new ol.source.Zoomify();
|
||||
source = new _ol_source_Zoomify_();
|
||||
}).to.throwException();
|
||||
|
||||
// empty object as config object
|
||||
expect(function() {
|
||||
source = new ol.source.Zoomify({});
|
||||
source = new _ol_source_Zoomify_({});
|
||||
}).to.throwException();
|
||||
|
||||
// not passing "size" in config object
|
||||
expect(function() {
|
||||
source = new ol.source.Zoomify({
|
||||
source = new _ol_source_Zoomify_({
|
||||
url: 'some-url'
|
||||
});
|
||||
}).to.throwException();
|
||||
|
||||
// passing "size" in config object
|
||||
expect(function() {
|
||||
source = new ol.source.Zoomify({
|
||||
source = new _ol_source_Zoomify_({
|
||||
size: [47, 11]
|
||||
});
|
||||
}).to.not.throwException();
|
||||
// we got a source
|
||||
expect(source).to.be.a(ol.source.Zoomify);
|
||||
expect(source).to.be.a(_ol_source_Zoomify_);
|
||||
|
||||
// also test our helper methods from above
|
||||
expect(function() {
|
||||
@@ -84,12 +82,12 @@ describe('ol.source.Zoomify', function() {
|
||||
source = getIIPSource();
|
||||
}).to.not.throwException();
|
||||
// we got a source
|
||||
expect(source).to.be.a(ol.source.Zoomify);
|
||||
expect(source).to.be.a(_ol_source_Zoomify_);
|
||||
});
|
||||
|
||||
it('does not need "tierSizeCalculation" option', function() {
|
||||
expect(function() {
|
||||
new ol.source.Zoomify({
|
||||
new _ol_source_Zoomify_({
|
||||
size: [47, 11]
|
||||
});
|
||||
}).to.not.throwException();
|
||||
@@ -97,7 +95,7 @@ describe('ol.source.Zoomify', function() {
|
||||
|
||||
it('accepts "tierSizeCalculation" option "default"', function() {
|
||||
expect(function() {
|
||||
new ol.source.Zoomify({
|
||||
new _ol_source_Zoomify_({
|
||||
size: [47, 11],
|
||||
tierSizeCalculation: 'default'
|
||||
});
|
||||
@@ -106,7 +104,7 @@ describe('ol.source.Zoomify', function() {
|
||||
|
||||
it('accepts "tierSizeCalculation" option "truncated"', function() {
|
||||
expect(function() {
|
||||
new ol.source.Zoomify({
|
||||
new _ol_source_Zoomify_({
|
||||
size: [47, 11],
|
||||
tierSizeCalculation: 'truncated'
|
||||
});
|
||||
@@ -116,7 +114,7 @@ describe('ol.source.Zoomify', function() {
|
||||
it('throws on unexpected "tierSizeCalculation" ', function() {
|
||||
// passing unknown string will throw
|
||||
expect(function() {
|
||||
new ol.source.Zoomify({
|
||||
new _ol_source_Zoomify_({
|
||||
size: [47, 11],
|
||||
tierSizeCalculation: 'ace-of-spades'
|
||||
});
|
||||
@@ -127,7 +125,7 @@ describe('ol.source.Zoomify', function() {
|
||||
var sources = [getZoomifySource(), getIIPSource()];
|
||||
for (var i = 0; i < sources.length; i++) {
|
||||
var tileGrid = sources[i].getTileGrid();
|
||||
expect(tileGrid).to.be.a(ol.tilegrid.TileGrid);
|
||||
expect(tileGrid).to.be.a(_ol_tilegrid_TileGrid_);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -164,7 +162,7 @@ describe('ol.source.Zoomify', function() {
|
||||
|
||||
it('has expected tileSize', function() {
|
||||
var sources = [getZoomifySource(), getZoomifySourceWith1024pxTiles()];
|
||||
var expectedTileSizes = [ol.DEFAULT_TILE_SIZE, 1024];
|
||||
var expectedTileSizes = [_ol_.DEFAULT_TILE_SIZE, 1024];
|
||||
for (var i = 0; i < sources.length; i++) {
|
||||
var tileGrid = sources[i].getTileGrid();
|
||||
expect(tileGrid.getTileSize()).to.eql(expectedTileSizes[i]);
|
||||
@@ -201,14 +199,14 @@ describe('ol.source.Zoomify', function() {
|
||||
|
||||
it('influences resolutions', function() {
|
||||
// not configured at all
|
||||
var source = new ol.source.Zoomify({
|
||||
var source = new _ol_source_Zoomify_({
|
||||
url: zoomifyUrl,
|
||||
size: [513, 256]
|
||||
});
|
||||
var tileGrid = source.getTileGrid();
|
||||
|
||||
// explicitly set as 'default'
|
||||
var sourceDefault = new ol.source.Zoomify({
|
||||
var sourceDefault = new _ol_source_Zoomify_({
|
||||
url: zoomifyUrl,
|
||||
size: [513, 256],
|
||||
tierSizeCalculation: 'default'
|
||||
@@ -216,7 +214,7 @@ describe('ol.source.Zoomify', function() {
|
||||
var tileGridDefault = sourceDefault.getTileGrid();
|
||||
|
||||
// explicitly set to 'truncated'
|
||||
var sourceTruncated = new ol.source.Zoomify({
|
||||
var sourceTruncated = new _ol_source_Zoomify_({
|
||||
url: zoomifyUrl,
|
||||
size: [513, 256],
|
||||
tierSizeCalculation: 'truncated'
|
||||
@@ -256,7 +254,7 @@ describe('ol.source.Zoomify', function() {
|
||||
});
|
||||
|
||||
it('creates an expected tileUrlFunction without template', function() {
|
||||
var source = new ol.source.Zoomify({
|
||||
var source = new _ol_source_Zoomify_({
|
||||
url: 'spec/ol/source/images/zoomify/',
|
||||
size: size
|
||||
});
|
||||
@@ -282,7 +280,7 @@ describe('ol.source.Zoomify', function() {
|
||||
it('returns expected tileClass instances via "getTile"', function() {
|
||||
var source = getZoomifySource();
|
||||
var tile = source.getTile(0, 0, -1, 1, proj);
|
||||
expect(tile).to.be.an(ol.source.Zoomify.Tile_);
|
||||
expect(tile).to.be.an(_ol_source_Zoomify_.Tile_);
|
||||
});
|
||||
|
||||
it('"tile.getImage" returns and caches an unloaded image', function() {
|
||||
@@ -303,7 +301,7 @@ describe('ol.source.Zoomify', function() {
|
||||
|
||||
var tile = source.getTile(0, 0, -1, 1, proj);
|
||||
|
||||
ol.events.listen(tile, 'change', function() {
|
||||
_ol_events_.listen(tile, 'change', function() {
|
||||
if (tile.getState() == 2) { // LOADED
|
||||
var img = tile.getImage();
|
||||
expect(img).to.be.a(HTMLCanvasElement);
|
||||
|
||||
Reference in New Issue
Block a user