+2
-3
@@ -20,9 +20,8 @@
|
|||||||
"karma": "node tasks/test.js start test/karma.config.js",
|
"karma": "node tasks/test.js start test/karma.config.js",
|
||||||
"transform-src": "jscodeshift --transform transforms/module.js src",
|
"transform-src": "jscodeshift --transform transforms/module.js src",
|
||||||
"transform-examples": "jscodeshift --transform transforms/module.js examples",
|
"transform-examples": "jscodeshift --transform transforms/module.js examples",
|
||||||
"transform-test-spec": "jscodeshift --transform transforms/module.js test/spec",
|
"transform-test": "jscodeshift --transform transforms/module.js test",
|
||||||
"transform-test-rendering": "jscodeshift --transform transforms/module.js test/rendering",
|
"transform": "npm run transform-src && npm run transform-examples && npm run transform-test && npm run lint -- --fix"
|
||||||
"transform": "npm run transform-src && npm run transform-examples && npm run transform-test-spec && npm run transform-test-rendering && npm run lint -- --fix"
|
|
||||||
},
|
},
|
||||||
"main": "dist/ol.js",
|
"main": "dist/ol.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
|
goog.require('ol.proj.EPSG3857');
|
||||||
|
|
||||||
describe('ol.proj.EPSG3857', function() {
|
describe('ol.proj.EPSG3857', function() {
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
goog.provide('ol.test.source.TileSource'); // eslint-disable-line openlayers-internal/valid-provide
|
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.Tile');
|
||||||
goog.require('ol.TileRange');
|
goog.require('ol.TileRange');
|
||||||
@@ -18,7 +16,7 @@ goog.require('ol.tilegrid.TileGrid');
|
|||||||
* @param {Object.<string, ol.TileState>} tileStates Lookup of tile key to
|
* @param {Object.<string, ol.TileState>} tileStates Lookup of tile key to
|
||||||
* tile state.
|
* tile state.
|
||||||
*/
|
*/
|
||||||
ol.test.source.TileSource.Mock = function(tileStates) {
|
var MockTile = function(tileStates) {
|
||||||
var tileGrid = new ol.tilegrid.TileGrid({
|
var tileGrid = new ol.tilegrid.TileGrid({
|
||||||
resolutions: [360 / 256, 180 / 256, 90 / 256, 45 / 256],
|
resolutions: [360 / 256, 180 / 256, 90 / 256, 45 / 256],
|
||||||
origin: [-180, -180],
|
origin: [-180, -180],
|
||||||
@@ -35,13 +33,13 @@ ol.test.source.TileSource.Mock = function(tileStates) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(ol.test.source.TileSource.Mock, ol.source.Tile);
|
ol.inherits(MockTile, ol.source.Tile);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.test.source.TileSource.Mock.prototype.getTile = function(z, x, y) {
|
MockTile.prototype.getTile = function(z, x, y) {
|
||||||
var key = this.getKeyZXY(z, x, y);
|
var key = this.getKeyZXY(z, x, y);
|
||||||
if (this.tileCache.containsKey(key)) {
|
if (this.tileCache.containsKey(key)) {
|
||||||
return /** @type {!ol.Tile} */ (this.tileCache.get(key));
|
return /** @type {!ol.Tile} */ (this.tileCache.get(key));
|
||||||
@@ -121,7 +119,7 @@ describe('ol.source.Tile', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('does not call the callback if no tiles are loaded', function() {
|
it('does not call the callback if no tiles are loaded', function() {
|
||||||
var source = new ol.test.source.TileSource.Mock({});
|
var source = new MockTile({});
|
||||||
var grid = source.getTileGrid();
|
var grid = source.getTileGrid();
|
||||||
var extent = [-180, -180, 180, 180];
|
var extent = [-180, -180, 180, 180];
|
||||||
var zoom = 3;
|
var zoom = 3;
|
||||||
@@ -132,7 +130,7 @@ describe('ol.source.Tile', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('does not call getTile() if no tiles are loaded', function() {
|
it('does not call getTile() if no tiles are loaded', function() {
|
||||||
var source = new ol.test.source.TileSource.Mock({});
|
var source = new MockTile({});
|
||||||
sinon.spy(source, 'getTile');
|
sinon.spy(source, 'getTile');
|
||||||
var grid = source.getTileGrid();
|
var grid = source.getTileGrid();
|
||||||
var extent = [-180, -180, 180, 180];
|
var extent = [-180, -180, 180, 180];
|
||||||
@@ -146,7 +144,7 @@ describe('ol.source.Tile', function() {
|
|||||||
|
|
||||||
|
|
||||||
it('calls callback for each loaded tile', function() {
|
it('calls callback for each loaded tile', function() {
|
||||||
var source = new ol.test.source.TileSource.Mock({
|
var source = new MockTile({
|
||||||
'1/0/0': 2, // LOADED
|
'1/0/0': 2, // LOADED
|
||||||
'1/0/1': 2, // LOADED
|
'1/0/1': 2, // LOADED
|
||||||
'1/1/0': 1, // LOADING,
|
'1/1/0': 1, // LOADING,
|
||||||
@@ -162,7 +160,7 @@ describe('ol.source.Tile', function() {
|
|||||||
|
|
||||||
it('returns true if range is fully loaded', function() {
|
it('returns true if range is fully loaded', function() {
|
||||||
// a source with no loaded tiles
|
// a source with no loaded tiles
|
||||||
var source = new ol.test.source.TileSource.Mock({
|
var source = new MockTile({
|
||||||
'1/0/0': 2, // LOADED,
|
'1/0/0': 2, // LOADED,
|
||||||
'1/0/1': 2, // LOADED,
|
'1/0/1': 2, // LOADED,
|
||||||
'1/1/0': 2, // LOADED,
|
'1/1/0': 2, // LOADED,
|
||||||
@@ -182,7 +180,7 @@ describe('ol.source.Tile', function() {
|
|||||||
|
|
||||||
it('returns false if range is not fully loaded', function() {
|
it('returns false if range is not fully loaded', function() {
|
||||||
// a source with no loaded tiles
|
// a source with no loaded tiles
|
||||||
var source = new ol.test.source.TileSource.Mock({
|
var source = new MockTile({
|
||||||
'1/0/0': 2, // LOADED,
|
'1/0/0': 2, // LOADED,
|
||||||
'1/0/1': 2, // LOADED,
|
'1/0/1': 2, // LOADED,
|
||||||
'1/1/0': 1, // LOADING,
|
'1/1/0': 1, // LOADING,
|
||||||
@@ -202,7 +200,7 @@ describe('ol.source.Tile', function() {
|
|||||||
|
|
||||||
it('allows callback to override loaded check', function() {
|
it('allows callback to override loaded check', function() {
|
||||||
// a source with no loaded tiles
|
// a source with no loaded tiles
|
||||||
var source = new ol.test.source.TileSource.Mock({
|
var source = new MockTile({
|
||||||
'1/0/0': 2, // LOADED,
|
'1/0/0': 2, // LOADED,
|
||||||
'1/0/1': 2, // LOADED,
|
'1/0/1': 2, // LOADED,
|
||||||
'1/1/0': 2, // LOADED,
|
'1/1/0': 2, // LOADED,
|
||||||
@@ -274,7 +272,7 @@ describe('ol.source.Tile', function() {
|
|||||||
describe('#refresh()', function() {
|
describe('#refresh()', function() {
|
||||||
it('checks clearing of internal state', function() {
|
it('checks clearing of internal state', function() {
|
||||||
// create a source with one loaded tile
|
// create a source with one loaded tile
|
||||||
var source = new ol.test.source.TileSource.Mock({
|
var source = new MockTile({
|
||||||
'1/0/0': 2 // LOADED
|
'1/0/0': 2 // LOADED
|
||||||
});
|
});
|
||||||
// check the loaded tile is there
|
// check the loaded tile is there
|
||||||
@@ -292,19 +290,19 @@ describe('ol.source.Tile', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('ol.test.source.TileSource.Mock', function() {
|
describe('MockTile', function() {
|
||||||
|
|
||||||
describe('constructor', function() {
|
describe('constructor', function() {
|
||||||
it('creates a tile source', function() {
|
it('creates a tile source', function() {
|
||||||
var source = new ol.test.source.TileSource.Mock({});
|
var source = new MockTile({});
|
||||||
expect(source).to.be.a(ol.source.Tile);
|
expect(source).to.be.a(ol.source.Tile);
|
||||||
expect(source).to.be.a(ol.test.source.TileSource.Mock);
|
expect(source).to.be.a(MockTile);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#getTile()', function() {
|
describe('#getTile()', function() {
|
||||||
it('returns a tile with state based on constructor arg', function() {
|
it('returns a tile with state based on constructor arg', function() {
|
||||||
var source = new ol.test.source.TileSource.Mock({
|
var source = new MockTile({
|
||||||
'0/0/0': 2, // LOADED,
|
'0/0/0': 2, // LOADED,
|
||||||
'1/0/0': 2 // LOADED
|
'1/0/0': 2 // LOADED
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ describe('ol.style.IconImageCache', function() {
|
|||||||
|
|
||||||
for (i = 0; i < 4; ++i) {
|
for (i = 0; i < 4; ++i) {
|
||||||
src = i + '';
|
src = i + '';
|
||||||
iconImage = new ol.style.IconImage(src, null);
|
iconImage = new ol.style.IconImage(null, src);
|
||||||
cache.set(src, null, null, iconImage);
|
cache.set(src, null, null, iconImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
|
|
||||||
|
|
||||||
goog.require('ol.TileUrlFunction');
|
goog.require('ol.TileUrlFunction');
|
||||||
|
goog.require('ol.tilecoord');
|
||||||
goog.require('ol.tilegrid');
|
goog.require('ol.tilegrid');
|
||||||
goog.require('ol.tilegrid.TileGrid');
|
goog.require('ol.tilegrid.TileGrid');
|
||||||
|
|
||||||
|
|
||||||
describe('ol.TileUrlFunction', function() {
|
describe('ol.TileUrlFunction', function() {
|
||||||
|
|
||||||
describe('expandUrl', function() {
|
describe('expandUrl', function() {
|
||||||
|
|||||||
@@ -514,4 +514,4 @@ goog.require('ol.renderer.webgl.Map');
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
})(this);
|
})(window);
|
||||||
|
|||||||
Reference in New Issue
Block a user