Robot Devastation
Public Member Functions | Private Attributes | List of all members
rd::MockInputEventListener Class Reference

Mock object that receives and stores key presses, mainly for testing purposes.

#include <MockInputEventListener.hpp>

Inheritance diagram for rd::MockInputEventListener:
rd::InputEventListener

Public Member Functions

virtual bool onKeyDown (const Key &k)
 This function will be called whenever a key is pressed on the keyboard. More...
 
virtual bool onKeyUp (const Key &k)
 This function will be called whenever a key is released on the keyboard. More...
 
virtual bool onWindowEvent (const WindowEvent &event)
 This function will be called whenever a window event is raised. More...
 
int getNumKeyDownPresses () const
 
int getNumKeyUpPresses () const
 
int getNumWindowEvents () const
 
bool clear ()
 
const std::vector< Key > & getStoredKeyUpPresses () const
 
const std::vector< Key > & getStoredKeyDownPresses () const
 
const std::vector< WindowEvent > & getStoredWindowEvents () const
 

Private Attributes

int num_keydown_presses
 
std::vector< Keystored_keydown_presses
 
int num_keyup_presses
 
std::vector< Keystored_keyup_presses
 
int num_window_events
 
std::vector< WindowEventstored_window_events
 

Member Function Documentation

◆ onKeyDown()

bool rd::MockInputEventListener::onKeyDown ( const Key k)
virtual
Parameters
kKey that triggered the event

Implements rd::InputEventListener.

◆ onKeyUp()

bool rd::MockInputEventListener::onKeyUp ( const Key k)
virtual
Parameters
kKey that triggered the event

Implements rd::InputEventListener.

◆ onWindowEvent()

bool rd::MockInputEventListener::onWindowEvent ( const WindowEvent event)
virtual
Parameters
eventWindowEvent object that wraps the window event

Implements rd::InputEventListener.


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