UFO: Alien Invasion
test_particles.cpp
Go to the documentation of this file.
1
6/*
7Copyright (C) 2002-2022 UFO: Alien Invasion.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23*/
24
25#include "test_shared.h"
26#include "../client/client.h"
27#include "../client/cl_lua.h"
28#include "../client/battlescape/cl_particle.h"
29#include "../client/renderer/r_state.h"
30#include "../client/ui/ui_main.h"
31
32class ParticleTest: public ::testing::Test {
33protected:
34 static void SetUpTestCase() {
35 TEST_Init();
37 vid_imagePool = Mem_CreatePool("Vid: Image system");
38
39 cl_genericPool = Mem_CreatePool("Client: Generic");
40
42 R_FontInit();
43 CL_InitLua();
44 UI_Init();
45
46 OBJZERO(cls);
47 Com_ParseScripts(false);
48 }
49
50 static void TearDownTestCase() {
52 }
53};
54
55TEST_F(ParticleTest, FloodParticles)
56{
57 for (int i = 0; i < MAX_PTLS; i++) {
58 ASSERT_TRUE(nullptr != CL_ParticleSpawn("fire", 0xFF, vec3_origin));
59 }
61 ASSERT_TRUE(nullptr == CL_ParticleSpawn("fire", 0xFF, vec3_origin));
62}
63
64TEST_F(ParticleTest, NeededParticles)
65{
66 ASSERT_TRUE(nullptr != CL_ParticleGet("fadeTracer"));
67 ASSERT_TRUE(nullptr != CL_ParticleGet("longRangeTracer"));
68 ASSERT_TRUE(nullptr != CL_ParticleGet("inRangeTracer"));
69 ASSERT_TRUE(nullptr != CL_ParticleGet("crawlTracer"));
70 ASSERT_TRUE(nullptr != CL_ParticleGet("moveTracer"));
71 ASSERT_TRUE(nullptr != CL_ParticleGet("stunnedactor"));
72 ASSERT_TRUE(nullptr != CL_ParticleGet("circle"));
73 ASSERT_TRUE(nullptr != CL_ParticleGet("cross"));
74 ASSERT_TRUE(nullptr != CL_ParticleGet("cross_no"));
75 ASSERT_TRUE(nullptr != CL_ParticleGet("lightTracerDebug"));
76}
void CL_InitLua(void)
Initializes the ui-lua interfacing environment.
Definition: cl_lua.cpp:126
memPool_t * vid_imagePool
Definition: cl_main.cpp:88
client_static_t cls
Definition: cl_main.cpp:83
memPool_t * cl_genericPool
Definition: cl_main.cpp:86
void PTL_InitStartup(void)
Clears particle data.
ptlDef_t * CL_ParticleGet(const char *name)
ptl_t * CL_ParticleSpawn(const char *name, int levelFlags, const vec3_t s, const vec3_t v, const vec3_t a)
Spawn a new particle to the map.
void CL_ParticleRun(void)
General system for particle running during the game.
void R_FontInit(void)
Definition: r_font.cpp:722
#define MAX_PTLS
Definition: cl_renderer.h:44
static void SetUpTestCase()
static void TearDownTestCase()
const vec3_t vec3_origin
Definition: mathlib.cpp:35
#define Mem_CreatePool(name)
Definition: mem.h:32
QGL_EXTERN GLint i
Definition: r_gl.h:113
rstate_t r_state
Definition: r_main.cpp:48
void Com_ParseScripts(bool onlyServer)
Definition: scripts.cpp:3619
#define OBJZERO(obj)
Definition: shared.h:178
gltexunit_t * active_texunit
Definition: r_state.h:117
gltexunit_t texunits[MAX_GL_TEXUNITS]
Definition: r_state.h:114
TEST_F(ParticleTest, FloodParticles)
void TEST_Shutdown(void)
Definition: test_shared.cpp:34
void TEST_Init(void)
Definition: test_shared.cpp:72
void UI_Init(void)
Definition: ui_main.cpp:278