bevy/crates/bevy_core
Martin Dickopp 93cee3b3c9 Make Time::update_with_instant public for use in tests (#4469)
# Objective

To test systems that implement frame rate-independent update logic, one needs to be able to mock `Time`. By mocking time, it's possible to write tests that confirm systems are frame rate-independent.

This is a follow-up PR to #2549 by @ostwilkens and based on his work.

## Solution

To mock `Time`, one needs to be able to manually update the Time resource with an `Instant` defined by the developer. This can be achieved by making the existing `Time::update_with_instant` method public for use in tests. 

## Changelog

- Make `Time::update_with_instant` public
- Add doc to `Time::update_with_instant` clarifying that the method should not be called outside of tests.
- Add doc test to `Time` demonstrating how to use `update_with_instant` in tests.


Co-authored-by: Martin Dickopp <martin@zero-based.org>
2022-04-24 23:15:27 +00:00
..
src Make Time::update_with_instant public for use in tests (#4469) 2022-04-24 23:15:27 +00:00
Cargo.toml Remove some unused dependencies (#4544) 2022-04-20 11:46:34 +00:00