chore: snapshot editor work and restore tests
Key points:\n- restore the tests tree removed by bc47e6e\n- capture current editor workspace, scene, and docs reshuffle changes\n- keep local cloud.nvdb resources ignored from this commit
This commit is contained in:
60
tests/Components/test_component_factory_registry.cpp
Normal file
60
tests/Components/test_component_factory_registry.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <XCEngine/Components/AudioListenerComponent.h>
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
#include <XCEngine/Components/BoxColliderComponent.h>
|
||||
#include <XCEngine/Components/CameraComponent.h>
|
||||
#include <XCEngine/Components/CapsuleColliderComponent.h>
|
||||
#include <XCEngine/Components/ComponentFactoryRegistry.h>
|
||||
#include <XCEngine/Components/GaussianSplatRendererComponent.h>
|
||||
#include <XCEngine/Components/GameObject.h>
|
||||
#include <XCEngine/Components/LightComponent.h>
|
||||
#include <XCEngine/Components/MeshFilterComponent.h>
|
||||
#include <XCEngine/Components/MeshRendererComponent.h>
|
||||
#include <XCEngine/Components/RigidbodyComponent.h>
|
||||
#include <XCEngine/Components/SphereColliderComponent.h>
|
||||
#include <XCEngine/Components/VolumeRendererComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(ComponentFactoryRegistry_Test, BuiltInTypesAreRegistered) {
|
||||
auto& registry = ComponentFactoryRegistry::Get();
|
||||
|
||||
EXPECT_TRUE(registry.IsRegistered("Camera"));
|
||||
EXPECT_TRUE(registry.IsRegistered("Light"));
|
||||
EXPECT_TRUE(registry.IsRegistered("AudioSource"));
|
||||
EXPECT_TRUE(registry.IsRegistered("AudioListener"));
|
||||
EXPECT_TRUE(registry.IsRegistered("Rigidbody"));
|
||||
EXPECT_TRUE(registry.IsRegistered("BoxCollider"));
|
||||
EXPECT_TRUE(registry.IsRegistered("SphereCollider"));
|
||||
EXPECT_TRUE(registry.IsRegistered("CapsuleCollider"));
|
||||
EXPECT_TRUE(registry.IsRegistered("MeshFilter"));
|
||||
EXPECT_TRUE(registry.IsRegistered("MeshRenderer"));
|
||||
EXPECT_TRUE(registry.IsRegistered("GaussianSplatRenderer"));
|
||||
EXPECT_TRUE(registry.IsRegistered("VolumeRenderer"));
|
||||
EXPECT_FALSE(registry.IsRegistered("Transform"));
|
||||
EXPECT_FALSE(registry.IsRegistered("MissingComponent"));
|
||||
}
|
||||
|
||||
TEST(ComponentFactoryRegistry_Test, CreateBuiltInComponentsByTypeName) {
|
||||
GameObject gameObject("FactoryTarget");
|
||||
auto& registry = ComponentFactoryRegistry::Get();
|
||||
|
||||
EXPECT_NE(dynamic_cast<CameraComponent*>(registry.CreateComponent(&gameObject, "Camera")), nullptr);
|
||||
EXPECT_NE(dynamic_cast<LightComponent*>(registry.CreateComponent(&gameObject, "Light")), nullptr);
|
||||
EXPECT_NE(dynamic_cast<AudioSourceComponent*>(registry.CreateComponent(&gameObject, "AudioSource")), nullptr);
|
||||
EXPECT_NE(dynamic_cast<AudioListenerComponent*>(registry.CreateComponent(&gameObject, "AudioListener")), nullptr);
|
||||
EXPECT_NE(dynamic_cast<RigidbodyComponent*>(registry.CreateComponent(&gameObject, "Rigidbody")), nullptr);
|
||||
EXPECT_NE(dynamic_cast<BoxColliderComponent*>(registry.CreateComponent(&gameObject, "BoxCollider")), nullptr);
|
||||
EXPECT_NE(dynamic_cast<SphereColliderComponent*>(registry.CreateComponent(&gameObject, "SphereCollider")), nullptr);
|
||||
EXPECT_NE(dynamic_cast<CapsuleColliderComponent*>(registry.CreateComponent(&gameObject, "CapsuleCollider")), nullptr);
|
||||
EXPECT_NE(dynamic_cast<MeshFilterComponent*>(registry.CreateComponent(&gameObject, "MeshFilter")), nullptr);
|
||||
EXPECT_NE(dynamic_cast<MeshRendererComponent*>(registry.CreateComponent(&gameObject, "MeshRenderer")), nullptr);
|
||||
EXPECT_NE(dynamic_cast<GaussianSplatRendererComponent*>(registry.CreateComponent(&gameObject, "GaussianSplatRenderer")), nullptr);
|
||||
EXPECT_NE(dynamic_cast<VolumeRendererComponent*>(registry.CreateComponent(&gameObject, "VolumeRenderer")), nullptr);
|
||||
EXPECT_EQ(registry.CreateComponent(&gameObject, "MissingComponent"), nullptr);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user