UPDATE: Parses selected row/column/range and selected sheet (#67)
* FIX: Update to Rust 1.78.0 * UPDATE: Parses selected row/column/range and selected sheet
This commit is contained in:
committed by
GitHub
parent
a78d5593f2
commit
f752c90058
@@ -12,9 +12,38 @@ use ironcalc_base::Model;
|
||||
#[test]
|
||||
fn test_example() {
|
||||
let model = load_from_xlsx("tests/example.xlsx", "en", "UTC").unwrap();
|
||||
// We should use the API once it is in place
|
||||
let workbook = model.workbook;
|
||||
assert_eq!(workbook.worksheets[0].frozen_rows, 0);
|
||||
assert_eq!(workbook.worksheets[0].frozen_columns, 0);
|
||||
let ws = &workbook.worksheets;
|
||||
let expected_names = vec![
|
||||
("Sheet1".to_string(), false),
|
||||
("Second".to_string(), false),
|
||||
("Sheet4".to_string(), false),
|
||||
("shared".to_string(), false),
|
||||
("Table".to_string(), false),
|
||||
("Sheet2".to_string(), false),
|
||||
("Created fourth".to_string(), false),
|
||||
("Frozen".to_string(), true),
|
||||
("Split".to_string(), false),
|
||||
("Hidden".to_string(), false),
|
||||
];
|
||||
let names: Vec<(String, bool)> = ws
|
||||
.iter()
|
||||
.map(|s| (s.name.clone(), s.selection.is_selected))
|
||||
.collect();
|
||||
|
||||
// One is not not imported and one is hidden
|
||||
assert_eq!(expected_names, names);
|
||||
|
||||
// Test selection:
|
||||
// First sheet (Sheet1)
|
||||
// E13 and E13:N20
|
||||
assert_eq!(ws[0].frozen_rows, 0);
|
||||
assert_eq!(ws[0].frozen_columns, 0);
|
||||
assert_eq!(ws[0].selection.row, 13);
|
||||
assert_eq!(ws[0].selection.column, 5);
|
||||
assert_eq!(ws[0].selection.range, [13, 5, 20, 14]);
|
||||
|
||||
let model2 = load_from_icalc("tests/example.ic").unwrap();
|
||||
let s = bitcode::encode(&model2.workbook);
|
||||
assert_eq!(workbook, model2.workbook, "{:?}", s);
|
||||
|
||||
Reference in New Issue
Block a user