From 373c5b3b1308f33d1dedb8d846ddf43dbc6bacf3 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 19 Jan 2018 12:11:10 -0500 Subject: [PATCH 1/7] Bump regl-scatter2d --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 23deeb034f4..b9a3b7e56f2 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "regl": "^1.3.1", "regl-error2d": "^2.0.3", "regl-line2d": "^2.1.0", - "regl-scatter2d": "^2.1.9", + "regl-scatter2d": "^2.1.10", "right-now": "^1.0.0", "robust-orientation": "^1.1.3", "sane-topojson": "^2.0.0", From c28f498155dcb4934eb6c0e7f44389aac59127ea Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 19 Jan 2018 12:11:10 -0500 Subject: [PATCH 2/7] Bump regl-scatter2d --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 23deeb034f4..b9a3b7e56f2 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "regl": "^1.3.1", "regl-error2d": "^2.0.3", "regl-line2d": "^2.1.0", - "regl-scatter2d": "^2.1.9", + "regl-scatter2d": "^2.1.10", "right-now": "^1.0.0", "robust-orientation": "^1.1.3", "sane-topojson": "^2.0.0", From 022e7e18c7ae72c4564218527d28956bffe34c99 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 22 Jan 2018 11:43:28 -0500 Subject: [PATCH 3/7] Bump deps --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b9a3b7e56f2..c86a7ca3062 100644 --- a/package.json +++ b/package.json @@ -98,8 +98,8 @@ "polybooljs": "^1.2.0", "regl": "^1.3.1", "regl-error2d": "^2.0.3", - "regl-line2d": "^2.1.0", - "regl-scatter2d": "^2.1.10", + "regl-line2d": "^2.1.2", + "regl-scatter2d": "^2.1.11", "right-now": "^1.0.0", "robust-orientation": "^1.1.3", "sane-topojson": "^2.0.0", From 348d4d09a2766152730e8242b6ff9abbc94cdfef Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 22 Jan 2018 12:27:14 -0500 Subject: [PATCH 4/7] Add big points selection test --- test/jasmine/tests/gl_plot_interact_test.js | 52 ++++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/test/jasmine/tests/gl_plot_interact_test.js b/test/jasmine/tests/gl_plot_interact_test.js index 099200dd0e9..15f03a3320b 100644 --- a/test/jasmine/tests/gl_plot_interact_test.js +++ b/test/jasmine/tests/gl_plot_interact_test.js @@ -1446,7 +1446,7 @@ describe('Test gl2d plots', function() { var mock = require('@mocks/gl2d_10.json'); beforeEach(function() { - jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; gd = createGraphDiv(); }); @@ -1462,6 +1462,26 @@ describe('Test gl2d plots', function() { return drag(node, dx, dy, null, p0[0], p0[1]); } + function select(path) { + return new Promise(function(resolve) { + gd.once('plotly_selected', resolve); + + var len = path.length; + + // do selection + Lib.clearThrottle(); + mouseEvent('mousemove', path[0][0], path[0][1]); + mouseEvent('mousedown', path[0][0], path[0][1]); + + path.slice(1, len).forEach(function(pt) { + Lib.clearThrottle(); + mouseEvent('mousemove', pt[0], pt[1]); + }); + + mouseEvent('mouseup', path[len - 1][0], path[len - 1][1]); + }); + } + it('should respond to drag interactions', function(done) { var _mock = Lib.extendDeep({}, mock); @@ -1562,7 +1582,7 @@ describe('Test gl2d plots', function() { .then(done); }); - it('@noCI should be able to toggle visibility', function(done) { + it('should be able to toggle visibility', function(done) { var _mock = Lib.extendDeep({}, mock); Plotly.plot(gd, _mock) @@ -1592,6 +1612,34 @@ describe('Test gl2d plots', function() { .then(done); }); + it('should display selection of big number of points', function(done) { + // generate large number of points + var x = [], y = []; + for(var i = 0; i < 2e4; i++) { + x.push(Math.random()); + y.push(Math.random()); + } + + var mock = { + data: [{ + x: x, y: y, type: 'scattergl', mode: 'markers' + }], + layout: { + dragmode: 'select' + } + }; + + Plotly.plot(gd, mock) + .then(select([[160, 100], [180, 100]])) + .then(function() { + expect(readPixel(gd.querySelector('.gl-canvas-context'), 168, 100)[3]).toBe(0); + expect(readPixel(gd.querySelector('.gl-canvas-context'), 158, 100)[3]).not.toBe(0); + expect(readPixel(gd.querySelector('.gl-canvas-focus'), 168, 100)[3]).not.toBe(0); + }) + .catch(fail) + .then(done); + }); + it('should be able to toggle from svg to gl', function(done) { Plotly.plot(gd, [{ y: [1, 2, 1], From 8692ec989d9adc301c5919ba83956305c193f32c Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 22 Jan 2018 12:28:31 -0500 Subject: [PATCH 5/7] Reduce timeout interval --- test/jasmine/tests/gl_plot_interact_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jasmine/tests/gl_plot_interact_test.js b/test/jasmine/tests/gl_plot_interact_test.js index 15f03a3320b..be98c3c4541 100644 --- a/test/jasmine/tests/gl_plot_interact_test.js +++ b/test/jasmine/tests/gl_plot_interact_test.js @@ -1446,7 +1446,7 @@ describe('Test gl2d plots', function() { var mock = require('@mocks/gl2d_10.json'); beforeEach(function() { - jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 3000; gd = createGraphDiv(); }); From 39be2566e73838cf0001ef4059adeba68fee8a14 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 22 Jan 2018 12:51:57 -0500 Subject: [PATCH 6/7] Avoid randomity in test --- test/jasmine/tests/gl_plot_interact_test.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/jasmine/tests/gl_plot_interact_test.js b/test/jasmine/tests/gl_plot_interact_test.js index be98c3c4541..86a8af4f0d9 100644 --- a/test/jasmine/tests/gl_plot_interact_test.js +++ b/test/jasmine/tests/gl_plot_interact_test.js @@ -1612,12 +1612,12 @@ describe('Test gl2d plots', function() { .then(done); }); - it('should display selection of big number of points', function(done) { + fit('should display selection of big number of points', function(done) { // generate large number of points - var x = [], y = []; - for(var i = 0; i < 2e4; i++) { - x.push(Math.random()); - y.push(Math.random()); + var x = [], y = [], n = 2e2, N = n * n; + for(var i = 0; i < N; i++) { + x.push((i % n) / n); + y.push(i / N); } var mock = { @@ -1630,7 +1630,9 @@ describe('Test gl2d plots', function() { }; Plotly.plot(gd, mock) + .then(delay(1000)) .then(select([[160, 100], [180, 100]])) + .then(delay(1000)) .then(function() { expect(readPixel(gd.querySelector('.gl-canvas-context'), 168, 100)[3]).toBe(0); expect(readPixel(gd.querySelector('.gl-canvas-context'), 158, 100)[3]).not.toBe(0); From 22112f9aa37e06958ad5f81defd821eb4c79623c Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 22 Jan 2018 12:53:26 -0500 Subject: [PATCH 7/7] Unsingle test --- test/jasmine/tests/gl_plot_interact_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jasmine/tests/gl_plot_interact_test.js b/test/jasmine/tests/gl_plot_interact_test.js index 86a8af4f0d9..51fec4f6546 100644 --- a/test/jasmine/tests/gl_plot_interact_test.js +++ b/test/jasmine/tests/gl_plot_interact_test.js @@ -1612,7 +1612,7 @@ describe('Test gl2d plots', function() { .then(done); }); - fit('should display selection of big number of points', function(done) { + it('should display selection of big number of points', function(done) { // generate large number of points var x = [], y = [], n = 2e2, N = n * n; for(var i = 0; i < N; i++) {