xorg-gtest
0.1
Xorg testing extension to Google Test
|
evemu input device for replaying events through the Linux uinput evdev subsystem. More...
#include <xorg/gtest/evemu/xorg-gtest-device.h>
Public Member Functions | |
Device (const std::string &path) | |
Create a new device context. More... | |
void | Play (const std::string &path) const |
Play a evemu recording through the device. More... | |
void | PlayOne (int type, int code, int value, bool sync=false) |
Play a single event through the device. More... | |
const std::string & | GetDeviceNode (void) |
Return the /dev/input/eventX device node for this device. More... | |
evemu input device for replaying events through the Linux uinput evdev subsystem.
Use the Recording class to play back a specific recording.
|
explicit |
Create a new device context.
[in] | path | Path to evemu device property file. |
std::runtime_error | if the device property file could not be found or the device could not be created. |
const std::string& xorg::testing::evemu::Device::GetDeviceNode | ( | void | ) |
Return the /dev/input/eventX device node for this device.
Note that evemu doesn't know the device node, so we traverse the file system looking for it. There is a tiny chance of the device node being wrong, or the device disappearing before we find it. If the device node cannot be found, an empty string is returned.
void xorg::testing::evemu::Device::Play | ( | const std::string & | path | ) | const |
Play a evemu recording through the device.
Plays the recording from the beginning through the end. This call will block until the recording has finished.
[in] | path | Path to evemu recording file. |
std::runtime_error | if playback failed for any reason. |
void xorg::testing::evemu::Device::PlayOne | ( | int | type, |
int | code, | ||
int | value, | ||
bool | sync = false |
||
) |
Play a single event through the device.
Plays an event with the given type, code and value through the device.
[in] | type | Evdev interface event type, e.g. EV_ABS, EV_REL, EV_KEY. |
[in] | code | Evdev interface event code, e.g. ABS_X, REL_Y, BTN_LEFT |
[in] | value | Event value |
[in] | sync | If true, submit an EV_SYN event after this event |
std::runtime_error | if playback failed for any reason. |