From 932269c8b6c09b828b8efb23e32cd2eef9c410b9 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Thu, 15 Sep 2016 16:33:42 +0200 Subject: [PATCH 1/2] Remove unused ol.color.isValid function --- src/ol/color.js | 12 ------------ test/spec/ol/color.test.js | 22 ---------------------- 2 files changed, 34 deletions(-) diff --git a/src/ol/color.js b/src/ol/color.js index 5b156d362b..d1807c95c5 100644 --- a/src/ol/color.js +++ b/src/ol/color.js @@ -189,18 +189,6 @@ ol.color.fromStringInternal_ = function(s) { }; -/** - * @param {ol.Color} color Color. - * @return {boolean} Is valid. - */ -ol.color.isValid = function(color) { - return 0 <= color[0] && color[0] < 256 && - 0 <= color[1] && color[1] < 256 && - 0 <= color[2] && color[2] < 256 && - 0 <= color[3] && color[3] <= 1; -}; - - /** * @param {ol.Color} color Color. * @param {ol.Color=} opt_color Color. diff --git a/test/spec/ol/color.test.js b/test/spec/ol/color.test.js index 0df4432ed0..f713de47e8 100644 --- a/test/spec/ol/color.test.js +++ b/test/spec/ol/color.test.js @@ -103,28 +103,6 @@ describe('ol.color', function() { }); - describe('ol.color.isValid', function() { - - it('identifies valid colors', function() { - expect(ol.color.isValid([0, 0, 0, 0])).to.be(true); - expect(ol.color.isValid([255, 255, 255, 1])).to.be(true); - }); - - it('identifies out-of-range channels', function() { - expect(ol.color.isValid([-1, 0, 0, 0])).to.be(false); - expect(ol.color.isValid([256, 0, 0, 0])).to.be(false); - expect(ol.color.isValid([0, -1, 0, 0])).to.be(false); - expect(ol.color.isValid([0, 256, 0, 0])).to.be(false); - expect(ol.color.isValid([0, 0, -1, 0])).to.be(false); - expect(ol.color.isValid([0, 0, 256, 0])).to.be(false); - expect(ol.color.isValid([0, 0, -1, 0])).to.be(false); - expect(ol.color.isValid([0, 0, 256, 0])).to.be(false); - expect(ol.color.isValid([0, 0, 0, -1])).to.be(false); - expect(ol.color.isValid([0, 0, 0, 2])).to.be(false); - }); - - }); - describe('ol.color.normalize', function() { it('clamps out-of-range channels', function() { From 000207016f80570591547a0653b91418c250a5dd Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Thu, 15 Sep 2016 16:33:58 +0200 Subject: [PATCH 2/2] Remove unused ol.tilecoord.createFromString function --- src/ol/tilecoord.js | 17 ----------------- test/spec/ol/tilecoord.test.js | 10 ---------- 2 files changed, 27 deletions(-) diff --git a/src/ol/tilecoord.js b/src/ol/tilecoord.js index 3c33f24e78..b7b082c70e 100644 --- a/src/ol/tilecoord.js +++ b/src/ol/tilecoord.js @@ -1,22 +1,5 @@ goog.provide('ol.tilecoord'); -goog.require('ol'); - - -/** - * @param {string} str String that follows pattern “z/x/y” where x, y and z are - * numbers. - * @return {ol.TileCoord} Tile coord. - */ -ol.tilecoord.createFromString = function(str) { - var v = str.split('/'); - ol.DEBUG && console.assert(v.length === 3, - 'must provide a string in "z/x/y" format, got "%s"', str); - return v.map(function(e) { - return parseInt(e, 10); - }); -}; - /** * @param {number} z Z. diff --git a/test/spec/ol/tilecoord.test.js b/test/spec/ol/tilecoord.test.js index c940dd5bfa..f8b0ea66ae 100644 --- a/test/spec/ol/tilecoord.test.js +++ b/test/spec/ol/tilecoord.test.js @@ -15,16 +15,6 @@ describe('ol.TileCoord', function() { }); }); - describe('create from string', function() { - it('sets x y z properties as expected', function() { - var str = '1/2/3'; - var tileCoord = ol.tilecoord.createFromString(str); - expect(tileCoord[0]).to.eql(1); - expect(tileCoord[1]).to.eql(2); - expect(tileCoord[2]).to.eql(3); - }); - }); - describe('call quadKey', function() { it('returns expected string', function() { var tileCoord = [3, 3, 5];