diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-11-23 22:26:06 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-11-23 22:26:06 +0100 |
commit | 0b677b12d959e6320dc560edd093603ac7fbc55b (patch) | |
tree | 6fbd599484f95177aea244f9f471e788a6f18088 /src/test | |
parent | 31e57c515519e53f25cf47c859dc19fef4fe533c (diff) |
added particle test
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/Profiling.cpp | 47 |
1 files changed, 45 insertions, 2 deletions
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 <crepe/api/Rigidbody.h> #include <crepe/api/Script.h> #include <crepe/api/Transform.h> +#include <crepe/api/ParticleEmitter.h> #include <crepe/system/CollisionSystem.h> #include <crepe/system/ScriptSystem.h> #include <crepe/types.h> @@ -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<Texture>("/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<float>(game_object_count*2),0}); + gameobject.add_component<Rigidbody>(Rigidbody::Data{ + .body_type = Rigidbody::BodyType::STATIC, + .use_gravity = false, + }); + gameobject.add_component<BoxCollider>(vec2{0, 0}, 1, 1); + gameobject.add_component<BehaviorScript>().set_script<TestScript>(); + Color color(0, 0, 0, 0); + gameobject.add_component<Sprite>( + make_shared<Texture>("/home/jaro/crepe/asset/texture/green_square.png"), color, + FlipSettings{true, true}); + Sprite & test_sprite = gameobject.add_component<Sprite>( + make_shared<Texture>("/home/jaro/crepe/asset/texture/img.png"), color, FlipSettings{false, false}); + auto & test = gameobject.add_component<ParticleEmitter>(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(); |