From 68f7ea611af5b9a4c19375ab3d4a351facdea9a9 Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Fri, 13 Dec 2024 18:37:48 +0100 Subject: updated test --- src/test/ParticleTest.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'src/test/ParticleTest.cpp') diff --git a/src/test/ParticleTest.cpp b/src/test/ParticleTest.cpp index 70534f3..a9a26c6 100644 --- a/src/test/ParticleTest.cpp +++ b/src/test/ParticleTest.cpp @@ -1,18 +1,19 @@ #include "api/Asset.h" -#include +#include +#include #include #include -#include #include #include #include #include -#include -#include -#include - +#include #define protected public #define private public +#include +#include +#include + using namespace std; using namespace std::chrono_literals; @@ -25,6 +26,7 @@ class ParticlesTest : public ::testing::Test { public: ComponentManager component_manager{m}; ParticleSystem particle_system{m}; + LoopTimerManager loop_timer{m}; void SetUp() override { ComponentManager & mgr = this->component_manager; @@ -42,7 +44,7 @@ public: .size = {10, 10}, }); - game_object.add_component(ParticleEmitter::Data{ + game_object.add_component(test_sprite,ParticleEmitter::Data{ .position = {0, 0}, .max_particles = 100, .emission_rate = 0, @@ -59,7 +61,6 @@ public: .offset = vec2{0, 0}, .reset_on_exit = false, }, - .sprite = test_sprite, }); } @@ -101,7 +102,7 @@ TEST_F(ParticlesTest, spawnParticle) { particle_system.update(); //check if nothing happend EXPECT_EQ(emitter.particles[0].active, false); - emitter.data.emission_rate = 1; + emitter.data.emission_rate = 50; //check particle spawnes particle_system.update(); EXPECT_EQ(emitter.particles[0].active, true); @@ -138,10 +139,10 @@ TEST_F(ParticlesTest, moveParticleHorizontal) { emitter.data.end_lifespan = 100; emitter.data.boundary.height = 100; emitter.data.boundary.width = 100; - emitter.data.min_speed = 1; - emitter.data.max_speed = 1; + emitter.data.min_speed = 50; + emitter.data.max_speed = 50; emitter.data.max_angle = 0; - emitter.data.emission_rate = 1; + emitter.data.emission_rate = 50; for (int a = 1; a < emitter.data.boundary.width / 2; a++) { particle_system.update(); EXPECT_EQ(emitter.particles[0].position.x, a); @@ -155,11 +156,11 @@ TEST_F(ParticlesTest, moveParticleVertical) { emitter.data.end_lifespan = 100; emitter.data.boundary.height = 100; emitter.data.boundary.width = 100; - emitter.data.min_speed = 1; - emitter.data.max_speed = 1; + emitter.data.min_speed = 50; + emitter.data.max_speed = 50; emitter.data.min_angle = 90; emitter.data.max_angle = 90; - emitter.data.emission_rate = 1; + emitter.data.emission_rate = 50; for (int a = 1; a < emitter.data.boundary.width / 2; a++) { particle_system.update(); EXPECT_EQ(emitter.particles[0].position.y, a); -- cgit v1.2.3