feat: add "Add component" button
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
#include <destrum/ObjectModel/GameObject.h>
|
||||
#include <destrum/Scene/Scene.h>
|
||||
#include <destrum/Scene/SceneManager.h>
|
||||
#include <destrum/Serialization/ComponentFactory.h>
|
||||
#include <destrum/Serialization/ComponentRegistry.h>
|
||||
#include <destrum/Serialization/SceneSerializer.h>
|
||||
#include <destrum/Physics/SimplePhysicsWorld.h>
|
||||
#include <destrum/Physics/JoltPhysicsWorld.h>
|
||||
@@ -161,6 +163,32 @@ namespace {
|
||||
SceneManager::GetInstance().Destroy();
|
||||
}
|
||||
|
||||
void testEngineComponentRegistration()
|
||||
{
|
||||
RegisterEngineComponents();
|
||||
|
||||
const char* canonicalNames[] = {
|
||||
"MeshRendererComponent",
|
||||
"Rotator",
|
||||
"Spinner",
|
||||
"OrbitAndSpin",
|
||||
"Animator",
|
||||
"Rigidbody",
|
||||
"BoxCollider",
|
||||
"SphereCollider",
|
||||
"CapsuleCollider"
|
||||
};
|
||||
for (const char* name : canonicalNames) {
|
||||
check(ComponentFactory::IsRegistered(name),
|
||||
"all canonical engine component names must be registered");
|
||||
}
|
||||
|
||||
check(!ComponentFactory::IsRegistered("MeshRenderer"),
|
||||
"MeshRenderer legacy alias must not be registered");
|
||||
check(!ComponentFactory::IsRegistered("RigidBody"),
|
||||
"RigidBody legacy alias must not be registered");
|
||||
}
|
||||
|
||||
void testAssetPathValidation()
|
||||
{
|
||||
const auto root = std::filesystem::temp_directory_path() / "destrum_asset_test";
|
||||
@@ -440,6 +468,7 @@ int main()
|
||||
testEventMutation();
|
||||
testEventRemoval();
|
||||
testComponentRemoval();
|
||||
testEngineComponentRegistration();
|
||||
testAssetPathValidation();
|
||||
testLegacySceneLoad();
|
||||
testSceneLoadRollback();
|
||||
|
||||
Reference in New Issue
Block a user