From 21ce74e0bc5be62cb56a3e6d0a492ce8d1409c16 Mon Sep 17 00:00:00 2001 From: etienne Date: Tue, 20 Feb 2018 18:10:35 -0500 Subject: [PATCH] add px-average test scattergl marker.color - this locks down commit: https://github.com/dfcreative/regl-scatter2d/commit/6138fd79dffa79b35151e849cc6b4fffa40d1b29 --- test/jasmine/tests/gl2d_plot_interact_test.js | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/test/jasmine/tests/gl2d_plot_interact_test.js b/test/jasmine/tests/gl2d_plot_interact_test.js index c61277671e2..b4e58628610 100644 --- a/test/jasmine/tests/gl2d_plot_interact_test.js +++ b/test/jasmine/tests/gl2d_plot_interact_test.js @@ -789,4 +789,47 @@ describe('@gl Test gl2d plots', function() { .catch(fail) .then(done); }); + + it('should be able to draw more than 4096 colors', function(done) { + var gd = createGraphDiv(); + var x = []; + var color = []; + var N = 1e5; + var w = 500; + var h = 500; + + for(var i = 0; i < N; i++) { + x.push(i); + color.push(Math.random()); + } + + Plotly.newPlot(gd, [{ + type: 'scattergl', + mode: 'markers', + x: x, + y: color, + marker: { + color: color, + colorscale: [ + [0, 'rgb(255, 0, 0)'], + [0.5, 'rgb(0, 255, 0)'], + [1.0, 'rgb(0, 0, 255)'] + ] + } + }], { + width: w, + height: h, + margin: {l: 0, t: 0, b: 0, r: 0} + }) + .then(function() { + var total = readPixel(gd.querySelector('.gl-canvas-context'), 0, 0, w, h) + .reduce(function(acc, v) { return acc + v; }, 0); + + // the total value was 3762487 before PR + // https://github.com/plotly/plotly.js/pull/2377 + expect(total).toBeGreaterThan(3e6); + }) + .catch(fail) + .then(done); + }); });