Fission FSN
Loading...
Searching...
No Matches
gfCAutoTestManager.h
Go to the documentation of this file.
1/********************************************************************
2*
3* File: gfCAutoTestManager.h
4*
5* Purpose: Wrap up all the auto test code
6*
7*********************************************************************/
8
9#ifndef gfCAutoTestManagerhdr
10#define gfCAutoTestManagerhdr
11
12#include <functional>
13
14#include <fsCore/fsBaseTypes.h>
16
17class fsCEntity;
18class fsCUniqueId;
19class fsIComponent;
23
24
26{
27public:
28
30
34 const static fsStr mAutoGuiTestName;
35
36 fsBool active() const { return nullptr != mTestLogic; }
37
38 // A title's own test persona, chosen by setting autoTest to its name. Register before the
39 // manager is created (a static initialiser will do); pRegister adds the component type to
40 // the factory and pCreate adds it to the manager's entity.
41 struct sPersona
42 {
43 // Optional cheat player name that starts it from the new player screen, like the
44 // built-in test names. Empty for setting-only personas.
46 std::function<void(fsCComponentFactory*)> mRegister;
48 };
49 static void personaRegister(const fsStr& pName, const sPersona& pPersona);
50
51 static void create(fsCEntityFactory* pEntityFactory, fsCComponentFactory* pComponentFactory);
52 static void destroy();
53
55
57
58protected:
59
60 gfCAutoTestManager(fsCEntityFactory* pEntityFactory, fsCComponentFactory* pComponentFactory);
61
62 void listenersRegisterDo() override;
63 void listenersDeregisterDo() override;
64 fsBool messageProcessDo(const fsCUniqueId& pMessageType,
65 const fsIMessageDispatcher::sMessageParameters& pParam) override;
66
67private:
68
69 static void clearUpTestProfiles();
70 static fsStr playerNameGet();
71
72 void testLogicChoose(const fsStr& pPlayerName);
73
74 fsBool cheatKeyHandle(fsS32 pTypedChar);
75 void testPauseToggle();
76 void badgeCreate();
77 void badgeTextSet(const fsStr& pText);
78
79 const static fsStr mAutoLoadAutoPlayTestName;
80
81 static gfCAutoTestManager* mInstance;
82
83 fsCEntity* mEntity;
84 // Children of mEntity, so they die with it.
85 fsCEntity* mBadge;
86 fsCEntity* mBadgeBacking;
87 fsStr mTestName;
88
90};
91
92#endif
Definition fsCComponentFactory.h:26
Definition fsCEntityFactory.h:25
Definition fsCEntity.h:39
Definition fsCUniqueId.h:21
Definition fsIComponent.h:26
fsIMessageListener(fsS32 pPriority)
Definition fsIMessageListener.cpp:41
Definition fsStr.h:23
static void personaRegister(const fsStr &pName, const sPersona &pPersona)
Definition gfCAutoTestManager.cpp:61
void listenersRegisterDo() override
Definition gfCAutoTestManager.cpp:67
fsBool active() const
Definition gfCAutoTestManager.h:36
static void create(fsCEntityFactory *pEntityFactory, fsCComponentFactory *pComponentFactory)
Definition gfCAutoTestManager.cpp:181
static const fsStr mScreenShotTestName
Definition gfCAutoTestManager.h:31
gfCAutoTestManager(fsCEntityFactory *pEntityFactory, fsCComponentFactory *pComponentFactory)
Definition gfCAutoTestManager.cpp:314
fsBool messageProcessDo(const fsCUniqueId &pMessageType, const fsIMessageDispatcher::sMessageParameters &pParam) override
Definition gfCAutoTestManager.cpp:149
static const fsStr mAutoPlayTestName
Definition gfCAutoTestManager.h:33
void listenersDeregisterDo() override
Definition gfCAutoTestManager.cpp:75
static const fsStr mAutoGuiTestName
Definition gfCAutoTestManager.h:34
static const fsCUniqueId mTestComplete
Definition gfCAutoTestManager.h:29
~gfCAutoTestManager()
Definition gfCAutoTestManager.cpp:338
static void destroy()
Definition gfCAutoTestManager.cpp:208
static const fsStr mAutoLoadTestName
Definition gfCAutoTestManager.h:32
static gfCAutoTestManager * instanceGet()
Definition gfCAutoTestManager.cpp:188
Definition gfIAutoTestUserInputComponent.h:19
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
Definition fsIMessageDispatcher.h:32
Definition gfCAutoTestManager.h:42
std::function< void(fsCComponentFactory *)> mRegister
Definition gfCAutoTestManager.h:46
fsStr mPlayerName
Definition gfCAutoTestManager.h:45
std::function< gfIAutoTestLevelUserInputComponent *(fsCEntity *)> mCreate
Definition gfCAutoTestManager.h:47