engine/particle/src/test/test_particle.cpp
/**
 * Verify loop emitters don't end
 */
Verify loop emitters don't end
Verify loop emitters don ' t end
TEST_F(ParticleTest, Loop)
{
    const uint32_t loop_count = 4;
    float dt = 1.0f;
    ASSERT_TRUE(LoadPrototype("loop.particlefxc", &m_Prototype));
    dmParticle::HInstance instance = dmParticle::CreateInstance(m_Context, m_Prototype, 0x0);
    ASSERT_TRUE(dmParticle::IsSleeping(m_Context, instance));
    dmParticle::Emitter* e = GetEmitter(m_Context, instance, 0);
    dmParticle::StartInstance(m_Context, instance);
    ASSERT_FALSE(dmParticle::IsSleeping(m_Context, instance));
    for (uint32_t i = 0; i < loop_count; ++i)
    {
        dmParticle::Update(m_Context, dt, 0x0);
        ASSERT_EQ(1u, ParticleCount(e));
    }
    ASSERT_FALSE(dmParticle::IsSleeping(m_Context, instance));
    dmParticle::StopInstance(m_Context, instance);
    dmParticle::Update(m_Context, dt, 0x0);
    ASSERT_EQ(0u, ParticleCount(e));
    dmParticle::DestroyInstance(m_Context, instance);
}
TEST_F ( ParticleTest , Loop ) { const uint32_t loop_count = 4 ; float dt = 1.0f ; ASSERT_TRUE ( LoadPrototype ( " " , & m_Prototype ) ) ; dmParticle :: HInstance instance = dmParticle :: CreateInstance ( m_Context , m_Prototype , 0x0 ) ; ASSERT_TRUE ( dmParticle :: IsSleeping ( m_Context , instance ) ) ; dmParticle :: Emitter * e = GetEmitter ( m_Context , instance , 0 ) ; dmParticle :: StartInstance ( m_Context , instance ) ; ASSERT_FALSE ( dmParticle :: IsSleeping ( m_Context , instance ) ) ; for ( uint32_t i = 0 ; i < loop_count ; ++ i ) { dmParticle :: Update ( m_Context , dt , 0x0 ) ; ASSERT_EQ ( 1u , ParticleCount ( e ) ) ; } ASSERT_FALSE ( dmParticle :: IsSleeping ( m_Context , instance ) ) ; dmParticle :: StopInstance ( m_Context , instance ) ; dmParticle :: Update ( m_Context , dt , 0x0 ) ; ASSERT_EQ ( 0u , ParticleCount ( e ) ) ; dmParticle :: DestroyInstance ( m_Context , instance ) ; }
Verify loop emitters don't end
Verify loop emitters don ' t end