UPDATE: Text spills now to adjacent cells if needed

This commit is contained in:
Nicolás Hatcher
2025-07-07 23:21:13 +02:00
committed by Nicolás Hatcher Andrés
parent 107fc99409
commit 9852ce2504
8 changed files with 1501 additions and 1106 deletions

View File

@@ -11,6 +11,7 @@ mod test_evaluation;
mod test_general;
mod test_grid_lines;
mod test_keyboard_navigation;
mod test_last_empty_cell;
mod test_on_area_selection;
mod test_on_expand_selected_range;
mod test_on_paste_styles;

View File

@@ -0,0 +1,55 @@
#![allow(clippy::unwrap_used)]
use crate::constants::LAST_ROW;
use crate::expressions::types::Area;
use crate::test::util::new_empty_model;
use crate::UserModel;
#[test]
fn basic_tests() {
let model = new_empty_model();
let mut model = UserModel::from_model(model);
// This is the first row, column 5
model.set_user_input(0, 3, 5, "todo").unwrap();
// Row 3 before column 5 should be empty
assert_eq!(
model
.get_last_non_empty_in_row_before_column(0, 3, 4)
.unwrap(),
None
);
// Row 3 before column 5 should be 5
assert_eq!(
model
.get_last_non_empty_in_row_before_column(0, 3, 7)
.unwrap(),
Some(5)
);
}
#[test]
fn test_last_empty_cell() {
let model = new_empty_model();
let mut model = UserModel::from_model(model);
let column_g_range = Area {
sheet: 0,
row: 1,
column: 7,
width: 1,
height: LAST_ROW,
};
model
.update_range_style(&column_g_range, "fill.bg_color", "#333444")
.unwrap();
// Column 7 has a style but it is empty
assert_eq!(
model
.get_last_non_empty_in_row_before_column(0, 3, 14)
.unwrap(),
None
);
}