diff options
Diffstat (limited to 'runtime/test/gameinput_test.cpp')
| -rw-r--r-- | runtime/test/gameinput_test.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/runtime/test/gameinput_test.cpp b/runtime/test/gameinput_test.cpp index b6658f51c..bb63e2df9 100644 --- a/runtime/test/gameinput_test.cpp +++ b/runtime/test/gameinput_test.cpp | |||
| @@ -2229,6 +2229,22 @@ int main(int argc, char** argv) { | |||
| 2229 | release_all(seen); | 2229 | release_all(seen); |
| 2230 | if (pair_ref) pair_ref->Release(); | 2230 | if (pair_ref) pair_ref->Release(); |
| 2231 | 2231 | ||
| 2232 | // A slow reader: a press that came and went between two reads of a pad is answered once, then the real state. | ||
| 2233 | if (IGameInputReading* r = current(input, dev)) r->Release(); | ||
| 2234 | Sleep(80); | ||
| 2235 | SDL_SetJoystickVirtualButton(xbox2.js, SDL_GAMEPAD_BUTTON_WEST, true); | ||
| 2236 | rt::gameinput::poll(); | ||
| 2237 | SDL_SetJoystickVirtualButton(xbox2.js, SDL_GAMEPAD_BUTTON_WEST, false); | ||
| 2238 | rt::gameinput::poll(); | ||
| 2239 | { | ||
| 2240 | IGameInputReading* first = current(input, dev); | ||
| 2241 | IGameInputReading* second = current(input, dev); | ||
| 2242 | check(first && second && (buttons_of(first) & GameInputGamepadX) && !(buttons_of(second) & GameInputGamepadX), | ||
| 2243 | "a slow reader sees a missed press once"); | ||
| 2244 | if (first) first->Release(); | ||
| 2245 | if (second) second->Release(); | ||
| 2246 | } | ||
| 2247 | |||
| 2232 | // Ageing: a reading leaves the history once the reading after it is more than half a second old. | 2248 | // Ageing: a reading leaves the history once the reading after it is more than half a second old. |
| 2233 | IGameInputReading* aged = current(input, dev); | 2249 | IGameInputReading* aged = current(input, dev); |
| 2234 | SDL_SetJoystickVirtualButton(xbox2.js, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, true); | 2250 | SDL_SetJoystickVirtualButton(xbox2.js, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, true); |