38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
#include <gtest/gtest.h>
|
|
|
|
#include <XCEngine/Physics/PhysicsWorld.h>
|
|
#include <XCEngine/Scene/Scene.h>
|
|
|
|
namespace {
|
|
|
|
TEST(PhysicsWorld_Test, DefaultWorldStartsUninitialized) {
|
|
XCEngine::Physics::PhysicsWorld world;
|
|
|
|
EXPECT_FALSE(world.IsInitialized());
|
|
}
|
|
|
|
TEST(PhysicsWorld_Test, InitializeStoresCreateInfoWithoutMarkingWorldReadyYet) {
|
|
XCEngine::Components::Scene scene("PhysicsScene");
|
|
XCEngine::Physics::PhysicsWorld world;
|
|
XCEngine::Physics::PhysicsWorldCreateInfo createInfo;
|
|
createInfo.scene = &scene;
|
|
createInfo.gravity = XCEngine::Math::Vector3(0.0f, -3.5f, 0.0f);
|
|
|
|
const bool expectedInitialized = XCEngine::Physics::PhysicsWorld::IsPhysXAvailable();
|
|
|
|
EXPECT_EQ(world.Initialize(createInfo), expectedInitialized);
|
|
EXPECT_EQ(world.IsInitialized(), expectedInitialized);
|
|
EXPECT_EQ(world.GetCreateInfo().scene, &scene);
|
|
EXPECT_EQ(world.GetCreateInfo().gravity, XCEngine::Math::Vector3(0.0f, -3.5f, 0.0f));
|
|
}
|
|
|
|
TEST(PhysicsWorld_Test, StepWithoutInitializationIsNoOp) {
|
|
XCEngine::Physics::PhysicsWorld world;
|
|
|
|
world.Step(0.016f);
|
|
|
|
EXPECT_FALSE(world.IsInitialized());
|
|
}
|
|
|
|
} // namespace
|