From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- .../ParticleSystem/ParticleSystemRendererTests.cpp | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Runtime/Graphics/ParticleSystem/ParticleSystemRendererTests.cpp (limited to 'Runtime/Graphics/ParticleSystem/ParticleSystemRendererTests.cpp') diff --git a/Runtime/Graphics/ParticleSystem/ParticleSystemRendererTests.cpp b/Runtime/Graphics/ParticleSystem/ParticleSystemRendererTests.cpp new file mode 100644 index 0000000..47db7ee --- /dev/null +++ b/Runtime/Graphics/ParticleSystem/ParticleSystemRendererTests.cpp @@ -0,0 +1,29 @@ +#include "UnityPrefix.h" + +#if ENABLE_UNIT_TESTS + +#include "External/UnitTest++/src/UnitTest++.h" +#include "Runtime/Graphics/ParticleSystem/ParticleSystemRenderer.h" +#include "Runtime/Filters/Mesh/LodMesh.h" +#include "Runtime/Testing/TestFixtures.h" + + +SUITE (ParticleSystemRendererTests) +{ + typedef ObjectTestFixture Fixture; + + TEST_FIXTURE (Fixture, DeletingMeshClearsOutCachedMeshPointers) + { + // Arrange. + PPtr mesh (NEW_OBJECT_RESET_AND_AWAKE (Mesh)); + m_ObjectUnderTest->SetMesh (mesh); + + // Act. + DestroySingleObject (mesh); + + // Assert. + CHECK (m_ObjectUnderTest->GetData().cachedMesh[0] == NULL); + } +} + +#endif -- cgit v1.1-26-g67d0