This repository has been archived on 2026-10-10. You can view files and clone it, but cannot push or open issues or pull requests.
molotov/crates/molotov-core/tests/haptics_test.rs

21 lines
766 B
Rust

// SPDX-License-Identifier: GPL-3.0-or-later
use molotov_core::input::haptics::RumbleManager;
#[test]
fn test_rumble_actuation_and_clamping() {
let mut manager = RumbleManager::new();
let pad_id = 1;
// Actuate rumble: low_freq = 0.5 (32767), high_freq = 1.0 (65535), duration = 250ms
manager.rumble(pad_id, 0.5, 1.0, 250);
let state = manager.get_state(pad_id).expect("Should have rumble state");
assert_eq!(state.low_freq_motor, 32767);
assert_eq!(state.high_freq_motor, 65535);
assert_eq!(state.duration_ms, 250);
// Stop rumble
manager.stop(pad_id);
let stopped = manager.get_state(pad_id).expect("Should have rumble state");
assert_eq!(stopped.low_freq_motor, 0);
assert_eq!(stopped.high_freq_motor, 0);
}