mirror of
https://github.com/lbgos/rift-s-linux.git
synced 2026-10-17 14:00:55 +02:00
tests: cover haptic latched-stop across transport reset
This commit is contained in:
1 parent
e76388e9ea
commit
addb8495fe
2 files changed
+27
-1
No files matched your search
@@ -173,7 +173,8 @@ if(XRT_BUILD_DRIVER_RIFT_S)
|
||||
target_include_directories(tests_rift_s_metadata PRIVATE ../src/xrt/drivers/rift_s)
|
||||
target_link_libraries(tests_rift_s_metadata PRIVATE xrt-external-catch2 drv_rift_s aux_math)
|
||||
add_test(NAME tests_rift_s_metadata COMMAND tests_rift_s_metadata)
|
||||
add_executable(tests_rift_s_radio tests_rift_s_radio.cpp ../src/xrt/drivers/rift_s/rift_s_radio.c)
|
||||
add_executable(tests_rift_s_radio tests_rift_s_radio.cpp ../src/xrt/drivers/rift_s/rift_s_radio.c
|
||||
../src/xrt/drivers/rift_s/rift_s_haptics.c)
|
||||
target_include_directories(tests_rift_s_radio PRIVATE ../src/xrt/drivers)
|
||||
target_link_libraries(tests_rift_s_radio PRIVATE xrt-external-catch2 aux_util)
|
||||
add_test(NAME tests_rift_s_radio COMMAND tests_rift_s_radio)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "catch_amalgamated.hpp"
|
||||
extern "C" {
|
||||
#include "rift_s/rift_s_radio.h"
|
||||
#include "rift_s/rift_s_haptics.h"
|
||||
#include "rift_s/rift_s_protocol.h"
|
||||
#include "util/u_time.h"
|
||||
#include "util/u_logging.h"
|
||||
@@ -366,3 +367,27 @@ TEST_CASE("Radio with no device keeps the queue until the deadline")
|
||||
CHECK(st.pending_commands == nullptr);
|
||||
rift_s_radio_state_clear(&st);
|
||||
}
|
||||
|
||||
TEST_CASE("Haptic latched stop survives a transport reset")
|
||||
{
|
||||
// close_transport clears the request side but keeps the latched motor identity.
|
||||
struct rift_s_haptic_radio h = {};
|
||||
h.hand = 0;
|
||||
h.device_id = 0;
|
||||
h.amplitude = 0;
|
||||
h.end_ns = 0;
|
||||
h.applied_device_id = 0x13001101;
|
||||
h.applied_amplitude = 200;
|
||||
|
||||
uint64_t id = 0;
|
||||
uint8_t amp = 0xFF;
|
||||
CHECK(rift_s_haptic_next(&h, T0, &id, &));
|
||||
CHECK(id == 0x13001101);
|
||||
CHECK(amp == 0);
|
||||
|
||||
// Nothing ever latched: no spurious stop, no pairing-list probe needed.
|
||||
struct rift_s_haptic_radio idle = {};
|
||||
id = 0xDEAD;
|
||||
amp = 0xFF;
|
||||
CHECK_FALSE(rift_s_haptic_next(&idle, T0, &id, &));
|
||||
}
|
||||
Reference in new issue
Block a user