From 8e8098b3621c4d904a8241d88a754cafdb1c4c33 Mon Sep 17 00:00:00 2001 From: GaborFarkas Date: Wed, 5 Oct 2016 18:34:54 +0200 Subject: [PATCH] Add some test to PolygonReplay --- test/spec/ol/render/webgl/replay.test.js | 62 +++++++----------- .../polygon-fill-and-strokes-webgl.png | Bin 0 -> 458 bytes .../expected/polygon-types-webgl-stroke.png | Bin 0 -> 780 bytes .../ol/style/expected/polygon-types-webgl.png | Bin 0 -> 276 bytes .../style/expected/polygon-zindex-webgl.png | Bin 0 -> 300 bytes test_rendering/spec/ol/style/polygon.test.js | 32 ++++++++- 6 files changed, 53 insertions(+), 41 deletions(-) create mode 100644 test_rendering/spec/ol/style/expected/polygon-fill-and-strokes-webgl.png create mode 100644 test_rendering/spec/ol/style/expected/polygon-types-webgl-stroke.png create mode 100644 test_rendering/spec/ol/style/expected/polygon-types-webgl.png create mode 100644 test_rendering/spec/ol/style/expected/polygon-zindex-webgl.png 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 0000000000000000000000000000000000000000..da2f9000f4ab0a470201e5c6d6b6ec8024ebe752 GIT binary patch literal 458 zcmV;*0X6=KP)>%% zQXyPw*LEUgz07y-{NCNWIN>akheyJLfrxD{dnN=q z7w+{s^TLWm!o`ivL6*hrzLdtv(E=uuSopJ9RZPmEkZ|> zn6=q4S{N-|0eA!+3FwQTP#7(Y7Dj8i0`Let0*}BWngV}*v*Q{c&@WiOQLf*B6XFf! z^*hMBdO!dtA_42S3T6DK+UjXMih+oSc#Wif1ATM9LW;T0ivR!s07*qoM6N<$f+ao7 A!T-z=CDS_zx_|=l|A9B zy=vop+Ryast@0~b8M$@e1c{c4k5BJ!Klv|Qj``<~Dx-ZL-97k!>83yuBO$?h43r_Mi znZd8<*l_b9$4ND*Gwl-;4!kL7NfG9KHd$O~&i$8%FPFbst}eyWfRJ$Z5J)JqaN5+# z_E}Md!@&BE?h~^O-`%IZQCeH`r}(1Mm72d>oW#y)&HbcZ|H}H#+v+~1kQNj3q?-ko zodg1(J(*V#d}g9<3kRp8+u9!0-M_brD{{P4R50U`Z4xkKN_u)hkwZ{fAM2rkNcJ?EpcuCzeGlnBU4GijHh3x#fIa<(tUe{mRKK&zVohe_QqfCpVLi)k9k(U zo?ay~+E!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