Reject non-finite CLI float inputs
This commit is contained in:
@@ -329,6 +329,15 @@ if(TARGET pano_cli)
|
||||
set_tests_properties(pano_cli_save_project_payload_roundtrip_smoke PROPERTIES
|
||||
LABELS "assets;document;integration;desktop-fast")
|
||||
|
||||
add_test(NAME pano_cli_save_project_rejects_non_finite_opacity
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-DPANO_CLI=$<TARGET_FILE:pano_cli>
|
||||
-DOUTPUT_PATH=${CMAKE_CURRENT_BINARY_DIR}/data/generated/rejected-non-finite-opacity.ppi
|
||||
"-DEXPECTED_OUTPUT=floating-point value must be finite"
|
||||
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/expect_pano_cli_save_project_failure.cmake")
|
||||
set_tests_properties(pano_cli_save_project_rejects_non_finite_opacity PROPERTIES
|
||||
LABELS "assets;document;integration;desktop-fast;fuzz")
|
||||
|
||||
add_test(NAME pano_cli_save_document_project_roundtrip_smoke
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-DPANO_CLI=$<TARGET_FILE:pano_cli>
|
||||
|
||||
36
tests/cmake/expect_pano_cli_save_project_failure.cmake
Normal file
36
tests/cmake/expect_pano_cli_save_project_failure.cmake
Normal file
@@ -0,0 +1,36 @@
|
||||
if(NOT DEFINED PANO_CLI)
|
||||
message(FATAL_ERROR "PANO_CLI is required")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED OUTPUT_PATH)
|
||||
message(FATAL_ERROR "OUTPUT_PATH is required")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED EXPECTED_OUTPUT)
|
||||
message(FATAL_ERROR "EXPECTED_OUTPUT is required")
|
||||
endif()
|
||||
|
||||
file(REMOVE "${OUTPUT_PATH}")
|
||||
|
||||
execute_process(
|
||||
COMMAND "${PANO_CLI}" save-project
|
||||
--path "${OUTPUT_PATH}"
|
||||
--width 64
|
||||
--height 32
|
||||
--layer-opacity nan
|
||||
RESULT_VARIABLE save_result
|
||||
OUTPUT_VARIABLE save_output
|
||||
ERROR_VARIABLE save_error)
|
||||
|
||||
if(save_result EQUAL 0)
|
||||
message(FATAL_ERROR "save-project unexpectedly succeeded: ${save_output}${save_error}")
|
||||
endif()
|
||||
|
||||
string(FIND "${save_output}${save_error}" "${EXPECTED_OUTPUT}" expected_index)
|
||||
if(expected_index EQUAL -1)
|
||||
message(FATAL_ERROR "save-project failure did not contain expected output: ${save_output}${save_error}")
|
||||
endif()
|
||||
|
||||
if(EXISTS "${OUTPUT_PATH}")
|
||||
message(FATAL_ERROR "save-project created output despite rejected inputs: ${OUTPUT_PATH}")
|
||||
endif()
|
||||
Reference in New Issue
Block a user