mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-01 20:49:44 +00:00
Add VisibilityState/SelectionState tests; test real quantization helpers
test_instanced_geometry previously re-implemented vertex quantization inline, with a stale comment claiming the helpers still lived in ViewportWindow.cpp. They now live in VertexQuantization.h, so route the test through the real quantizeVertex/octEncodeNormal and add coverage for the degenerate-axis path, octahedral normal round-trip, the i8 normal error bound (~0.78 deg worst observed), and color passthrough. Add test_visibility and test_selection: Tier-1 coverage of the two per-object viewport state machines. Both are QObjects for their changed() signal but touch no GL on the construction/mutation path, so the tests exercise the pure CPU logic without a context. Suite goes from 39 to 61 cases. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -50,10 +50,11 @@ add_ifcviewer_unit_test(test_sidecar_cache
|
||||
|
||||
add_ifcviewer_unit_test(test_instanced_geometry)
|
||||
|
||||
# Federation is Qt-derived (QObject + signals + QVector3D + QJson*). Unlike
|
||||
# the other Tier-1 tests it has to pull Qt6::Core/Gui/Test in directly and
|
||||
# enable AUTOMOC for the Q_OBJECT moc-generation.
|
||||
find_package(Qt${QT_VERSION} COMPONENTS Core Gui Test REQUIRED PATHS ${QT_DIR})
|
||||
# Federation, Visibility and Selection are Qt-derived (QObject + signals).
|
||||
# Unlike the other Tier-1 tests they have to pull Qt6 in directly and enable
|
||||
# AUTOMOC for the Q_OBJECT moc-generation. OpenGL is needed only by the
|
||||
# Selection test (Selection.cpp references QOpenGLFunctions_4_5_Core).
|
||||
find_package(Qt${QT_VERSION} COMPONENTS Core Gui Test OpenGL REQUIRED PATHS ${QT_DIR})
|
||||
|
||||
find_package(Eigen3 REQUIRED)
|
||||
|
||||
@@ -81,3 +82,36 @@ target_link_libraries(test_federation PRIVATE
|
||||
IfcParse # Unit.cpp uses express::Base / file APIs
|
||||
)
|
||||
catch_discover_tests(test_federation)
|
||||
|
||||
# VisibilityState / SelectionState are QObjects (for their changed() signal)
|
||||
# but their construction + mutation API touch no GL, so the tests exercise
|
||||
# the pure CPU state machine without ever creating a context. Selection.cpp
|
||||
# still references QOpenGLFunctions_4_5_Core, so test_selection has to link
|
||||
# Qt6::OpenGL even though no GL call is reached at runtime.
|
||||
add_executable(test_visibility
|
||||
test_visibility.cpp
|
||||
${IFCVIEWER_SRC}/Visibility.cpp
|
||||
)
|
||||
set_target_properties(test_visibility PROPERTIES AUTOMOC ON)
|
||||
target_include_directories(test_visibility PRIVATE ${IFCVIEWER_SRC})
|
||||
target_link_libraries(test_visibility PRIVATE
|
||||
Catch2::Catch2WithMain
|
||||
Qt${QT_VERSION}::Core
|
||||
Qt${QT_VERSION}::Test # QSignalSpy
|
||||
)
|
||||
catch_discover_tests(test_visibility)
|
||||
|
||||
add_executable(test_selection
|
||||
test_selection.cpp
|
||||
${IFCVIEWER_SRC}/Selection.cpp
|
||||
)
|
||||
set_target_properties(test_selection PROPERTIES AUTOMOC ON)
|
||||
target_include_directories(test_selection PRIVATE ${IFCVIEWER_SRC})
|
||||
target_link_libraries(test_selection PRIVATE
|
||||
Catch2::Catch2WithMain
|
||||
Qt${QT_VERSION}::Core
|
||||
Qt${QT_VERSION}::Gui # QtOpenGL depends on QtGui
|
||||
Qt${QT_VERSION}::OpenGL # Selection.cpp: QOpenGLFunctions_4_5_Core
|
||||
Qt${QT_VERSION}::Test # QSignalSpy
|
||||
)
|
||||
catch_discover_tests(test_selection)
|
||||
|
||||
Reference in New Issue
Block a user