feat(physics): add runtime physics scaffolding
This commit is contained in:
37
tests/Physics/test_physics_world.cpp
Normal file
37
tests/Physics/test_physics_world.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user