SDK: Fix unit tests
This commit is contained in:
parent
c1e9fe7b04
commit
c06db7d9c5
|
|
@ -38,7 +38,7 @@ SCENARIO("BaseSystem", "[NDK][BASESYSTEM]")
|
|||
|
||||
WHEN("We add an entity")
|
||||
{
|
||||
const Ndk::EntityHandle& entity = world.CreateEntity();
|
||||
Ndk::EntityHandle entity = world.CreateEntity();
|
||||
entity->AddComponent<Ndk::VelocityComponent>();
|
||||
|
||||
THEN("System should have it")
|
||||
|
|
@ -50,7 +50,7 @@ SCENARIO("BaseSystem", "[NDK][BASESYSTEM]")
|
|||
|
||||
WHEN("We add an entity with excluded component")
|
||||
{
|
||||
const Ndk::EntityHandle& entity = world.CreateEntity();
|
||||
Ndk::EntityHandle entity = world.CreateEntity();
|
||||
entity->AddComponent<Ndk::VelocityComponent>();
|
||||
entity->AddComponent<Ndk::NodeComponent>();
|
||||
|
||||
|
|
|
|||
|
|
@ -57,18 +57,18 @@ SCENARIO("Entity", "[NDK][ENTITY]")
|
|||
{
|
||||
Ndk::World world;
|
||||
Ndk::BaseSystem& system = world.AddSystem<UpdateSystem>();
|
||||
const Ndk::EntityHandle& entity = world.CreateEntity();
|
||||
Ndk::EntityHandle entity = world.CreateEntity();
|
||||
|
||||
WHEN("We add our UpdateComponent")
|
||||
{
|
||||
UpdatableComponent& updatableComponent = entity->AddComponent<UpdatableComponent>();
|
||||
REQUIRE(!updatableComponent.IsUpdated());
|
||||
CHECK(!updatableComponent.IsUpdated());
|
||||
|
||||
THEN("Update the world should update the entity's component")
|
||||
{
|
||||
world.Update(1.f);
|
||||
UpdatableComponent& updatableComponentGet = entity->GetComponent<UpdatableComponent>();
|
||||
REQUIRE(updatableComponentGet.IsUpdated());
|
||||
CHECK(updatableComponentGet.IsUpdated());
|
||||
}
|
||||
|
||||
THEN("Update the world should not update the entity's component if it's disabled")
|
||||
|
|
@ -76,14 +76,14 @@ SCENARIO("Entity", "[NDK][ENTITY]")
|
|||
entity->Enable(false);
|
||||
world.Update(1.f);
|
||||
UpdatableComponent& updatableComponentGet = entity->GetComponent<UpdatableComponent>();
|
||||
REQUIRE(!updatableComponentGet.IsUpdated());
|
||||
CHECK(!updatableComponentGet.IsUpdated());
|
||||
}
|
||||
|
||||
THEN("We can remove its component")
|
||||
{
|
||||
entity->RemoveComponent(Ndk::GetComponentIndex<UpdatableComponent>());
|
||||
world.Update(1.f);
|
||||
REQUIRE(!entity->HasComponent<UpdatableComponent>());
|
||||
CHECK(!entity->HasComponent<UpdatableComponent>());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ SCENARIO("Entity", "[NDK][ENTITY]")
|
|||
|
||||
THEN("It's no more valid")
|
||||
{
|
||||
REQUIRE(!world.IsEntityValid(entity));
|
||||
CHECK(!world.IsEntityValid(entity));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ SCENARIO("EntityOwner", "[NDK][ENTITYOWNER]")
|
|||
GIVEN("A world & an entity")
|
||||
{
|
||||
Ndk::World world;
|
||||
const Ndk::EntityHandle& entity = world.CreateEntity();
|
||||
Ndk::EntityHandle entity = world.CreateEntity();
|
||||
|
||||
WHEN("We set the ownership of the entity to our owner")
|
||||
{
|
||||
|
|
@ -15,14 +15,14 @@ SCENARIO("EntityOwner", "[NDK][ENTITYOWNER]")
|
|||
|
||||
THEN("Entity is still valid")
|
||||
{
|
||||
REQUIRE(entity.IsValid());
|
||||
CHECK(entity.IsValid());
|
||||
}
|
||||
|
||||
THEN("Resetting or getting out of scope is no more valid")
|
||||
{
|
||||
entityOwner.Reset();
|
||||
world.Update(1.f);
|
||||
REQUIRE(!entity.IsValid());
|
||||
CHECK(!entity.IsValid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ SCENARIO("World", "[NDK][WORLD]")
|
|||
AND_WHEN("We update our world with our entity")
|
||||
{
|
||||
REQUIRE(&world.GetSystem(UpdateSystem::systemIndex) == &world.GetSystem<UpdateSystem>());
|
||||
const Ndk::EntityHandle& entity = world.CreateEntity();
|
||||
Ndk::EntityHandle entity = world.CreateEntity();
|
||||
UpdatableComponent& component = entity->AddComponent<UpdatableComponent>();
|
||||
|
||||
THEN("Our entity component must be updated")
|
||||
|
|
|
|||
Loading…
Reference in New Issue