General bug fixes (#142)
* Core/Bitset: Fix TestAll method * Fix documentation * Fix color and their conversions * Core/ByteStream: Fix return of Write * Fix compiler warnings * Math/Algorithm: Fix angle normalization * Math/BoundingVolume: Fix lerp * Math: Fix relation between Matrix4 and Quaternion * More tests * X11/Window: Fix mouse moved event generated when doing Mouse::SetPosition * Update ChangeLog * Should fix compilation on Windows * Should fix compilation on Windows Forgot to include array for Windows
This commit is contained in:
committed by
Jérôme Leclercq
parent
f2506ee918
commit
f991a9529e
@@ -6,24 +6,43 @@ SCENARIO("Clock", "[CORE][CLOCK]")
|
||||
{
|
||||
GIVEN("A clock paused")
|
||||
{
|
||||
Nz::UInt64 initialTime = 1;
|
||||
Nz::UInt64 initialTime = 100;
|
||||
Nz::Clock clock(initialTime, true);
|
||||
|
||||
WHEN("We get time")
|
||||
WHEN("We get time since it is paused")
|
||||
{
|
||||
THEN("Time must be the initialTime")
|
||||
{
|
||||
REQUIRE(clock.GetMicroseconds() == initialTime);
|
||||
CHECK(clock.GetMicroseconds() == initialTime);
|
||||
CHECK(clock.IsPaused());
|
||||
}
|
||||
}
|
||||
|
||||
AND_WHEN("We unpause it")
|
||||
WHEN("We unpause it")
|
||||
{
|
||||
clock.Unpause();
|
||||
REQUIRE(!clock.IsPaused());
|
||||
|
||||
THEN("Time must not be the initialTime")
|
||||
{
|
||||
clock.Unpause();
|
||||
THEN("Time must not be the initialTime")
|
||||
{
|
||||
Nz::Thread::Sleep(1);
|
||||
REQUIRE(clock.GetMicroseconds() != initialTime);
|
||||
}
|
||||
Nz::Thread::Sleep(1);
|
||||
Nz::UInt64 microSeconds = clock.GetMicroseconds();
|
||||
CHECK(microSeconds != initialTime);
|
||||
CHECK(microSeconds / 1000 <= clock.GetMilliseconds());
|
||||
CHECK(microSeconds / (1000.f * 1000.f) <= clock.GetSeconds());
|
||||
}
|
||||
}
|
||||
|
||||
WHEN("We restart it")
|
||||
{
|
||||
clock.Restart();
|
||||
|
||||
THEN("It is unpaused and we can pause it")
|
||||
{
|
||||
CHECK(!clock.IsPaused());
|
||||
clock.Pause();
|
||||
CHECK(clock.IsPaused());
|
||||
CHECK(clock.GetMicroseconds() != initialTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user