Unit test fixes

This commit is contained in:
Jérôme Leclercq 2018-09-05 15:15:26 +02:00
parent 960af3afa3
commit 97cdb110ae
3 changed files with 5 additions and 6 deletions

View File

@ -126,7 +126,7 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]")
{
CHECK(body.GetAABB() == aabb);
CHECK(body.GetAngularVelocity() == Approx(0.f));
CHECK(body.GetCenterOfGravity() == Nz::Vector2f::Zero());
CHECK(body.GetMassCenter() == Nz::Vector2f::Zero());
CHECK(body.GetGeom() == box);
CHECK(body.GetMass() == Approx(mass));
CHECK(body.GetPosition() == position);
@ -150,7 +150,7 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]")
{
aabb.Translate(velocity);
CHECK(body.GetAABB() == aabb);
CHECK(body.GetCenterOfGravity() == Nz::Vector2f::Zero());
CHECK(body.GetMassCenter() == Nz::Vector2f::Zero());
CHECK(body.GetPosition() == position);
CHECK(body.GetVelocity() == velocity);
}

View File

@ -38,7 +38,7 @@ SCENARIO("PhysicsSystem2D", "[NDK][PHYSICSSYSTEM2D]")
WHEN("We make it collide with a wall")
{
int rawDistance = 3;
Nz::Vector2f distance(rawDistance, 0.f);
Nz::Vector2f distance(float(rawDistance), 0.f);
Nz::Vector2f wallPosition = position + Nz::Vector2f(movingAABB.width, 0.f) + distance;
Nz::Rectf wallAABB(0.f, 0.f, 100.f, 100.f);
Ndk::EntityHandle wallEntity = CreateBaseEntity(world, wallPosition, wallAABB);

View File

@ -6,7 +6,7 @@
#include <Nazara/Graphics/Sprite.hpp>
#include <Catch/catch.hpp>
void CompareAABB(const Nz::Rectf& aabb, const Nz::BoundingVolumef& boundingVolume);
void CompareAABB(const Nz::Rectf& aabb, const Nz::Boxf& box);
SCENARIO("RenderSystem", "[NDK][RenderSystem]")
{
@ -110,9 +110,8 @@ SCENARIO("RenderSystem", "[NDK][RenderSystem]")
}
}
void CompareAABB(const Nz::Rectf& aabb, const Nz::BoundingVolumef& boundingVolume)
void CompareAABB(const Nz::Rectf& aabb, const Nz::Boxf& box)
{
Nz::Boxf box = boundingVolume.aabb;
CHECK(aabb.x == Approx(box.x));
CHECK(aabb.y == Approx(box.y));
CHECK(aabb.width == Approx(box.width));