UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
test_particles.cpp
Go to the documentation of this file.
1 
6 /*
7 Copyright (C) 2002-2020 UFO: Alien Invasion.
8 
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 
18 See the GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, 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 
32 class ParticleTest: public ::testing::Test {
33 protected:
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() {
51  TEST_Shutdown();
52  }
53 };
54 
55 TEST_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 
64 TEST_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 UI_Init(void)
Definition: ui_main.cpp:278
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.
const vec3_t vec3_origin
Definition: mathlib.cpp:35
void Com_ParseScripts(bool onlyServer)
Definition: scripts.cpp:3641
gltexunit_t texunits[MAX_GL_TEXUNITS]
Definition: r_state.h:114
memPool_t * cl_genericPool
Definition: cl_main.cpp:86
client_static_t cls
Definition: cl_main.cpp:83
#define MAX_PTLS
Definition: cl_renderer.h:44
gltexunit_t * active_texunit
Definition: r_state.h:117
#define OBJZERO(obj)
Definition: shared.h:178
void TEST_Shutdown(void)
Definition: test_shared.cpp:34
void CL_InitLua(void)
Initializes the ui-lua interfacing environment.
Definition: cl_lua.cpp:126
TEST_F(ParticleTest, FloodParticles)
static void TearDownTestCase()
#define Mem_CreatePool(name)
Definition: mem.h:32
ptlDef_t * CL_ParticleGet(const char *name)
QGL_EXTERN GLint i
Definition: r_gl.h:113
void TEST_Init(void)
Definition: test_shared.cpp:72
memPool_t * vid_imagePool
Definition: cl_main.cpp:88
rstate_t r_state
Definition: r_main.cpp:48
void PTL_InitStartup(void)
Clears particle data.
static void SetUpTestCase()
void CL_ParticleRun(void)
General system for particle running during the game.
void R_FontInit(void)
Definition: r_font.cpp:722