Warning, /games/libkmahjongg/backgrounds/CompareBackgroundSVGs.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2023 Friedrich W. H. Kossebau <kossebau@kde.org> 0002 # 0003 # SPDX-License-Identifier: BSD-3-Clause 0004 0005 set(id ${ID}) 0006 set(render_tool ${RENDERELEMENT}) 0007 set(rcompare_tool ${COMPARE}) 0008 set(old_file ${OLD_FILE}) 0009 set(new_file ${NEW_FILE}) 0010 set(work_dir "${WORKING_DIR}/${id}/check") 0011 0012 if (NOT EXISTS "${old_file}") 0013 message(FATAL_ERROR "Old file ${old_file} does not exist") 0014 endif() 0015 if (NOT EXISTS "${new_file}") 0016 message(FATAL_ERROR "New file ${new_file} does not exist") 0017 endif() 0018 0019 # ensure working dir 0020 make_directory(${work_dir}) 0021 0022 # generate PNG for original 0023 set(old_png_file "old.png") 0024 execute_process( 0025 COMMAND ${render_tool} ${old_file} "" 200 200 ${old_png_file} 0026 WORKING_DIRECTORY ${work_dir} 0027 ) 0028 # generate PNG for modified 0029 set(new_png_file "new.png") 0030 execute_process( 0031 COMMAND ${render_tool} ${new_file} "" 200 200 ${new_png_file} 0032 WORKING_DIRECTORY ${work_dir} 0033 ) 0034 0035 # compare 0036 execute_process( 0037 COMMAND ${rcompare_tool} 0038 -metric MAE 0039 ${old_png_file} 0040 ${new_png_file} 0041 /dev/null # no use for difference image 0042 WORKING_DIRECTORY ${work_dir} 0043 OUTPUT_VARIABLE compare_output 0044 ERROR_VARIABLE compare_output 0045 ) 0046 string(REGEX MATCH "^[0-9]*(\\.[0-9]*)?" compare_result "${compare_output}") 0047 if("${compare_result}" STRGREATER 0) 0048 message(STATUS "Difference for background ${id}: ${compare_result}") 0049 endif()