Replace floating point angle by Angle class instance

This commit is contained in:
Lynix
2018-10-09 23:20:53 +02:00
parent f02f206aff
commit dc6fbfc90f
17 changed files with 87 additions and 90 deletions

View File

@@ -82,29 +82,29 @@ SCENARIO("RenderSystem", "[NDK][RenderSystem]")
WHEN("We set an angular velocity")
{
float angularSpeed = Nz::FromDegrees(90.f);
Nz::RadianAnglef angularSpeed(Nz::DegreeToRadian(90.f));
physicsComponent2D.SetAngularVelocity(angularSpeed);
world.Update(1.f);
THEN("We expect those to be true")
{
CHECK(physicsComponent2D.GetAngularVelocity() == Approx(angularSpeed));
CHECK(physicsComponent2D.GetRotation() == Approx(angularSpeed));
CHECK(physicsComponent2D.GetAngularVelocity() == angularSpeed);
CHECK(physicsComponent2D.GetRotation() == angularSpeed);
CHECK(physicsComponent2D.GetAABB() == Nz::Rectf(1.f, 4.f, 2.f, 1.f));
CompareAABB(physicsComponent2D.GetAABB(), graphicsComponent.GetAABB());
world.Update(1.f);
CHECK(physicsComponent2D.GetRotation() == Approx(2.f * angularSpeed));
CHECK(physicsComponent2D.GetRotation() == 2.f * angularSpeed);
CHECK(physicsComponent2D.GetAABB() == Nz::Rectf(2.f, 2.f, 1.f, 2.f));
CompareAABB(physicsComponent2D.GetAABB(), graphicsComponent.GetAABB());
world.Update(1.f);
CHECK(physicsComponent2D.GetRotation() == Approx(3.f * angularSpeed));
CHECK(physicsComponent2D.GetRotation() == 3.f * angularSpeed);
CHECK(physicsComponent2D.GetAABB() == Nz::Rectf(3.f, 3.f, 2.f, 1.f));
CompareAABB(physicsComponent2D.GetAABB(), graphicsComponent.GetAABB());
world.Update(1.f);
CHECK(physicsComponent2D.GetRotation() == Approx(4.f * angularSpeed));
CHECK(physicsComponent2D.GetRotation() == 4.f * angularSpeed);
}
}
}