diff --git a/test/spec/ol/render/webgl/replay.test.js b/test/spec/ol/render/webgl/replay.test.js index decb86cc18..1456bb2691 100644 --- a/test/spec/ol/render/webgl/replay.test.js +++ b/test/spec/ol/render/webgl/replay.test.js @@ -397,7 +397,7 @@ describe('ol.render.webgl.PolygonReplay', function() { replay = new ol.render.webgl.PolygonReplay(tolerance, maxExtent); }); - describe('#drawPolygonGeometry', function() { + describe('#drawPolygon', function() { beforeEach(function() { replay.setFillStrokeStyle(fillStyle, strokeStyle); }); @@ -406,44 +406,30 @@ describe('ol.render.webgl.PolygonReplay', function() { var polygon1 = new ol.geom.Polygon( [[[1000, 2000], [1200, 2000], [1200, 3000]]] ); - replay.drawPolygonGeometry(polygon1, null); - expect(replay.vertices_).to.have.length(18); - expect(replay.indices_).to.have.length(3); + replay.drawPolygon(polygon1, null); + expect(replay.vertices).to.have.length(6); + expect(replay.indices).to.have.length(3); - expect(replay.vertices_).to.eql([ - 1200, 2000, 0, 0, 1, 0.5, - 1200, 3000, 0, 0, 1, 0.5, - 1000, 2000, 0, 0, 1, 0.5]); - expect(replay.indices_).to.eql([0, 1, 2]); - - expect(replay.lineStringReplay_.vertices_).to.have.length(24); - expect(replay.lineStringReplay_.vertices_).to.eql([ - 1000, 2000, 0, 1, 0, 0.4, - 1200, 2000, 0, 1, 0, 0.4, - 1200, 2000, 0, 1, 0, 0.4, - 1200, 3000, 0, 1, 0, 0.4 - ]); + expect(replay.vertices).to.eql([ + 1200, 3000, 1200, 2000, 1000, 2000]); + expect(replay.indices).to.eql([2, 0, 1]); var polygon2 = new ol.geom.Polygon( [[[4000, 2000], [4200, 2000], [4200, 3000]]] ); - replay.drawPolygonGeometry(polygon2, null); - expect(replay.vertices_).to.have.length(36); - expect(replay.indices_).to.have.length(6); + replay.drawPolygon(polygon2, null); + expect(replay.vertices).to.have.length(12); + expect(replay.indices).to.have.length(6); - expect(replay.vertices_).to.eql([ - 1200, 2000, 0, 0, 1, 0.5, - 1200, 3000, 0, 0, 1, 0.5, - 1000, 2000, 0, 0, 1, 0.5, - 4200, 2000, 0, 0, 1, 0.5, - 4200, 3000, 0, 0, 1, 0.5, - 4000, 2000, 0, 0, 1, 0.5 + expect(replay.vertices).to.eql([ + 1200, 3000, 1200, 2000, 1000, 2000, + 4200, 3000, 4200, 2000, 4000, 2000 ]); - expect(replay.indices_).to.eql([0, 1, 2, 3, 4, 5]); + expect(replay.indices).to.eql([2, 0, 1, 5, 3, 4]); }); }); - describe('#drawMultiPolygonGeometry', function() { + describe('#drawMultiPolygon', function() { beforeEach(function() { replay.setFillStrokeStyle(fillStyle, strokeStyle); }); @@ -453,19 +439,15 @@ describe('ol.render.webgl.PolygonReplay', function() { [[[1000, 2000], [1200, 2000], [1200, 3000]]], [[[4000, 2000], [4200, 2000], [4200, 3000]]] ]); - replay.drawMultiPolygonGeometry(multiPolygon, null); - expect(replay.vertices_).to.have.length(36); - expect(replay.indices_).to.have.length(6); + replay.drawMultiPolygon(multiPolygon, null); + expect(replay.vertices).to.have.length(12); + expect(replay.indices).to.have.length(6); - expect(replay.vertices_).to.eql([ - 1200, 2000, 0, 0, 1, 0.5, - 1200, 3000, 0, 0, 1, 0.5, - 1000, 2000, 0, 0, 1, 0.5, - 4200, 2000, 0, 0, 1, 0.5, - 4200, 3000, 0, 0, 1, 0.5, - 4000, 2000, 0, 0, 1, 0.5 + expect(replay.vertices).to.eql([ + 1200, 3000, 1200, 2000, 1000, 2000, + 4200, 3000, 4200, 2000, 4000, 2000 ]); - expect(replay.indices_).to.eql([0, 1, 2, 3, 4, 5]); + expect(replay.indices).to.eql([2, 0, 1, 5, 3, 4]); }); }); }); diff --git a/test_rendering/spec/ol/style/expected/polygon-fill-and-strokes-webgl.png b/test_rendering/spec/ol/style/expected/polygon-fill-and-strokes-webgl.png new file mode 100644 index 0000000000..da2f9000f4 Binary files /dev/null and b/test_rendering/spec/ol/style/expected/polygon-fill-and-strokes-webgl.png differ diff --git a/test_rendering/spec/ol/style/expected/polygon-types-webgl-stroke.png b/test_rendering/spec/ol/style/expected/polygon-types-webgl-stroke.png new file mode 100644 index 0000000000..624f096158 Binary files /dev/null and b/test_rendering/spec/ol/style/expected/polygon-types-webgl-stroke.png differ diff --git a/test_rendering/spec/ol/style/expected/polygon-types-webgl.png b/test_rendering/spec/ol/style/expected/polygon-types-webgl.png new file mode 100644 index 0000000000..4abfccb058 Binary files /dev/null and b/test_rendering/spec/ol/style/expected/polygon-types-webgl.png differ diff --git a/test_rendering/spec/ol/style/expected/polygon-zindex-webgl.png b/test_rendering/spec/ol/style/expected/polygon-zindex-webgl.png new file mode 100644 index 0000000000..931df4a072 Binary files /dev/null and b/test_rendering/spec/ol/style/expected/polygon-zindex-webgl.png differ diff --git a/test_rendering/spec/ol/style/polygon.test.js b/test_rendering/spec/ol/style/polygon.test.js index 21fd39e093..59748f865b 100644 --- a/test_rendering/spec/ol/style/polygon.test.js +++ b/test_rendering/spec/ol/style/polygon.test.js @@ -86,11 +86,18 @@ describe('ol.rendering.style.Polygon', function() { } it('tests the canvas renderer', function(done) { - map = createMap('canvas'); + map = createMap('webgl'); createFeatures(); expectResemble(map, 'spec/ol/style/expected/polygon-types-canvas.png', IMAGE_TOLERANCE, done); }); + + it('tests the webgl renderer', function(done) { + map = createMap('webgl'); + createFeatures(); + expectResemble(map, 'spec/ol/style/expected/polygon-types-webgl.png', + IMAGE_TOLERANCE, done); + }); }); describe('different types with stroke', function() { @@ -153,6 +160,14 @@ describe('ol.rendering.style.Polygon', function() { expectResemble(map, 'spec/ol/style/expected/polygon-types-canvas-stroke.png', IMAGE_TOLERANCE, done); }); + + it('tests the webgl renderer', function(done) { + map = createMap('webgl', 100); + map.getView().setResolution(0.5); + createFeatures(); + expectResemble(map, 'spec/ol/style/expected/polygon-types-webgl-stroke.png', + IMAGE_TOLERANCE, done); + }); }); describe('z-index', function() { @@ -206,6 +221,13 @@ describe('ol.rendering.style.Polygon', function() { expectResemble(map, 'spec/ol/style/expected/polygon-zindex-canvas.png', IMAGE_TOLERANCE, done); }); + + it('tests the webgl renderer', function(done) { + map = createMap('webgl'); + createFeatures(); + expectResemble(map, 'spec/ol/style/expected/polygon-zindex-webgl.png', + IMAGE_TOLERANCE, done); + }); }); describe('different fills and strokes', function() { @@ -259,6 +281,14 @@ describe('ol.rendering.style.Polygon', function() { map, 'spec/ol/style/expected/polygon-fill-and-strokes-canvas.png', IMAGE_TOLERANCE, done); }); + + it('tests the webgl renderer', function(done) { + map = createMap('webgl'); + createFeatures(); + expectResemble( + map, 'spec/ol/style/expected/polygon-fill-and-strokes-webgl.png', + 5.76, done); + }); }); describe('CanvasPattern and LinearGradient as fills and strokes', function() {