use ftui_core::geometry::Rect;
use ftui_render::buffer::Buffer;
use ftui_render::cell::Cell;
#[test]
fn copy_from_slices_wide_char_start() {
let mut src = Buffer::new(5, 1);
src.set(0, 0, Cell::from_char('中'));
let mut dst = Buffer::new(5, 1);
dst.copy_from(&src, Rect::new(1, 0, 4, 1), 0, 0);
let cell = dst.get(0, 0).unwrap();
assert!(
!cell.is_continuation(),
"Orphan continuation created in dst!"
);
assert!(cell.is_empty(), "Should be empty (cleaned up)");
}
#[test]
fn copy_from_slices_wide_char_end() {
let mut src = Buffer::new(5, 1);
src.set(0, 0, Cell::from_char('中'));
let mut dst = Buffer::new(5, 1);
dst.copy_from(&src, Rect::new(0, 0, 1, 1), 0, 0);
assert!(
dst.get(0, 0).unwrap().is_empty(),
"Wide char head should not be written if tail is clipped"
);
assert!(
dst.get(1, 0).unwrap().is_empty(),
"No continuation should exist since head was rejected"
);
}