mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-17 23:13:55 +01:00
test(wm): move workspace to non existent monitor
Created a test for moving the focused workspace to a monitor that hasn't been created. The test ensures that we receive an error when moving a workspace to a monitor that doesn't exist.
This commit is contained in:
@@ -4968,7 +4968,7 @@ mod tests {
|
||||
// Should have 2 workspaces
|
||||
assert_eq!(m.workspaces().len(), 2);
|
||||
|
||||
// Add monitor to workspace
|
||||
// Add monitor to window manager
|
||||
wm.monitors_mut().push_back(m);
|
||||
}
|
||||
|
||||
@@ -5015,6 +5015,42 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_move_workspace_to_nonexistent_monitor() {
|
||||
let (mut wm, _context) = setup_window_manager();
|
||||
|
||||
{
|
||||
let mut m = monitor::new(
|
||||
0,
|
||||
Rect::default(),
|
||||
Rect::default(),
|
||||
"TestMonitor".to_string(),
|
||||
"TestDevice".to_string(),
|
||||
"TestDeviceID".to_string(),
|
||||
Some("TestMonitorID".to_string()),
|
||||
);
|
||||
|
||||
// Add another workspace
|
||||
let new_workspace_index = m.new_workspace_idx();
|
||||
m.focus_workspace(new_workspace_index).unwrap();
|
||||
|
||||
// Should have 2 workspaces
|
||||
assert_eq!(m.workspaces().len(), 2);
|
||||
|
||||
// Add monitor to window manager
|
||||
wm.monitors_mut().push_back(m);
|
||||
}
|
||||
|
||||
// Attempt to move a workspace to a non-existent monitor
|
||||
let result = wm.move_workspace_to_monitor(1);
|
||||
|
||||
// Should be an error since Monitor 1 does not exist
|
||||
assert!(
|
||||
result.is_err(),
|
||||
"Expected an error when moving to a non-existent monitor"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_toggle_tiling() {
|
||||
let (mut wm, _context) = setup_window_manager();
|
||||
|
||||
Reference in New Issue
Block a user