Fix unit tests
This commit is contained in:
parent
45af15d802
commit
9bfcd02730
|
|
@ -1,6 +1,7 @@
|
|||
#include <Nazara/Physics2D/RigidBody2D.hpp>
|
||||
#include <Nazara/Physics2D/PhysWorld2D.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
#include <limits>
|
||||
|
||||
Nz::RigidBody2D CreateBody(Nz::PhysWorld2D& world);
|
||||
void EQUALITY(const Nz::RigidBody2D& left, const Nz::RigidBody2D& right);
|
||||
|
|
@ -11,6 +12,7 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]")
|
|||
GIVEN("A physic world and a rigid body")
|
||||
{
|
||||
Nz::PhysWorld2D world;
|
||||
world.SetMaxStepCount(std::numeric_limits<std::size_t>::max());
|
||||
|
||||
Nz::Vector2f positionAABB(3.f, 4.f);
|
||||
Nz::Rectf aabb(positionAABB.x, positionAABB.y, 1.f, 2.f);
|
||||
|
|
@ -82,6 +84,8 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]")
|
|||
GIVEN("A physic world")
|
||||
{
|
||||
Nz::PhysWorld2D world;
|
||||
world.SetMaxStepCount(std::numeric_limits<std::size_t>::max());
|
||||
|
||||
Nz::Rectf aabb(3.f, 4.f, 1.f, 2.f);
|
||||
|
||||
WHEN("We get a rigid body from a function")
|
||||
|
|
@ -102,6 +106,8 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]")
|
|||
GIVEN("A physic world and a rigid body")
|
||||
{
|
||||
Nz::PhysWorld2D world;
|
||||
world.SetMaxStepCount(std::numeric_limits<std::size_t>::max());
|
||||
|
||||
Nz::Vector2f positionAABB(3.f, 4.f);
|
||||
Nz::Rectf aabb(positionAABB.x, positionAABB.y, 1.f, 2.f);
|
||||
Nz::Collider2DRef box = Nz::BoxCollider2D::New(aabb);
|
||||
|
|
@ -200,6 +206,7 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]")
|
|||
GIVEN("A physic world and a rigid body of circle")
|
||||
{
|
||||
Nz::PhysWorld2D world;
|
||||
world.SetMaxStepCount(std::numeric_limits<std::size_t>::max());
|
||||
|
||||
Nz::Vector2f position(3.f, 4.f);
|
||||
float radius = 5.f;
|
||||
|
|
@ -221,6 +228,7 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]")
|
|||
GIVEN("A physic world and a rigid body of compound")
|
||||
{
|
||||
Nz::PhysWorld2D world;
|
||||
world.SetMaxStepCount(std::numeric_limits<std::size_t>::max());
|
||||
|
||||
Nz::Rectf aabb(0.f, 0.f, 1.f, 1.f);
|
||||
Nz::BoxCollider2DRef box1 = Nz::BoxCollider2D::New(aabb);
|
||||
|
|
@ -249,6 +257,7 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]")
|
|||
GIVEN("A physic world and a rigid body of circle")
|
||||
{
|
||||
Nz::PhysWorld2D world;
|
||||
world.SetMaxStepCount(std::numeric_limits<std::size_t>::max());
|
||||
|
||||
std::vector<Nz::Vector2f> vertices;
|
||||
vertices.push_back(Nz::Vector2f(0.f, 0.f));
|
||||
|
|
@ -275,6 +284,7 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]")
|
|||
GIVEN("A physic world and a rigid body of segment")
|
||||
{
|
||||
Nz::PhysWorld2D world;
|
||||
world.SetMaxStepCount(std::numeric_limits<std::size_t>::max());
|
||||
|
||||
Nz::Vector2f positionA(3.f, 4.f);
|
||||
Nz::Vector2f positionB(1.f, -4.f);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <NDK/Components/NodeComponent.hpp>
|
||||
#include <NDK/Components/PhysicsComponent2D.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
#include <limits>
|
||||
|
||||
Ndk::EntityHandle CreateBaseEntity(Ndk::World& world, const Nz::Vector2f& position, const Nz::Rectf AABB);
|
||||
|
||||
|
|
@ -20,7 +21,8 @@ SCENARIO("PhysicsSystem2D", "[NDK][PHYSICSSYSTEM2D]")
|
|||
Ndk::PhysicsComponent2D& physicsComponent2D = movingEntity->AddComponent<Ndk::PhysicsComponent2D>();
|
||||
|
||||
world.GetSystem<Ndk::PhysicsSystem2D>().SetMaximumUpdateRate(0.f);
|
||||
|
||||
world.GetSystem<Ndk::PhysicsSystem2D>().GetWorld().SetMaxStepCount(std::numeric_limits<std::size_t>::max());
|
||||
|
||||
WHEN("We update the world")
|
||||
{
|
||||
world.Update(1.f);
|
||||
|
|
|
|||
Loading…
Reference in New Issue