pub struct MockController { /* private fields */ }Expand description
A mock display controller for testing.
This allows testing code that depends on DisplayController without
requiring actual ASUS hardware or the ASUS DLL.
§Example
use asus_display_control::{MockController, DisplayController, NormalMode};
let mock = MockController::new();
mock.set_mode(&NormalMode::new()).unwrap();
assert_eq!(mock.get_state().mode_id, 1);Implementations§
Source§impl MockController
impl MockController
Sourcepub fn with_state(state: ControllerState) -> Self
pub fn with_state(state: ControllerState) -> Self
Create a mock controller with custom initial state.
Trait Implementations§
Source§impl Default for MockController
impl Default for MockController
Source§impl DisplayController for MockController
impl DisplayController for MockController
Source§fn get_state(&self) -> ControllerState
fn get_state(&self) -> ControllerState
Get a snapshot of the current controller state.
Source§fn refresh_sliders(&self) -> Result<(), ControllerError>
fn refresh_sliders(&self) -> Result<(), ControllerError>
Refresh slider values from the device.
Source§fn sync_all_sliders(&self) -> Result<(), ControllerError>
fn sync_all_sliders(&self) -> Result<(), ControllerError>
Sync all slider values from hardware.
Source§fn set_dimming(&self, level: i32) -> Result<(), ControllerError>
fn set_dimming(&self, level: i32) -> Result<(), ControllerError>
Set the display dimming level (40-100 in splendid units).
Source§fn set_dimming_percent(&self, percent: i32) -> Result<(), ControllerError>
fn set_dimming_percent(&self, percent: i32) -> Result<(), ControllerError>
Set dimming using percentage (0-100).
Source§fn get_current_mode(&self) -> Result<Box<dyn DisplayMode>, ControllerError>
fn get_current_mode(&self) -> Result<Box<dyn DisplayMode>, ControllerError>
Get the current display mode.
Source§fn set_mode(&self, mode: &dyn DisplayMode) -> Result<(), ControllerError>
fn set_mode(&self, mode: &dyn DisplayMode) -> Result<(), ControllerError>
Set a display mode.
Source§fn toggle_e_reading(&self) -> Result<Box<dyn DisplayMode>, ControllerError>
fn toggle_e_reading(&self) -> Result<Box<dyn DisplayMode>, ControllerError>
Toggle e-reading mode on/off.
Auto Trait Implementations§
impl !Freeze for MockController
impl RefUnwindSafe for MockController
impl Send for MockController
impl Sync for MockController
impl Unpin for MockController
impl UnwindSafe for MockController
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more