From 3f9fd2f47a6a1b6de16025be067fedf81ac67172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Fri, 22 Jun 2012 16:48:34 +0200 Subject: [PATCH] [ol.TileCache] tile cache size is not 1 --- test/spec/ol/TileCache.test.js | 18 ++++++++++++++++++ test/spec/ol/layer/TileLayer.test.js | 10 +++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/test/spec/ol/TileCache.test.js b/test/spec/ol/TileCache.test.js index a3a8a3140d..bcb80bd52a 100644 --- a/test/spec/ol/TileCache.test.js +++ b/test/spec/ol/TileCache.test.js @@ -1,5 +1,23 @@ describe('ol.TileCache', function() { + describe('add tiles to cache', function() { + var Tile, tilecache; + + beforeEach(function() { + Tile = ol.Tile.createConstructor(200, 200); + tilecache = new ol.TileCache(5); + }); + + it('does add tiles, without exceeding cache size', function() { + for (var i=0; i<6; i++) { + var url = 'url' + i; + var tile = new Tile(url); + tilecache.set(url, tile); + } + expect(tilecache.getCount()).toEqual(5); + }); + }); + describe('exceed the cache capacity', function() { var Tile, tilecache, tile; diff --git a/test/spec/ol/layer/TileLayer.test.js b/test/spec/ol/layer/TileLayer.test.js index 5bd291d6ef..60d837b6cf 100644 --- a/test/spec/ol/layer/TileLayer.test.js +++ b/test/spec/ol/layer/TileLayer.test.js @@ -363,11 +363,11 @@ describe('ol.layer.TileLayer', function() { it('returns the expected tile', function() { var tile = layer.getTileForXYZ(1, 2, 2); expect(tile.getUrl()).toEqual('/2/1/2'); - //var bounds = tile.getBounds(); - //expect(bounds.getMinX()).toEqual(-64); - //expect(bounds.getMinY()).toEqual(0); - //expect(bounds.getMaxX()).toEqual(0); - //expect(bounds.getMaxY()).toEqual(64); + var bounds = tile.getBounds(); + expect(bounds.getMinX()).toEqual(-64); + expect(bounds.getMinY()).toEqual(0); + expect(bounds.getMaxX()).toEqual(0); + expect(bounds.getMaxY()).toEqual(64); }); });