aboutsummaryrefslogtreecommitdiff
path: root/src/test/ParticleTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ParticleTest.cpp')
-rw-r--r--src/test/ParticleTest.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/test/ParticleTest.cpp b/src/test/ParticleTest.cpp
index 6fe3133..1a89e3a 100644
--- a/src/test/ParticleTest.cpp
+++ b/src/test/ParticleTest.cpp
@@ -16,15 +16,16 @@ using namespace std::chrono_literals;
using namespace crepe;
class ParticlesTest : public ::testing::Test {
-protected:
- ParticleSystem particle_system;
+public:
+ ComponentManager component_manager;
+ ParticleSystem particle_system{component_manager};
+
void SetUp() override {
- ComponentManager & mgr = ComponentManager::get_instance();
+ ComponentManager & mgr = this->component_manager;
std::vector<std::reference_wrapper<Transform>> transforms
= mgr.get_components_by_id<Transform>(0);
if (transforms.empty()) {
-
- GameObject game_object(0, "", "", Vector2{0, 0}, 0, 0);
+ GameObject game_object = mgr.new_object("", "", Vector2{0, 0}, 0, 0);
Color color(0, 0, 0, 0);
Sprite test_sprite = game_object.add_component<Sprite>(
@@ -77,7 +78,7 @@ protected:
TEST_F(ParticlesTest, spawnParticle) {
Config::get_instance().physics.gravity = 1;
- ComponentManager & mgr = ComponentManager::get_instance();
+ ComponentManager & mgr = this->component_manager;
ParticleEmitter & emitter
= mgr.get_components_by_id<ParticleEmitter>(0).front().get();
emitter.data.end_lifespan = 5;
@@ -122,7 +123,7 @@ TEST_F(ParticlesTest, spawnParticle) {
TEST_F(ParticlesTest, moveParticleHorizontal) {
Config::get_instance().physics.gravity = 1;
- ComponentManager & mgr = ComponentManager::get_instance();
+ ComponentManager & mgr = this->component_manager;
ParticleEmitter & emitter
= mgr.get_components_by_id<ParticleEmitter>(0).front().get();
emitter.data.end_lifespan = 100;
@@ -140,7 +141,7 @@ TEST_F(ParticlesTest, moveParticleHorizontal) {
TEST_F(ParticlesTest, moveParticleVertical) {
Config::get_instance().physics.gravity = 1;
- ComponentManager & mgr = ComponentManager::get_instance();
+ ComponentManager & mgr = this->component_manager;
ParticleEmitter & emitter
= mgr.get_components_by_id<ParticleEmitter>(0).front().get();
emitter.data.end_lifespan = 100;
@@ -159,7 +160,7 @@ TEST_F(ParticlesTest, moveParticleVertical) {
TEST_F(ParticlesTest, boundaryParticleReset) {
Config::get_instance().physics.gravity = 1;
- ComponentManager & mgr = ComponentManager::get_instance();
+ ComponentManager & mgr = this->component_manager;
ParticleEmitter & emitter
= mgr.get_components_by_id<ParticleEmitter>(0).front().get();
emitter.data.end_lifespan = 100;
@@ -179,7 +180,7 @@ TEST_F(ParticlesTest, boundaryParticleReset) {
TEST_F(ParticlesTest, boundaryParticleStop) {
Config::get_instance().physics.gravity = 1;
- ComponentManager & mgr = ComponentManager::get_instance();
+ ComponentManager & mgr = this->component_manager;
ParticleEmitter & emitter
= mgr.get_components_by_id<ParticleEmitter>(0).front().get();
emitter.data.end_lifespan = 100;