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

Add integration tests for transitions #3912

Closed
lucaswoj opened this issue Jan 10, 2017 · 1 comment
Closed

Add integration tests for transitions #3912

lucaswoj opened this issue Jan 10, 2017 · 1 comment
Assignees

Comments

@lucaswoj
Copy link
Contributor

Migrated from mapbox/mapbox-gl-test-suite#168

Per mapbox/mapbox-gl-style-spec#171, let's add tests for transition properties. Sticking point is somehow taking a screenshot after a certain elapsed time: @lucaswoj pointed me to a wait operation that waits til rendering is complete, but it doesn't support a duration argument yet.

  • extend wait to include a duration parameter in gl-js
  • add tests with durations to test transitions

Migrated from mapbox/mapbox-gl-test-suite#116

We should to figure out how to add tests for property transitions, in order to prevent bugs like:

A prerequisite for this is that the test harness has control over the clock used for rendering transitions, so it can deterministically render, say, 50% of the way through a transition. Then we could add that percentage as a parameter somewhere in the test case metadata.

gl-js internals which use Date.now() directly that need to be converted to using a passed in parameter:

var t = Math.min((Date.now() - zh.lastIntegerZoomTime) / duration, 1);

var t = globalProperties.time || Date.now();

newTransition.loopID = animationLoop.set(newTransition.endTime - Date.now());

var now = Date.now();

if (Math.floor(zh.lastZoom) < Math.floor(z)) {
zh.lastIntegerZoom = Math.floor(z);
zh.lastIntegerZoomTime = Date.now();
} else if (Math.floor(zh.lastZoom) > Math.floor(z)) {
zh.lastIntegerZoom = Math.floor(z + 1);
zh.lastIntegerZoomTime = Date.now();
}

Migrator's note: sinon has some built-in utilities for mocking out the system clock http://sinonjs.org/docs/#clock

@anandthakker
Copy link
Contributor

Another issue to add test for once we've made it possible in the harness: #2467

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants