test(stammbaum): tidyTree packs multiple roots left-to-right (#724)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -97,3 +97,22 @@ describe('tidyTree — contour nesting', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('tidyTree — multi-root packing', () => {
|
||||
it('packs multiple roots left-to-right with no overlap', () => {
|
||||
// A real Stammbaum is a forest of ~50 roots, not a single tree — this is
|
||||
// the dominant compactness win. Three roots of differing shapes.
|
||||
const r1 = node('r1', [leaf('r1a'), leaf('r1b')]);
|
||||
const r2 = leaf('r2');
|
||||
const r3 = node('r3', [leaf('r3a')]);
|
||||
const roots = [r1, r2, r3];
|
||||
const x = layoutForest(roots, GAP);
|
||||
|
||||
expectNoOverlap(x, roots, GAP);
|
||||
// Roots keep input order left-to-right.
|
||||
expect(x.get('r1')!).toBeLessThan(x.get('r2')!);
|
||||
expect(x.get('r2')!).toBeLessThan(x.get('r3')!);
|
||||
// Forest is normalised so the leftmost edge is at 0.
|
||||
expect(Math.min(...x.values())).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user