From 0b677b12d959e6320dc560edd093603ac7fbc55b Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Sat, 23 Nov 2024 22:26:06 +0100 Subject: added particle test --- src/test/Profiling.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/test/Profiling.cpp b/src/test/Profiling.cpp index d7a4f2e..5cc70a4 100644 --- a/src/test/Profiling.cpp +++ b/src/test/Profiling.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -121,7 +122,7 @@ TEST_F(Profiling, Profiling_example) { EXPECT_GE(game_object_count, min_gameobject_count); } -TEST_F(Profiling, Profiling_small_object_no_collision) { +TEST_F(Profiling, Profiling_small_object) { int game_object_count = 0; long long total_time = 0; while (total_time < 16000) { @@ -140,7 +141,49 @@ TEST_F(Profiling, Profiling_small_object_no_collision) { make_shared("/home/jaro/crepe/asset/texture/green_square.png"), color, FlipSettings{true, true}); } - + + render_sys.update(); + game_object_count++; + total_time = run_all_systems(); + if(game_object_count >= max_gameobject_count) break; + } + log_timings(total_time,game_object_count); + EXPECT_GE(game_object_count, min_gameobject_count); +} + +TEST_F(Profiling, Profiling_small_object_Particle_emitter) { + int game_object_count = 0; + long long total_time = 0; + while (total_time < 16000) { + + { + //define gameobject used for testing + GameObject gameobject = mgr.new_object("gameobject","",{static_cast(game_object_count*2),0}); + gameobject.add_component(Rigidbody::Data{ + .body_type = Rigidbody::BodyType::STATIC, + .use_gravity = false, + }); + gameobject.add_component(vec2{0, 0}, 1, 1); + gameobject.add_component().set_script(); + Color color(0, 0, 0, 0); + gameobject.add_component( + make_shared("/home/jaro/crepe/asset/texture/green_square.png"), color, + FlipSettings{true, true}); + Sprite & test_sprite = gameobject.add_component( + make_shared("/home/jaro/crepe/asset/texture/img.png"), color, FlipSettings{false, false}); + auto & test = gameobject.add_component(ParticleEmitter::Data{ + .max_particles = 100, + .emission_rate = 100, + .end_lifespan = 100000, + .boundary{ + .width = 1000, + .height = 1000, + .offset = vec2{0, 0}, + .reset_on_exit = false, + }, + .sprite = test_sprite, + }); + } render_sys.update(); game_object_count++; total_time = run_all_systems(); -- cgit v1.2.3