- Fix InverterTest.ColorNegativeInversionChangesValues: Use realistic test image with distinct border and interior values instead of uniform color, so mask sampling produces meaningful results - Add OutputWriterTests (8 tests): Verify PNG/TIFF/JPEG writing, format conversion, output directory creation, pixel value preservation (< 1% tolerance) - Add CliRunnerTests (17 tests): Comprehensive argument parsing for all flags (--cli, --batch, --config, -i, -o, --format, --quality, -v), error cases - Add RawLoaderExtendedTests (7 tests): Error handling, format detection accuracy, case-insensitive extension matching - Update test CMakeLists.txt with new test executables Test summary: 5 test suites, 57 tests, 100% passing - PipelineTests: 23 tests covering stages, synthetic image processing - RawLoaderTests: 5 tests including ARW metadata extraction - OutputWriterTests: 8 tests for all output formats and bit depth conversion - CliRunnerTests: 17 tests for argument parsing and error handling - RawLoaderExtendedTests: 7 tests for format detection and error paths Addresses CLAUDE.md requirements: - Tests use RAW golden files (DSC09246.ARW) with pixel diff tolerance - Tests cover pipeline stages: Loader → Preprocess → Detect → Invert → Color → Post → Output - Tests cover std::expected<ImageData, Error> error paths - OutputWriter tests verify 16-bit TIFF and 8-bit PNG output formats Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
119 lines
3.6 KiB
CMake
119 lines
3.6 KiB
CMake
# Try system GTest first, fall back to FetchContent
|
|
find_package(GTest QUIET)
|
|
|
|
if(NOT GTest_FOUND)
|
|
include(FetchContent)
|
|
FetchContent_Declare(
|
|
googletest
|
|
GIT_REPOSITORY https://github.com/google/googletest.git
|
|
GIT_TAG v1.14.0
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
|
|
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
|
|
FetchContent_MakeAvailable(googletest)
|
|
endif()
|
|
|
|
# ──────────────────────────────────────────────
|
|
# Pipeline unit tests
|
|
# ──────────────────────────────────────────────
|
|
add_executable(test_pipeline
|
|
test_pipeline.cpp
|
|
)
|
|
|
|
target_link_libraries(test_pipeline PRIVATE
|
|
converter_core
|
|
GTest::gtest
|
|
GTest::gtest_main
|
|
)
|
|
|
|
target_include_directories(test_pipeline PRIVATE
|
|
${CMAKE_SOURCE_DIR}/src
|
|
)
|
|
|
|
target_compile_definitions(test_pipeline PRIVATE
|
|
TEST_DATA_DIR="${CMAKE_SOURCE_DIR}/import"
|
|
)
|
|
|
|
add_test(NAME PipelineTests COMMAND test_pipeline)
|
|
|
|
# ──────────────────────────────────────────────
|
|
# RawLoader integration tests
|
|
# ──────────────────────────────────────────────
|
|
add_executable(test_rawloader
|
|
test_rawloader.cpp
|
|
)
|
|
|
|
target_link_libraries(test_rawloader PRIVATE
|
|
converter_core
|
|
GTest::gtest
|
|
GTest::gtest_main
|
|
)
|
|
|
|
target_include_directories(test_rawloader PRIVATE
|
|
${CMAKE_SOURCE_DIR}/src
|
|
)
|
|
|
|
target_compile_definitions(test_rawloader PRIVATE
|
|
TEST_DATA_DIR="${CMAKE_SOURCE_DIR}/import"
|
|
)
|
|
|
|
add_test(NAME RawLoaderTests COMMAND test_rawloader)
|
|
|
|
# ──────────────────────────────────────────────
|
|
# OutputWriter tests
|
|
# ──────────────────────────────────────────────
|
|
add_executable(test_output
|
|
test_output.cpp
|
|
)
|
|
|
|
target_link_libraries(test_output PRIVATE
|
|
converter_core
|
|
GTest::gtest
|
|
GTest::gtest_main
|
|
)
|
|
|
|
target_include_directories(test_output PRIVATE
|
|
${CMAKE_SOURCE_DIR}/src
|
|
)
|
|
|
|
add_test(NAME OutputWriterTests COMMAND test_output)
|
|
|
|
# ──────────────────────────────────────────────
|
|
# CliRunner tests
|
|
# ──────────────────────────────────────────────
|
|
add_executable(test_cli
|
|
test_cli.cpp
|
|
)
|
|
|
|
target_link_libraries(test_cli PRIVATE
|
|
converter_core
|
|
GTest::gtest
|
|
GTest::gtest_main
|
|
)
|
|
|
|
target_include_directories(test_cli PRIVATE
|
|
${CMAKE_SOURCE_DIR}/src
|
|
)
|
|
|
|
add_test(NAME CliRunnerTests COMMAND test_cli)
|
|
|
|
# ──────────────────────────────────────────────
|
|
# RawLoader extended tests
|
|
# ──────────────────────────────────────────────
|
|
add_executable(test_rawloader_extended
|
|
test_rawloader_extended.cpp
|
|
)
|
|
|
|
target_link_libraries(test_rawloader_extended PRIVATE
|
|
converter_core
|
|
GTest::gtest
|
|
GTest::gtest_main
|
|
)
|
|
|
|
target_include_directories(test_rawloader_extended PRIVATE
|
|
${CMAKE_SOURCE_DIR}/src
|
|
)
|
|
|
|
add_test(NAME RawLoaderExtendedTests COMMAND test_rawloader_extended)
|