From 66f23c1aed2fb8c8b8abf475c0d6e7b00604ffd7 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 1 Mar 2016 13:27:58 -0700 Subject: [PATCH 1/4] Upgrade to pixelworks@1.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6a51a3a31d..f984ceaf9b 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "metalsmith-layouts": "1.6.4", "nomnom": "1.8.1", "pbf": "1.3.5", - "pixelworks": "1.0.0", + "pixelworks": "1.1.0", "rbush": "1.4.2", "temp": "0.8.3", "vector-tile": "1.2.0", From bc01fdb59af8f62f6af968817640a58b11ac7f6d Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 1 Mar 2016 13:28:20 -0700 Subject: [PATCH 2/4] Return ImageData-like objects for IE support --- examples/region-growing.js | 2 +- examples/shaded-relief.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/region-growing.js b/examples/region-growing.js index 39a5e53be6..80188b74b3 100644 --- a/examples/region-growing.js +++ b/examples/region-growing.js @@ -59,7 +59,7 @@ function growRegion(inputs, data) { } edge = newedge; } - return new ImageData(outputData, width, height); + return {data: outputData, width: width, height: height}; } function next4Edges(edge) { diff --git a/examples/shaded-relief.js b/examples/shaded-relief.js index a4751d9c2f..92c6ade1b6 100644 --- a/examples/shaded-relief.js +++ b/examples/shaded-relief.js @@ -99,7 +99,7 @@ function shade(inputs, data) { } } - return new ImageData(shadeData, width, height); + return {data: shadeData, width: width, height: height}; } var elevation = new ol.source.XYZ({ From 5aa175241a11daa81e2ef510e2bc3ffcad679e39 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 1 Mar 2016 13:43:55 -0700 Subject: [PATCH 3/4] No need to check for ImageData constructor in the tests --- test/spec/ol/source/rastersource.test.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/test/spec/ol/source/rastersource.test.js b/test/spec/ol/source/rastersource.test.js index 28a807ee76..0d4d10fe17 100644 --- a/test/spec/ol/source/rastersource.test.js +++ b/test/spec/ol/source/rastersource.test.js @@ -11,16 +11,7 @@ var blue = 'data:image/gif;base64,R0lGODlhAQABAPAAAAAA/////yH5BAAAAAAALAAAAA' + var itNoPhantom = window.checkForMocha ? xit : it; -var hasImageDataConstructor = true; -try { - new ImageData(1, 1); -} catch (e) { - hasImageDataConstructor = false; -} - -var maybeDescribe = hasImageDataConstructor ? describe : xdescribe; - -maybeDescribe('ol.source.Raster', function() { +describe('ol.source.Raster', function() { var target, map, redSource, greenSource, blueSource, raster; From efdc8922194362a50e029e00b4bfcafe43f85133 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 1 Mar 2016 13:50:31 -0700 Subject: [PATCH 4/4] Run ol.source.Raster tests in Phantom --- test/spec/ol/source/rastersource.test.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/test/spec/ol/source/rastersource.test.js b/test/spec/ol/source/rastersource.test.js index 0d4d10fe17..559f74813b 100644 --- a/test/spec/ol/source/rastersource.test.js +++ b/test/spec/ol/source/rastersource.test.js @@ -9,8 +9,6 @@ var green = 'data:image/gif;base64,R0lGODlhAQABAPAAAAD/AP///yH5BAAAAAAALAAAA' + var blue = 'data:image/gif;base64,R0lGODlhAQABAPAAAAAA/////yH5BAAAAAAALAAAAA' + 'ABAAEAAAICRAEAOw=='; -var itNoPhantom = window.checkForMocha ? xit : it; - describe('ol.source.Raster', function() { var target, map, redSource, greenSource, blueSource, raster; @@ -90,7 +88,7 @@ describe('ol.source.Raster', function() { expect(source).to.be.a(ol.source.Raster); }); - itNoPhantom('defaults to "pixel" operation', function(done) { + it('defaults to "pixel" operation', function(done) { var log = []; @@ -118,7 +116,7 @@ describe('ol.source.Raster', function() { }); - itNoPhantom('allows operation type to be set to "image"', function(done) { + it('allows operation type to be set to "image"', function(done) { var log = []; var source = new ol.source.Raster({ @@ -134,7 +132,10 @@ describe('ol.source.Raster', function() { source.once('afteroperations', function() { expect(log.length).to.equal(1); var inputs = log[0]; - expect(inputs[0]).to.be.an(ImageData); + var imageData = inputs[0]; + expect(imageData.data).to.be.a(Uint8ClampedArray); + expect(imageData.width).to.be(2); + expect(imageData.height).to.be(2); done(); }); @@ -149,7 +150,7 @@ describe('ol.source.Raster', function() { describe('#setOperation()', function() { - itNoPhantom('allows operation to be set', function(done) { + it('allows operation to be set', function(done) { var count = 0; raster.setOperation(function(pixels) { @@ -174,7 +175,7 @@ describe('ol.source.Raster', function() { }); - itNoPhantom('updates and re-runs the operation', function(done) { + it('updates and re-runs the operation', function(done) { var view = map.getView(); view.setCenter([0, 0]); @@ -198,7 +199,7 @@ describe('ol.source.Raster', function() { describe('beforeoperations', function() { - itNoPhantom('gets called before operations are run', function(done) { + it('gets called before operations are run', function(done) { var count = 0; raster.setOperation(function(inputs) { @@ -222,7 +223,7 @@ describe('ol.source.Raster', function() { }); - itNoPhantom('allows data to be set for the operation', function(done) { + it('allows data to be set for the operation', function(done) { raster.setOperation(function(inputs, data) { ++data.count; @@ -248,7 +249,7 @@ describe('ol.source.Raster', function() { describe('afteroperations', function() { - itNoPhantom('gets called after operations are run', function(done) { + it('gets called after operations are run', function(done) { var count = 0; raster.setOperation(function(inputs) { @@ -271,7 +272,7 @@ describe('ol.source.Raster', function() { }); - itNoPhantom('receives data set by the operation', function(done) { + it('receives data set by the operation', function(done) { raster.setOperation(function(inputs, data) { data.message = 'hello world';