test(stammbaum): tidyTree centres a wide couple run and clears siblings (#724)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -116,3 +116,22 @@ describe('tidyTree — multi-root packing', () => {
|
|||||||
expect(Math.min(...x.values())).toBe(0);
|
expect(Math.min(...x.values())).toBe(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('tidyTree — variable-width run', () => {
|
||||||
|
it('centres a wide couple run over its children and clears its siblings', () => {
|
||||||
|
// A couple unit is one node whose width spans two cards + the gap. It
|
||||||
|
// must still centre over its own children and stay clear of siblings by
|
||||||
|
// the FULL run width, not a single card.
|
||||||
|
const COUPLE = 2 * W + GAP;
|
||||||
|
const couple = node('couple', [leaf('g1'), leaf('g2')], COUPLE);
|
||||||
|
const sibling = node('sib', [leaf('s1')]);
|
||||||
|
const roots = [sibling, couple];
|
||||||
|
const x = layoutForest(roots, GAP);
|
||||||
|
|
||||||
|
expectNoOverlap(x, roots, GAP);
|
||||||
|
// Couple centred over its two children.
|
||||||
|
expect(center(x, couple)).toBe((center(x, leaf('g1')) + center(x, leaf('g2'))) / 2);
|
||||||
|
// The sibling root clears the couple's full run width.
|
||||||
|
expect(x.get('couple')! - x.get('sib')!).toBeGreaterThanOrEqual(W + GAP);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user