fix(dicom-tag-browser): Prevent long series names from overlapping - OHIF-2406 (#5809)

This commit is contained in:
Ghadeer Albattarni authored and GitHub committed 2026-02-17 16:56:00 -05:00
1 parent f668848230
commit cca1a8683b
6 files changed
+140 -5

No files matched your search

+43
View File
@@ -18,3 +18,46 @@ export async function assertNumberOfModalityLoadBadges({
expect(count).toBe(expectedCount);
}
/**
* Asserts that one bounding box is completely contained within another.
* Checks that all edges of the inner box are within the outer box boundaries.
*/
export async function assertBoundingBoxIsContainedWithin({
innerBox,
outerBox,
innerBoxLabel = 'inner element',
outerBoxLabel = 'outer element',
}: {
innerBox: { x: number; y: number; width: number; height: number } | null;
outerBox: { x: number; y: number; width: number; height: number } | null;
innerBoxLabel?: string;
outerBoxLabel?: string;
}) {
expect(innerBox).not.toBeNull();
expect(outerBox).not.toBeNull();
if (!outerBox || !innerBox) {
return;
}
expect(
innerBox.x,
`${innerBoxLabel} left edge should be within ${outerBoxLabel}`
).toBeGreaterThanOrEqual(outerBox.x);
expect(
innerBox.y,
`${innerBoxLabel} top edge should be within ${outerBoxLabel}`
).toBeGreaterThanOrEqual(outerBox.y);
expect(
innerBox.x + innerBox.width,
`${innerBoxLabel} right edge should be within ${outerBoxLabel}`
).toBeLessThanOrEqual(outerBox.x + outerBox.width);
expect(
innerBox.y + innerBox.height,
`${innerBoxLabel} bottom edge should be within ${outerBoxLabel}`
).toBeLessThanOrEqual(outerBox.y + outerBox.height);
}