ifcviewer: tests for the new viewing features (fly, x-ray, visibility)

Coverage had lagged the recent feature work. Add both layers:

- test_viewport_camera (Catch2, headless): constructs ViewportCore with a mock
  ViewportHost — construction/teardown touch no GPU (the wgpu teardown lives in
  releaseWgpuModelGpuData, only reached with models loaded), and the camera ops
  are pure — so it unit-tests the SHARED fly math fast and deterministically:
  flyMove (forward step, 5x boost, opposing-key cancel, dt clamp, QE along +Z,
  degenerate-pitch stays finite), flyLook (turn-in-place pins the eye, pitch
  clamp), flyAdjustSpeed (x1.25/notch, [0.05,1000] clamp), toggleXray, and
  hideSelected/showAll. Links the built IfcViewerCore (ViewportCore.cpp is the
  monster TU that can't compile standalone). +9 cases → 122 desktop.

- smoke.spec.mjs (Playwright): fly (enter → W moves the camera → Esc exits),
  x-ray (toggle translucency on/off), and hide-after-pick, driving the exported
  C hooks end-to-end. +3 cases → 9 web.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-07-02 16:23:30 +10:00
parent 68d6280c93
commit 4faae025b4
3 changed files with 246 additions and 0 deletions
+14
View File
@@ -126,6 +126,20 @@ if(UNIX AND NOT APPLE AND WGPU_NATIVE_LIB_DIR)
)
endif()
# ViewportCore camera + visibility ops (fly math, x-ray, hide/show-all), the
# math shared verbatim by desktop + web. ViewportCore.cpp is the monster TU that
# can't compile standalone, so link the built IfcViewerCore lib; a mock
# ViewportHost stands in for the window, and no GPU is created (construction /
# teardown / the tested ops touch no wgpu).
add_ifcviewer_unit_test(test_viewport_camera
LIBS IfcViewerCore Eigen3::Eigen
)
if(UNIX AND NOT APPLE AND WGPU_NATIVE_LIB_DIR)
set_target_properties(test_viewport_camera PROPERTIES
BUILD_RPATH "${WGPU_NATIVE_LIB_DIR}"
)
endif()
# Federation is Qt-derived (QObject + signals). It has to pull Qt6 in
# directly and enable AUTOMOC for the Q_OBJECT moc-generation.
find_package(Qt${QT_VERSION} COMPONENTS Core Gui Test REQUIRED PATHS ${QT_DIR})