Skip to content

TEST: Add getBoundingBox regression tests for node geometries and ImageGeom#1673

Open
jmarquisbq wants to merge 1 commit into
BlueQuartzSoftware:developfrom
jmarquisbq:MissingGeomBBUnitTest
Open

TEST: Add getBoundingBox regression tests for node geometries and ImageGeom#1673
jmarquisbq wants to merge 1 commit into
BlueQuartzSoftware:developfrom
jmarquisbq:MissingGeomBBUnitTest

Conversation

@jmarquisbq

Copy link
Copy Markdown
Contributor

Summary

Adds the regression unit tests that should have accompanied the bounding-box
fix in commit a31beeb / #1649 (BUG: Fix INodeGeometry0D::getBoundingBox upper-corner initialization).

That fix corrected INodeGeometry0D::getBoundingBox(), which had seeded the
upper corner with std::numeric_limits<float>::min() — the smallest positive
normal float (~1.18e-38) — instead of std::numeric_limits<float>::lowest().
For any node geometry whose maximum coordinate on an axis was <= ~0 (e.g. a
mesh centered at or below the origin), the max corner never updated during the
vertex walk, producing a wrong/oversized bounding box. Geometries lying entirely
in positive space happened to work, which masked the bug. The fix shipped
without any test coverage, so this PR closes that gap.

Changes

All changes are in test/GeometryTest.cpp:

  • testNodeGeometryBoundingBox<>() — a templated helper that exercises three
    coordinate regimes against the shared INodeGeometry0D::getBoundingBox():
  • TEST_CASE("Node geometry getBoundingBox handles negative coordinates")
    runs the helper against every node geometry that inherits the method:
    VertexGeom, EdgeGeom, TriangleGeom, QuadGeom, TetrahedralGeom,
    HexahedralGeom.
  • TEST_CASE("ImageGeom getBoundingBox handles a negative origin") — the
    related grid geometry, which has its own independent implementation. Verifies
    both getBoundingBox() (float64) and getBoundingBoxf() (float32) with a
    negative origin (max-Y lands exactly on 0, the boundary case).

RectGridGeom has no getBoundingBox() of its own, so it needs no coverage here.

Verification

  • Confirmed the negative-space case fails against the pre-a31beeb code
    (getMaxPoint() returns ~0 instead of the least-negative coordinate) and
    passes with the fix in place.
  • Full GeometryTest.cpp suite passes: 270 assertions across 14 test cases.

Unit Testing

  • Unit test covering correct output (bounding box of node + image geometries
    across negative / origin-straddling / positive coordinate ranges)
  • Unit test for invalid input code paths — n/a (no new filter/error paths;
    this covers a geometry accessor)

Code Cleanup

  • No commented out code
  • No API changes were made
  • No major design changes were made
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed) — n/a
  • Added license to new files (if any) — n/a, no new files
  • Added example pipelines that use the filter — n/a
  • Classes and methods are properly documented

…geGeom

Commit a31beeb fixed INodeGeometry0D::getBoundingBox(), which had seeded the
upper corner with std::numeric_limits<float>::min() (the smallest positive
normal float, ~1.18e-38) instead of lowest(). For any node geometry whose
maximum coordinate on an axis was <= ~0, the max corner never updated during
the vertex walk, producing a wrong/oversized bounding box. That fix shipped
without regression coverage.

Add coverage in GeometryTest.cpp:
- testNodeGeometryBoundingBox<>() exercises negative-space (the BlueQuartzSoftware#1649
  regression), origin-straddling, and positive-space coordinate ranges. It is
  run against every node geometry (Vertex, Edge, Triangle, Quad, Tetrahedral,
  Hexahedral), all of which inherit the shared
  INodeGeometry0D::getBoundingBox().
- An ImageGeom case verifies the independent getBoundingBox()/getBoundingBoxf()
  grid implementations with a negative origin.

The negative-space case was confirmed to fail against the pre-a31beeb code and
to pass with the fix in place.

Signed-off-by: Jessica Marquis <jessica.marquis@bluequartz.net>
@jmarquisbq
jmarquisbq requested a review from imikejackson July 16, 2026 15:22
@jmarquisbq jmarquisbq self-assigned this Jul 16, 2026
@jmarquisbq jmarquisbq added the Testing Dealing with bug hunting in software label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Testing Dealing with bug hunting in software

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant