From 3b64133f21393f98495ac4bfdc42284225c1f421 Mon Sep 17 00:00:00 2001 From: Thomas Chandelle Date: Mon, 14 Nov 2016 09:09:32 +0100 Subject: [PATCH] Add tests for linedash for HiDPI display --- test/spec/ol/renderer/canvas/replay.test.js | 19 +++++++++++++++++- .../linestring-strokes-canvas-hidpi.png | Bin 0 -> 928 bytes .../expected/linestring-strokes-canvas.png | Bin 787 -> 515 bytes .../spec/ol/style/linestring.test.js | 12 ++++++++++- 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 test_rendering/spec/ol/style/expected/linestring-strokes-canvas-hidpi.png diff --git a/test/spec/ol/renderer/canvas/replay.test.js b/test/spec/ol/renderer/canvas/replay.test.js index 68ee494d1c..da8a61ee52 100644 --- a/test/spec/ol/renderer/canvas/replay.test.js +++ b/test/spec/ol/renderer/canvas/replay.test.js @@ -34,7 +34,7 @@ describe('ol.render.canvas.ReplayGroup', function() { }); style2 = new ol.style.Style({ fill: new ol.style.Fill({color: 'white'}), - stroke: new ol.style.Stroke({color: 'black', width: 1}) + stroke: new ol.style.Stroke({color: 'black', width: 1, lineDash: [3, 6]}) }); fillCount = 0; strokeCount = 0; @@ -139,6 +139,23 @@ describe('ol.render.canvas.ReplayGroup', function() { expect(strokeCount).to.be(3); expect(beginPathCount).to.be(3); }); + + it('applies the pixelRatio to the linedash array', function() { + var lineDash, lineDashCount = 0; + + context.setLineDash = function(lineDash_) { + lineDashCount++; + lineDash = lineDash_.slice(); + }; + + ol.renderer.vector.renderFeature(replay, feature1, style2, 1); + ol.renderer.vector.renderFeature(replay, feature2, style2, 1); + replay.replay(context, 2, transform, 0, {}); + + expect(lineDashCount).to.be(1); + expect(style2.getStroke().getLineDash()).to.be.eql([3, 6]); + expect(lineDash).to.be.eql([6, 12]); + }); }); }); diff --git a/test_rendering/spec/ol/style/expected/linestring-strokes-canvas-hidpi.png b/test_rendering/spec/ol/style/expected/linestring-strokes-canvas-hidpi.png new file mode 100644 index 0000000000000000000000000000000000000000..600e4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