mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-05-07 03:13:31 +02:00
test(wm): monocle on and off on nonexistent container
Created a test that tests moving a nonexistent container to monocle and retreiving a nonexistent container from monocle. The test ensures we receive an error when attempting to use monocle_on or monocle_off when a container doesn't exist.
This commit is contained in:
@@ -5834,6 +5834,41 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_monocle_on_and_off_nonexistent_container() {
|
||||
let (mut wm, _context) = setup_window_manager();
|
||||
|
||||
{
|
||||
// Create a monitor
|
||||
let m = monitor::new(
|
||||
0,
|
||||
Rect::default(),
|
||||
Rect::default(),
|
||||
"TestMonitor".to_string(),
|
||||
"TestDevice".to_string(),
|
||||
"TestDeviceID".to_string(),
|
||||
Some("TestMonitorID".to_string()),
|
||||
);
|
||||
|
||||
// Add monitor to the window manager
|
||||
wm.monitors_mut().push_back(m);
|
||||
}
|
||||
|
||||
// Should return an error when trying to move a non-existent container to monocle
|
||||
let result = wm.monocle_on();
|
||||
assert!(
|
||||
result.is_err(),
|
||||
"Expected an error when trying to move a non-existent container to monocle"
|
||||
);
|
||||
|
||||
// Should return an error when trying to restore a non-existent container from monocle
|
||||
let result = wm.monocle_off();
|
||||
assert!(
|
||||
result.is_err(),
|
||||
"Expected an error when trying to restore a non-existent container from monocle"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_toggle_monocle() {
|
||||
let (mut wm, _context) = setup_window_manager();
|
||||
|
||||
Reference in New Issue
Block a user