Remove provide from tile.test.js

This commit is contained in:
Tim Schaub
2017-08-18 15:56:20 -04:00
parent 1e7f21f423
commit 521f06e91c
+14 -16
View File
@@ -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
}); });