aboutsummaryrefslogtreecommitdiff
path: root/src/test/ParticleTest.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-22 12:32:22 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-22 12:32:22 +0100
commit61148c757a1f742ff09e40e5347e74e638c7371c (patch)
treea2e40998981fa6f12430d2a1254250219f30d44f /src/test/ParticleTest.cpp
parente2162171c7ab72f450f73a0908946aa4a4dee5ee (diff)
update clang-format optionsHEADmaster
Diffstat (limited to 'src/test/ParticleTest.cpp')
-rw-r--r--src/test/ParticleTest.cpp76
1 files changed, 42 insertions, 34 deletions
diff --git a/src/test/ParticleTest.cpp b/src/test/ParticleTest.cpp
index 7a731a3..eee7a73 100644
--- a/src/test/ParticleTest.cpp
+++ b/src/test/ParticleTest.cpp
@@ -22,45 +22,49 @@ class ParticlesTest : public ::testing::Test {
Mediator m;
public:
- ComponentManager component_manager{m};
- ParticleSystem particle_system{m};
- LoopTimerManager loop_timer{m};
+ ComponentManager component_manager {m};
+ ParticleSystem particle_system {m};
+ LoopTimerManager loop_timer {m};
void SetUp() override {
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 = mgr.new_object("", "", vec2{0, 0}, 0, 0);
+ GameObject game_object = mgr.new_object("", "", vec2 {0, 0}, 0, 0);
Color color(0, 0, 0, 0);
auto s1 = Asset("asset/texture/img.png");
Sprite & test_sprite = game_object.add_component<Sprite>(
- s1, Sprite::Data{
- .color = color,
- .flip = Sprite::FlipSettings{true, true},
- .size = {10, 10},
- });
+ s1,
+ Sprite::Data {
+ .color = color,
+ .flip = Sprite::FlipSettings {true, true},
+ .size = {10, 10},
+ }
+ );
- game_object.add_component<ParticleEmitter>(test_sprite,
- ParticleEmitter::Data{
- .offset = {0, 0},
- .max_particles = 100,
- .emission_rate = 0,
- .min_speed = 0,
- .max_speed = 0,
- .min_angle = 0,
- .max_angle = 0,
- .begin_lifespan = 0,
- .end_lifespan = 0,
- .force_over_time = vec2{0, 0},
- .boundary{
- .width = 0,
- .height = 0,
- .offset = vec2{0, 0},
- .reset_on_exit = false,
- },
- });
+ game_object.add_component<ParticleEmitter>(
+ test_sprite,
+ ParticleEmitter::Data {
+ .offset = {0, 0},
+ .max_particles = 100,
+ .emission_rate = 0,
+ .min_speed = 0,
+ .max_speed = 0,
+ .min_angle = 0,
+ .max_angle = 0,
+ .begin_lifespan = 0,
+ .end_lifespan = 0,
+ .force_over_time = vec2 {0, 0},
+ .boundary {
+ .width = 0,
+ .height = 0,
+ .offset = vec2 {0, 0},
+ .reset_on_exit = false,
+ },
+ }
+ );
}
transforms = mgr.get_components_by_id<Transform>(0);
Transform & transform = transforms.front().get();
@@ -78,8 +82,8 @@ public:
emitter.data.max_angle = 0;
emitter.data.begin_lifespan = 0;
emitter.data.end_lifespan = 0;
- emitter.data.force_over_time = vec2{0, 0};
- emitter.data.boundary = {0, 0, vec2{0, 0}, false};
+ emitter.data.force_over_time = vec2 {0, 0};
+ emitter.data.boundary = {0, 0, vec2 {0, 0}, false};
for (auto & particle : emitter.particles) {
particle.active = false;
}
@@ -204,9 +208,13 @@ TEST_F(ParticlesTest, boundaryParticleStop) {
EXPECT_NEAR(emitter.particles[0].velocity.x, 0, TOLERANCE);
EXPECT_NEAR(emitter.particles[0].velocity.y, 0, TOLERANCE);
if (emitter.particles[0].velocity.x != 0)
- EXPECT_NEAR(std::abs(emitter.particles[0].position.x),
- emitter.data.boundary.height / 2, TOLERANCE);
+ EXPECT_NEAR(
+ std::abs(emitter.particles[0].position.x), emitter.data.boundary.height / 2,
+ TOLERANCE
+ );
if (emitter.particles[0].velocity.y != 0)
- EXPECT_NEAR(std::abs(emitter.particles[0].position.y), emitter.data.boundary.width / 2,
- TOLERANCE);
+ EXPECT_NEAR(
+ std::abs(emitter.particles[0].position.y), emitter.data.boundary.width / 2,
+ TOLERANCE
+ );
}