Skip to content

Commit 7eeacb1

Browse files
committed
Add selection test
1 parent 7ec83a0 commit 7eeacb1

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

test/jasmine/tests/gl2d_plot_interact_test.js

+41-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ describe('Test gl2d plots', function() {
378378
.then(done);
379379
});
380380

381-
it('@noCI should display selection of big number of points', function(done) {
381+
it('@noCI should display selection of big number of regular points', function(done) {
382382
// generate large number of points
383383
var x = [], y = [], n = 2e2, N = n * n;
384384
for(var i = 0; i < N; i++) {
@@ -406,6 +406,46 @@ describe('Test gl2d plots', function() {
406406
.then(done);
407407
});
408408

409+
410+
it('@noCI should display selection of big number of miscellaneous points', function(done) {
411+
var colorList = [
412+
'#006385', '#F06E75', '#90ed7d', '#f7a35c', '#8085e9',
413+
'#f15c80', '#e4d354', '#2b908f', '#f45b5b', '#91e8e1',
414+
'#5DA5DA', '#F06E75', '#F15854', '#B2912F', '#B276B2',
415+
'#DECF3F', '#FAA43A', '#4D4D4D', '#F17CB0', '#60BD68'
416+
];
417+
418+
// generate large number of points
419+
var x = [], y = [], n = 2e2, N = n * n, color = [], symbol = [], size = [];
420+
for(var i = 0; i < N; i++) {
421+
x.push((i % n) / n);
422+
y.push(i / N);
423+
color.push(colorList[i % colorList.length]);
424+
symbol.push('x');
425+
size.push(6);
426+
}
427+
428+
var mock = {
429+
data: [{
430+
x: x, y: y, type: 'scattergl', mode: 'markers',
431+
marker: {symbol: symbol, size: size, color: color}
432+
}],
433+
layout: {
434+
dragmode: 'select'
435+
}
436+
};
437+
438+
Plotly.plot(gd, mock)
439+
.then(select([[160, 100], [180, 100]]))
440+
.then(function() {
441+
expect(readPixel(gd.querySelector('.gl-canvas-context'), 168, 100)[3]).toBe(0);
442+
expect(readPixel(gd.querySelector('.gl-canvas-context'), 158, 100)[3]).not.toBe(0);
443+
expect(readPixel(gd.querySelector('.gl-canvas-focus'), 168, 100)[3]).not.toBe(0);
444+
})
445+
.catch(fail)
446+
.then(done);
447+
});
448+
409449
it('should be able to toggle from svg to gl', function(done) {
410450
Plotly.plot(gd, [{
411451
y: [1, 2, 1],

0 commit comments

Comments
 (0)