Merge branch 'fix/engine-test-pass' of github.com:dotCooCoo/vectorcraft into fix/engine-test-pass

This commit is contained in:
dotCooCoo committed 2026-12-01 20:28:46 -08:00
commit 0a9ea7ad8d
1 file changed
+7 -3
+7 -3
View File
@@ -6726,9 +6726,12 @@ fn designs_and_markers_survive_save_and_open() {
assert_eq!(marks.iter().filter(|n| sized(n, 5.0)).count(), 1, "a default square at the one data point");
}
/// Whether `n` is a square `side` points across (a default point marker is 5, a default legend swatch 8).
/// Whether `n` is a square path `side` points across, drawn as the four corners of its bounds (a default point marker
/// is 5, a default legend swatch 8).
fn sized(n: &vectorcraft_doc::Node, side: f64) -> bool {
n.geometric_bounds().is_some_and(|b| (b.width() - side).abs() < 1e-6 && (b.height() - side).abs() < 1e-6)
let Some(b) = n.geometric_bounds() else { return false };
let square = matches!(&n.kind, NodeKind::Path { path, .. } if *path == vectorcraft_geom::shapes::rectangle(b));
square && (b.width() - side).abs() < 1e-6 && (b.height() - side).abs() < 1e-6
}
#[test]
@@ -7174,7 +7177,8 @@ fn graph_column_params_are_checked_and_designs_too_big_are_drawn_plain() {
assert_eq!(marks.iter().filter(|n| sized(n, 8.0)).count(), 1, "a default square as the legend swatch");
let columns: Vec<_> = marks.iter().filter(|n| !sized(n, 8.0)).collect();
assert_eq!(columns.len(), 1, "one plain column for the one value");
assert!(columns[0].geometric_bounds().is_some_and(|b| b.height() > 8.0), "the column has the value's height");
let height = columns[0].geometric_bounds().map(|b| b.height());
assert!(height.is_some_and(|h| (h - 140.0).abs() < 1e-6), "the column has the value's height: {height:?}");
// Columns of 0 on a value axis from 10,000 to 10,001 run 2,000,000 points from the clamped zero line: a copy each
// 0.1 is past the budget too.
let far = one_series(&mut s, "column", &[0.0, 0.0]);