Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b33607a

Browse files
committed
Change precision and delay time for gl_plot_interact test
1 parent fe89b6d commit b33607a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

test/jasmine/tests/gl_plot_interact_test.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var Lib = require('@src/lib');
77
var createGraphDiv = require('../assets/create_graph_div');
88
var destroyGraphDiv = require('../assets/destroy_graph_div');
99
var selectButton = require('../assets/modebar_button');
10+
var customMatchers = require('../assets/custom_matchers');
1011

1112
/*
1213
* WebGL interaction test cases fail on the CircleCI
@@ -18,6 +19,10 @@ var selectButton = require('../assets/modebar_button');
1819
describe('Test plot structure', function() {
1920
'use strict';
2021

22+
beforeEach(function() {
23+
jasmine.addMatchers(customMatchers);
24+
});
25+
2126
afterEach(destroyGraphDiv);
2227

2328
describe('gl3d plots', function() {
@@ -148,7 +153,7 @@ describe('Test plot structure', function() {
148153

149154
describe('buttons resetCameraDefault3d and resetCameraLastSave3d', function() {
150155
// changes in scene objects are not instantaneous
151-
var DELAY = 1000;
156+
var DELAY = 200;
152157

153158
it('should update the scene camera', function(done) {
154159
var sceneLayout = gd._fullLayout.scene,
@@ -166,22 +171,22 @@ describe('Test plot structure', function() {
166171
expect(sceneLayout.camera.eye)
167172
.toEqual({x: 0.1, y: 0.1, z: 1}, 'does not change the layout objects');
168173
expect(scene.camera.eye)
169-
.toEqual([1.2500000000000002, 1.25, 1.25]);
174+
.toBeCloseToArray([1.25, 1.25, 1.25], 4);
170175
expect(sceneLayout2.camera.eye)
171176
.toEqual({x: 2.5, y: 2.5, z: 2.5}, 'does not change the layout objects');
172177
expect(scene2.camera.eye)
173-
.toEqual([1.2500000000000002, 1.25, 1.25]);
178+
.toBeCloseToArray([1.25, 1.25, 1.25], 4);
174179

175180
selectButton(modeBar, 'resetCameraLastSave3d').click();
176181
setTimeout(function() {
177182
expect(sceneLayout.camera.eye)
178183
.toEqual({x: 0.1, y: 0.1, z: 1}, 'does not change the layout objects');
179184
expect(scene.camera.eye)
180-
.toEqual([ 0.10000000000000016, 0.10000000000000016, 1]);
185+
.toBeCloseToArray([ 0.1, 0.1, 1], 4);
181186
expect(sceneLayout2.camera.eye)
182187
.toEqual({x: 2.5, y: 2.5, z: 2.5}, 'does not change the layout objects');
183188
expect(scene2.camera.eye)
184-
.toEqual([2.500000000000001, 2.5000000000000004, 2.5000000000000004]);
189+
.toBeCloseToArray([2.5, 2.5, 2.5], 4);
185190

186191
done();
187192
}, DELAY);

0 commit comments

Comments
 (0)