Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loose TransitionManager test criteria #755

Merged
merged 1 commit into from
Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/src/utils/transition-manager.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ const TEST_CASES_EVENTS = [

function compareFunc(func1, func2, step){
for(let i = 0; i <= 1; i += step){
if(!equals(func1(i), func2(i))) return false;
if(!equals(func1(i), func2(i), 1e-7)) return false;
}
return true;
}
Expand All @@ -292,7 +292,7 @@ test('TransitionManager#TRANSITION_EVENTS', t => {
// testing duration
const testDuration = mode === TRANSITION_EVENTS.UPDATE ?
testCase.input[ti].transitionDuration - (time[1] - time[0]) : testCase.input[ti].transitionDuration;
t.is(equals(transitionManager.state.duration, testDuration), testCase.shouldChange[mode].transitionDuration, 'transitionDuration match');
t.is(equals(transitionManager.state.duration, testDuration, 1e-7), testCase.shouldChange[mode].transitionDuration, 'transitionDuration match');

// testing easing function
let testEasingFunc = testCase.input[ti].transitionEasing;
Expand Down
4 changes: 2 additions & 2 deletions test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ export function isSameLocation(lngLat1, lngLat2) {
return ((lng1 - lng2) % 360) === 0 && lat1 === lat2;
}

export function equals(a, b) {
return Math.abs(a - b) < EPSILON;
export function equals(a, b, epsilon = EPSILON) {
return Math.abs(a - b) < epsilon;
}