Elaztek Developer Hub
Blamite Game Engine - blam!  00398.09.22.23.2015.blamite
The core library for the Blamite Game Engine.
Demo::UnitTest Class Reference

Usage: To record: Start app with –ut_record=/home/username/Ogre/pbs.json –ut_compress Move around and press F12 to take a picture To playback: –ut_playback=/home/username/Ogre/pbs.json –ut_output=/home/username/Ogre/. More...

#include <UnitTesting.h>

+ Inheritance diagram for Demo::UnitTest:
+ Collaboration diagram for Demo::UnitTest:

Classes

struct  Params
 

Public Member Functions

 UnitTest ()
 
void parseCmdLine (int nargs, const char *const *argv)
 
const ParamsgetParams (void) const
 
void startRecording (Demo::GraphicsSystem *graphicsSystem)
 
void notifyRecordingNewFrame (Demo::GraphicsSystem *graphicsSystem)
 
void saveToJson (const char *fullpath, const bool bCompressDuration)
 Saves the current recording to JSON, for later playback. More...
 
virtual void keyPressed (const SDL_KeyboardEvent &arg)
 
virtual void keyReleased (const SDL_KeyboardEvent &arg)
 
virtual void mouseMoved (const SDL_Event &arg)
 
virtual void mousePressed (const SDL_MouseButtonEvent &arg, Ogre::uint8 id)
 
virtual void mouseReleased (const SDL_MouseButtonEvent &arg, Ogre::uint8 id)
 
int loadFromJson (const char *fullpath, const Ogre::String &outputFolder)
 Loads JSON from fullpath and plays it back, saving the results to outputFolder Return value is the return value for main() More...
 
- Public Member Functions inherited from Demo::KeyboardListener
virtual void textEditing (const SDL_TextEditingEvent &arg)
 
virtual void textInput (const SDL_TextInputEvent &arg)
 

Protected Member Functions

void exportFrameActivity (const FrameActivity &frameActivity, Ogre::LwString &jsonStr, std::string &outJson)
 
void saveToJsonStr (std::string &outJson)
 
int runLoop (Ogre::String outputFolder)
 

Static Protected Member Functions

static void flushLwString (Ogre::LwString &jsonStr, std::string &outJson)
 
static bool shouldRecordKey (const SDL_KeyboardEvent &arg)
 
static Ogre::Vector3 getCameraRecordPosition (Ogre::Camera *camera)
 

Protected Attributes

double mFrametime
 
uint32_t mFrameIdx
 
uint32_t mNumFrames
 
KeyboardListenermRealKeyboardListener
 
MouseListenermRealMouseListener
 
std::vector< FrameActivity > mFrameActivity
 
Params mParams
 
bool mBlockInputForwarding
 

Detailed Description

Usage: To record: Start app with –ut_record=/home/username/Ogre/pbs.json –ut_compress Move around and press F12 to take a picture To playback: –ut_playback=/home/username/Ogre/pbs.json –ut_output=/home/username/Ogre/.

ut_compress is optional (recommended) ut_output is where the the app should dump the captures (i.e. where you pressed F12) ut_skip_dump can be used in playback to skip dumping (i.e. to debug an error)

Constructor & Destructor Documentation

◆ UnitTest()

Demo::UnitTest::UnitTest ( )

Member Function Documentation

◆ exportFrameActivity()

void Demo::UnitTest::exportFrameActivity ( const FrameActivity &  frameActivity,
Ogre::LwString &  jsonStr,
std::string &  outJson 
)
protected
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flushLwString()

void Demo::UnitTest::flushLwString ( Ogre::LwString &  jsonStr,
std::string &  outJson 
)
inlinestaticprotected
+ Here is the caller graph for this function:

◆ getCameraRecordPosition()

static Ogre::Vector3 Demo::UnitTest::getCameraRecordPosition ( Ogre::Camera *  camera)
staticprotected

◆ getParams()

const Params& Demo::UnitTest::getParams ( void  ) const
inline
+ Here is the caller graph for this function:

◆ keyPressed()

void Demo::UnitTest::keyPressed ( const SDL_KeyboardEvent arg)
virtual

Reimplemented from Demo::KeyboardListener.

+ Here is the call graph for this function:

◆ keyReleased()

void Demo::UnitTest::keyReleased ( const SDL_KeyboardEvent arg)
virtual

Reimplemented from Demo::KeyboardListener.

+ Here is the call graph for this function:

◆ loadFromJson()

int Demo::UnitTest::loadFromJson ( const char *  fullpath,
const Ogre::String &  outputFolder 
)

Loads JSON from fullpath and plays it back, saving the results to outputFolder Return value is the return value for main()

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mouseMoved()

void Demo::UnitTest::mouseMoved ( const SDL_Event arg)
virtual

Reimplemented from Demo::MouseListener.

+ Here is the call graph for this function:

◆ mousePressed()

void Demo::UnitTest::mousePressed ( const SDL_MouseButtonEvent arg,
Ogre::uint8  id 
)
virtual

Reimplemented from Demo::MouseListener.

+ Here is the call graph for this function:

◆ mouseReleased()

void Demo::UnitTest::mouseReleased ( const SDL_MouseButtonEvent arg,
Ogre::uint8  id 
)
virtual

Reimplemented from Demo::MouseListener.

+ Here is the call graph for this function:

◆ notifyRecordingNewFrame()

void Demo::UnitTest::notifyRecordingNewFrame ( Demo::GraphicsSystem graphicsSystem)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseCmdLine()

void Demo::UnitTest::parseCmdLine ( int  nargs,
const char *const *  argv 
)
+ Here is the caller graph for this function:

◆ runLoop()

int Demo::UnitTest::runLoop ( Ogre::String  outputFolder)
protected
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveToJson()

void Demo::UnitTest::saveToJson ( const char *  fullpath,
const bool  bCompressDuration 
)

Saves the current recording to JSON, for later playback.

Parameters
fullpathFull path where to save the JSON file
bCompressDurationWhen true, we assume mNumFrames can be reduced to a minimum. Thus if recording took 70 seconds but there's only 8 FrameActivity, then it will be compressed to roughly 11 frames.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveToJsonStr()

void Demo::UnitTest::saveToJsonStr ( std::string &  outJson)
protected
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shouldRecordKey()

bool Demo::UnitTest::shouldRecordKey ( const SDL_KeyboardEvent arg)
staticprotected
+ Here is the caller graph for this function:

◆ startRecording()

void Demo::UnitTest::startRecording ( Demo::GraphicsSystem graphicsSystem)
+ Here is the caller graph for this function:

Member Data Documentation

◆ mBlockInputForwarding

bool Demo::UnitTest::mBlockInputForwarding
protected

◆ mFrameActivity

std::vector<FrameActivity> Demo::UnitTest::mFrameActivity
protected

◆ mFrameIdx

uint32_t Demo::UnitTest::mFrameIdx
protected

◆ mFrametime

double Demo::UnitTest::mFrametime
protected

◆ mNumFrames

uint32_t Demo::UnitTest::mNumFrames
protected

◆ mParams

Params Demo::UnitTest::mParams
protected

◆ mRealKeyboardListener

KeyboardListener* Demo::UnitTest::mRealKeyboardListener
protected

◆ mRealMouseListener

MouseListener* Demo::UnitTest::mRealMouseListener
protected

The documentation for this class was generated from the following files: