Ensure all QA tests on windows use a manifest

We want UTF8 mode enabled via manifest for accurate behavior that matches the application
This commit is contained in:
Marek Roszko 2022-08-08 21:25:31 -04:00
parent 28179296db
commit 8fd524aec1
12 changed files with 124 additions and 12 deletions

View File

@ -21,7 +21,7 @@
find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml stc REQUIRED )
set( common_srcs
set( QA_COMMON_SRCS
# This is needed for the global mock objects
${CMAKE_SOURCE_DIR}/qa/mocks/kicad/common_mocks.cpp
@ -54,7 +54,7 @@ set( common_srcs
view/test_zoom_controller.cpp
)
set( common_libs
set( QA_COMMON_LIBS
common
libcontext
gal
@ -62,10 +62,23 @@ set( common_libs
${wxWidgets_LIBRARIES}
)
if( WIN32 )
# We want to declare a resource manifest on Windows to enable UTF8 mode
# Without UTF8 mode, some random IO tests may fail, we set the active code page on normal kicad to UTF8 as well
if( MINGW )
# QA_COMMON_RESOURCES variable is set by the macro.
mingw_resource_compiler( qa_common )
else()
set( QA_COMMON_RESOURCES ${CMAKE_SOURCE_DIR}/resources/msw/qa_common.rc )
endif()
endif()
# Test executable for non-program-specific code
add_executable( qa_common ${common_srcs} )
target_link_libraries( qa_common ${common_libs} )
add_executable( qa_common
${QA_COMMON_SRCS}
${QA_COMMON_RESOURCES} )
target_link_libraries( qa_common ${QA_COMMON_LIBS} )
include_directories(
${CMAKE_SOURCE_DIR}

View File

@ -94,8 +94,20 @@ if( KICAD_SPICE )
)
endif()
if( WIN32 )
# We want to declare a resource manifest on Windows to enable UTF8 mode
# Without UTF8 mode, some random IO tests may fail, we set the active code page on normal kicad to UTF8 as well
if( MINGW )
# QA_EESCHEMA_RESOURCES variable is set by the macro.
mingw_resource_compiler( qa_eeschema )
else()
set( QA_EESCHEMA_RESOURCES ${CMAKE_SOURCE_DIR}/resources/msw/qa_eeschema.rc )
endif()
endif()
add_executable( qa_eeschema
${QA_EESCHEMA_SRCS}
${QA_EESCHEMA_RESOURCES}
)
target_link_libraries( qa_eeschema

View File

@ -28,13 +28,20 @@ set( QA_GERBVIEW_SRCS
${CMAKE_SOURCE_DIR}/qa/unittests/common/test_format_units.cpp
)
if( WIN32 )
# We want to declare a resource manifest on Windows to enable UTF8 mode
# Without UTF8 mode, some random IO tests may fail, we set the active code page on normal kicad to UTF8 as well
if( MINGW )
# QA_GERBVIEW_RESOURCES variable is set by the macro.
mingw_resource_compiler( qa_gerbview )
else()
set( QA_GERBVIEW_RESOURCES ${CMAKE_SOURCE_DIR}/resources/msw/qa_gerbview.rc )
endif()
endif()
add_executable( qa_gerbview
${QA_GERBVIEW_SRCS}
# In order to enable this, the actual Gerbview kiface build must be updated to match pcbnew's
# Older CMakes cannot link OBJECT libraries
# https://cmake.org/pipermail/cmake/2013-November/056263.html
$<TARGET_OBJECTS:gerbview_kiface_objects>
${QA_GERBVIEW_RESOURCES}
)
# Gerbview tests, so pretend to be gerbview (for units, etc)
@ -52,6 +59,7 @@ target_include_directories( qa_gerbview PRIVATE
add_dependencies( qa_gerbview gerbview )
target_link_libraries( qa_gerbview
gerbview_kiface_objects
pcbcommon
gal
common

View File

@ -22,7 +22,7 @@
#
# Unit tests for KiCad math routines.
set( KIMATH_SRCS
set( QA_KIMATH_SRCS
kimath_test_module.cpp
test_kimath.cpp
@ -43,7 +43,21 @@ set( KIMATH_SRCS
math/test_util.cpp
)
add_executable( qa_kimath ${KIMATH_SRCS} )
if( WIN32 )
# We want to declare a resource manifest on Windows to enable UTF8 mode
# Without UTF8 mode, some random IO tests may fail, we set the active code page on normal kicad to UTF8 as well
if( MINGW )
# QA_KIMATH_RESOURCES variable is set by the macro.
mingw_resource_compiler( qa_kimath )
else()
set( QA_KIMATH_RESOURCES ${CMAKE_SOURCE_DIR}/resources/msw/qa_kimath.rc )
endif()
endif()
add_executable( qa_kimath
${QA_KIMATH_SRCS}
${QA_KIMATH_RESOURCES}
)
target_link_libraries( qa_kimath
qa_utils

View File

@ -55,8 +55,20 @@ set( QA_PCBNEW_SRCS
group_saveload.cpp
)
if( WIN32 )
# We want to declare a resource manifest on Windows to enable UTF8 mode
# Without UTF8 mode, some random IO tests may fail, we set the active code page on normal kicad to UTF8 as well
if( MINGW )
# QA_PCBNEW_RESOURCES variable is set by the macro.
mingw_resource_compiler( qa_pcbnew )
else()
set( QA_PCBNEW_RESOURCES ${CMAKE_SOURCE_DIR}/resources/msw/qa_pcbnew.rc )
endif()
endif()
add_executable( qa_pcbnew
${QA_PCBNEW_SRCS}
${QA_PCBNEW_RESOURCES}
)
# Pcbnew tests, so pretend to be pcbnew (for units, etc)

View File

@ -35,7 +35,20 @@ if( MINGW )
list( APPEND K2S_TEST_SRCS ${CMAKE_SOURCE_DIR}/common/streamwrapper.cpp )
endif( MINGW )
add_executable( qa_kicad2step ${K2S_TEST_SRCS} )
if( WIN32 )
# We want to declare a resource manifest on Windows to enable UTF8 mode
# Without UTF8 mode, some random IO tests may fail, we set the active code page on normal kicad to UTF8 as well
if( MINGW )
# QA_KICAD2STEP_RESOURCES variable is set by the macro.
mingw_resource_compiler( qa_kicad2step )
else()
set( QA_KICAD2STEP_RESOURCES ${CMAKE_SOURCE_DIR}/resources/msw/qa_kicad2step.rc )
endif()
endif()
add_executable( qa_kicad2step
${K2S_TEST_SRCS}
${QA_KICAD2STEP_RESOURCES} )
target_link_libraries( qa_kicad2step
kicad2step_lib

View File

@ -0,0 +1,7 @@
icon_qa_common ICON "../resources/bitmaps_png/icons/icon_kicad.ico"
#define RC_VER_FILE_DESCRIPTION "KiCad QA Common " KICAD_WIN32_RC_PRODVER_STR
#define RC_VER_INTERNALNAME "qa_common"
#define RC_VER_ORIGINALFILENAME "qa_common.exe"
#include "kiwin32.rc"

View File

@ -0,0 +1,7 @@
icon_qa_eeschema ICON "../resources/bitmaps_png/icons/icon_eeschema.ico"
#define RC_VER_FILE_DESCRIPTION "KiCad QA Schematic Editor " KICAD_WIN32_RC_PRODVER_STR
#define RC_VER_INTERNALNAME "qa_eeschema"
#define RC_VER_ORIGINALFILENAME "qa_eeschema.exe"
#include "kiwin32.rc"

View File

@ -0,0 +1,6 @@
icon_qa_gerbview ICON "../resources/bitmaps_png/icons/icon_gerbview.ico"
#define RC_VER_FILE_DESCRIPTION "QA Gerber Viewer " KICAD_WIN32_RC_PRODVER_STR
#define RC_VER_INTERNALNAME "qa_gerbview"
#define RC_VER_ORIGINALFILENAME "qa_gerbview.exe"
#include "kiwin32.rc"

View File

@ -0,0 +1,7 @@
icon_qa_kicad2step ICON "../resources/bitmaps_png/icons/icon_kicad.ico"
#define RC_VER_FILE_DESCRIPTION "QA KiCad2Step " KICAD_WIN32_RC_PRODVER_STR
#define RC_VER_INTERNALNAME "qa_kicad2step"
#define RC_VER_ORIGINALFILENAME "qa_kicad2step.exe"
#include "kiwin32.rc"

View File

@ -0,0 +1,7 @@
icon_qa_common ICON "../resources/bitmaps_png/icons/icon_kicad.ico"
#define RC_VER_FILE_DESCRIPTION "KiCad QA KiMath " KICAD_WIN32_RC_PRODVER_STR
#define RC_VER_INTERNALNAME "qa_kimath"
#define RC_VER_ORIGINALFILENAME "qa_kimath.exe"
#include "kiwin32.rc"

View File

@ -0,0 +1,6 @@
icon_qa_pcbnew ICON "../resources/bitmaps_png/icons/icon_pcbnew.ico"
#define RC_VER_FILE_DESCRIPTION "KiCad QA PCB Editor " KICAD_WIN32_RC_PRODVER_STR
#define RC_VER_INTERNALNAME "qa_pcbnew"
#define RC_VER_ORIGINALFILENAME "qa_pcbnew.exe"
#include "kiwin32.rc"