in src/components/splitting.rs [210:255]
fn test_adaptive() {
let splitter = make_splitter(SplitKind::Adaptive, Direction::Horizontal);
let mut state = State::new();
// left rows all the same length
let mut left_msg = vec![
vec!["test"].try_into().unwrap(),
vec!["ok", "so"].try_into().unwrap(),
vec!["sync"].try_into().unwrap(),
];
let right_msg = vec![
vec!["xx"].try_into().unwrap(),
vec!["yyy"].try_into().unwrap(),
vec!["z"].try_into().unwrap(),
];
let horizontal = vec![
vec!["test", "xx", " "].try_into().unwrap(),
vec!["ok", "so", "yyy"].try_into().unwrap(),
vec!["sync", "z", " "].try_into().unwrap(),
];
let msg1 = Echo1(left_msg.clone());
let msg2 = Echo2(right_msg);
state.insert(&msg1);
state.insert(&msg2);
let output = splitter
.draw(&state, Dimensions::new(10, 10), DrawMode::Normal)
.unwrap();
assert_eq!(output, horizontal);
// uneven left row
left_msg[0] = vec!["hello world"].try_into().unwrap();
let horizontal = vec![
vec!["hello world", "xx", " "].try_into().unwrap(),
vec!["ok", "so", &" ".repeat(7), "yyy"].try_into().unwrap(),
vec!["sync", &" ".repeat(7), "z", " "].try_into().unwrap(),
];
let msg1 = Echo1(left_msg);
state.insert(&msg1);
let output = splitter
.draw(&state, Dimensions::new(15, 15), DrawMode::Normal)
.unwrap();
assert_eq!(output, horizontal);
}