Skip to content

Commit 7decb53

Browse files
committed
test colorbar floating point fix
1 parent a79198a commit 7decb53

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/jasmine/tests/colorbar_test.js

+27
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
var Plotly = require('@lib/index');
12
var Colorbar = require('@src/components/colorbar');
3+
var createGraphDiv = require('../assets/create_graph_div');
4+
var destroyGraphDiv = require('../assets/destroy_graph_div');
25

36

47
describe('Test colorbar:', function() {
@@ -29,4 +32,28 @@ describe('Test colorbar:', function() {
2932
expect(hasColorbar(trace.marker.line)).toBe(false);
3033
});
3134
});
35+
36+
describe('floating point limits', function() {
37+
var gd;
38+
39+
beforeEach(function() {
40+
gd = createGraphDiv();
41+
});
42+
43+
afterEach(destroyGraphDiv);
44+
45+
it('does not lock up on tiny fractional ranges', function(done) {
46+
var z = [
47+
[9607345622458638.0, 9607345622458652.0, 9607345622458652.0, 9607345622458646.0, 9607345622458652.0, 9607345622458650.0, 9607345622458650.0, 9607345622458646.0],
48+
[9607345622458654.0, 9607345622458640.0, 9607345622458650.0, 9607345622458652.0, 9607345622458652.0, 9607345622458654.0, 9607345622458650.0, 9607345622458652.0],
49+
[9607345622458654.0, 9607345622458652.0, 9607345622458638.0, 9607345622458652.0, 9607345622458650.0, 9607345622458652.0, 9607345622458654.0, 9607345622458650.0],
50+
[9607345622458650.0, 9607345622458652.0, 9607345622458650.0, 9607345622458632.0, 9607345622458644.0, 9607345622458646.0, 9607345622458646.0, 9607345622458650.0],
51+
[9607345622458654.0, 9607345622458652.0, 9607345622458650.0, 9607345622458650.0, 9607345622458638.0, 9607345622458654.0, 9607345622458654.0, 9607345622458650.0],
52+
[9607345622458650.0, 9607345622458654.0, 9607345622458650.0, 9607345622458646.0, 9607345622458652.0, 9607345622458638.0, 9607345622458646.0, 9607345622458652.0],
53+
[9607345622458654.0, 9607345622458652.0, 9607345622458654.0, 9607345622458650.0, 9607345622458654.0, 9607345622458652.0, 9607345622458640.0, 9607345622458654.0],
54+
[9607345622458650.0, 9607345622458652.0, 9607345622458650.0, 9607345622458652.0, 9607345622458650.0, 9607345622458654.0, 9607345622458654.0, 9607345622458638.0]
55+
];
56+
Plotly.newPlot(gd, [{type: 'heatmap', z: z}]).then(done);
57+
});
58+
});
3259
});

0 commit comments

Comments
 (0)