diff --git a/Tests/UntoldEngineRenderTests/RendererTest.swift b/Tests/UntoldEngineRenderTests/RendererTest.swift index 329a3863..de0203b4 100644 --- a/Tests/UntoldEngineRenderTests/RendererTest.swift +++ b/Tests/UntoldEngineRenderTests/RendererTest.swift @@ -331,6 +331,12 @@ final class RendererTests: XCTestCase { XCTAssertEqual(0, renderComponent.mesh.count, "Mesh should be empty") XCTAssertNil(skeletonComponent.skeleton, "Skeleton should be nil") XCTAssertNil(getMeshesForEntity(entityId: entityId), "Entity-Mesh map should be nil") + + // test if components have been removed + XCTAssertFalse(hasComponent(entityId: entityId, componentType: RenderComponent.self)) + XCTAssertFalse(hasComponent(entityId: entityId, componentType: LocalTransformComponent.self)) + XCTAssertFalse(hasComponent(entityId: entityId, componentType: WorldTransformComponent.self)) + XCTAssertFalse(hasComponent(entityId: entityId, componentType: SkeletonComponent.self)) } func testRemoveEntityAnimations() { @@ -350,6 +356,9 @@ final class RendererTests: XCTestCase { XCTAssertNil(animationComponent.currentAnimation, "Current Animation should be Nil") XCTAssertEqual(animationComponent.animationClips.count, 0, "animation clips should be 0") + + // test if component have been removed + XCTAssertFalse(hasComponent(entityId: entityId, componentType: AnimationComponent.self)) } func testRemoveEntityKinetics() { @@ -368,6 +377,10 @@ final class RendererTests: XCTestCase { removeEntityKinetics(entityId: entityId) XCTAssertEqual(kineticComponent.forces.count, 0, "All forces should be removed") + + // test if components have been removed + XCTAssertFalse(hasComponent(entityId: entityId, componentType: PhysicsComponents.self)) + XCTAssertFalse(hasComponent(entityId: entityId, componentType: KineticComponent.self)) } private func testGenerateRenderTarget(targetName: String, texture: MTLTexture, isDepthTexture: Bool = false) { diff --git a/Tests/UntoldEngineTests/ScenegraphTest.swift b/Tests/UntoldEngineTests/ScenegraphTest.swift index 17b6161d..1661f6da 100644 --- a/Tests/UntoldEngineTests/ScenegraphTest.swift +++ b/Tests/UntoldEngineTests/ScenegraphTest.swift @@ -164,23 +164,13 @@ final class SceneGraphTests: XCTestCase { setParent(childId: grandchildEntity, parentId: childEntity) setParent(childId: childEntity, parentId: rootEntity) - let childEntityIndex = getEntityIndex(childEntity) - let grandChildEntityIndex = getEntityIndex(grandchildEntity) - let parentScenegraph = scene.get(component: ScenegraphComponent.self, for: rootEntity) removeEntity(entityId: childEntity, containsResources: false) XCTAssertEqual(parentScenegraph?.children.count, 0, "Children count should be zero") - let componentId: Int = getComponentId(for: ScenegraphComponent.self) - - let childComponentMask = scene.entities[Int(childEntityIndex)].mask - - XCTAssertFalse(childComponentMask.test(componentId), "Component should be set to false for child") - - let grandChildComponentMask = scene.entities[Int(grandChildEntityIndex)].mask - - XCTAssertFalse(grandChildComponentMask.test(componentId), "Component should be set to false for grand child") + XCTAssertFalse(hasComponent(entityId: childEntity, componentType: ScenegraphComponent.self)) + XCTAssertFalse(hasComponent(entityId: grandchildEntity, componentType: ScenegraphComponent.self)) } }