mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 00:52:04 +00:00
Fix unit tests (#11199)
* Fix tests build issue on Windows * Fix `Http digest authentication` 404 error * Fix `libnest2d_tests` missing dlls on Windows
This commit is contained in:
@@ -99,9 +99,6 @@ if(ORCA_TOOLS)
|
|||||||
endif()
|
endif()
|
||||||
target_link_libraries(OrcaSlicer_profile_validator libslic3r boost_headeronly libcurl OpenSSL::SSL OpenSSL::Crypto)
|
target_link_libraries(OrcaSlicer_profile_validator libslic3r boost_headeronly libcurl OpenSSL::SSL OpenSSL::Crypto)
|
||||||
target_compile_definitions(OrcaSlicer_profile_validator PRIVATE -DBOOST_ALL_NO_LIB -DBOOST_USE_WINAPI_VERSION=0x602 -DBOOST_SYSTEM_USE_UTF8)
|
target_compile_definitions(OrcaSlicer_profile_validator PRIVATE -DBOOST_ALL_NO_LIB -DBOOST_USE_WINAPI_VERSION=0x602 -DBOOST_SYSTEM_USE_UTF8)
|
||||||
if(WIN32)
|
|
||||||
target_link_libraries(OrcaSlicer_profile_validator bcrypt.lib)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Create a slic3r executable
|
# Create a slic3r executable
|
||||||
@@ -110,7 +107,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/msw/OrcaSlicer.rc.
|
|||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/msw/OrcaSlicer.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/OrcaSlicer.manifest @ONLY)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/msw/OrcaSlicer.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/OrcaSlicer.manifest @ONLY)
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/osx/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/osx/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY)
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
add_library(OrcaSlicer SHARED OrcaSlicer.cpp OrcaSlicer.hpp dev-utils/BaseException.cpp dev-utils/BaseException.h dev-utils/StackWalker.cpp dev-utils/StackWalker.h)
|
add_library(OrcaSlicer SHARED OrcaSlicer.cpp OrcaSlicer.hpp)
|
||||||
else ()
|
else ()
|
||||||
add_executable(OrcaSlicer OrcaSlicer.cpp OrcaSlicer.hpp)
|
add_executable(OrcaSlicer OrcaSlicer.cpp OrcaSlicer.hpp)
|
||||||
endif ()
|
endif ()
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ BOOL CBaseException::GetLogicalAddress(
|
|||||||
for (unsigned i = 0; i < pNtHdr->FileHeader.NumberOfSections; i++, pSection++ )
|
for (unsigned i = 0; i < pNtHdr->FileHeader.NumberOfSections; i++, pSection++ )
|
||||||
{
|
{
|
||||||
DWORD sectionStart = pSection->VirtualAddress;
|
DWORD sectionStart = pSection->VirtualAddress;
|
||||||
DWORD sectionEnd = sectionStart + max(pSection->SizeOfRawData, pSection->Misc.VirtualSize);
|
DWORD sectionEnd = sectionStart + std::max(pSection->SizeOfRawData, pSection->Misc.VirtualSize);
|
||||||
|
|
||||||
if ( (rva >= sectionStart) && (rva <= sectionEnd) )
|
if ( (rva >= sectionStart) && (rva <= sectionEnd) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -591,12 +591,12 @@ target_link_libraries(libslic3r
|
|||||||
TBB::tbb
|
TBB::tbb
|
||||||
TBB::tbbmalloc
|
TBB::tbbmalloc
|
||||||
ZLIB::ZLIB
|
ZLIB::ZLIB
|
||||||
|
OpenSSL::Crypto
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
# Link freetype for OCCT dependency (CAD operations need font rendering)
|
# Link freetype for OCCT dependency (CAD operations need font rendering)
|
||||||
target_link_libraries(libslic3r PRIVATE ${FREETYPE_LIBRARIES})
|
target_link_libraries(libslic3r PRIVATE ${FREETYPE_LIBRARIES})
|
||||||
target_link_libraries(libslic3r PRIVATE OpenSSL::Crypto)
|
|
||||||
if (NOT APPLE)
|
if (NOT APPLE)
|
||||||
target_link_libraries(libslic3r PRIVATE fontconfig)
|
target_link_libraries(libslic3r PRIVATE fontconfig)
|
||||||
endif()
|
endif()
|
||||||
@@ -613,7 +613,7 @@ if (TARGET OpenVDB::openvdb)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(libslic3r PRIVATE Psapi.lib)
|
target_link_libraries(libslic3r PRIVATE Psapi.lib bcrypt.lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SLIC3R_PROFILE)
|
if(SLIC3R_PROFILE)
|
||||||
|
|||||||
@@ -675,7 +675,17 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/GeneratedConfig.hpp.in
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/GeneratedConfig.hpp
|
${CMAKE_CURRENT_BINARY_DIR}/GeneratedConfig.hpp
|
||||||
@ONLY)
|
@ONLY)
|
||||||
|
|
||||||
add_library(libslic3r_gui STATIC ${SLIC3R_GUI_SOURCES})
|
if (WIN32)
|
||||||
|
add_library(libslic3r_gui STATIC
|
||||||
|
${SLIC3R_GUI_SOURCES}
|
||||||
|
../dev-utils/BaseException.cpp
|
||||||
|
../dev-utils/BaseException.h
|
||||||
|
../dev-utils/StackWalker.cpp
|
||||||
|
../dev-utils/StackWalker.h
|
||||||
|
)
|
||||||
|
else ()
|
||||||
|
add_library(libslic3r_gui STATIC ${SLIC3R_GUI_SOURCES})
|
||||||
|
endif ()
|
||||||
target_include_directories(libslic3r_gui PRIVATE Utils ${CMAKE_CURRENT_BINARY_DIR})
|
target_include_directories(libslic3r_gui PRIVATE Utils ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
#ifdef WIN32
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
#ifndef NOMINMAX
|
||||||
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
#include "libslic3r/libslic3r.h"
|
#include "libslic3r/libslic3r.h"
|
||||||
|
|||||||
@@ -3,5 +3,15 @@ add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests_main.cpp printer_parts.cp
|
|||||||
target_link_libraries(${_TEST_NAME}_tests test_common libnest2d )
|
target_link_libraries(${_TEST_NAME}_tests test_common libnest2d )
|
||||||
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
|
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||||
|
orcaslicer_copy_dlls(COPY_DLLS "Debug" "d" output_dlls_Debug)
|
||||||
|
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
||||||
|
orcaslicer_copy_dlls(COPY_DLLS "RelWithDebInfo" "" output_dlls_Release)
|
||||||
|
else()
|
||||||
|
orcaslicer_copy_dlls(COPY_DLLS "Release" "" output_dlls_Release)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
|
catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
|
||||||
# add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests "${CATCH_EXTRA_ARGS} exclude:[NotWorking]")
|
# add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests "${CATCH_EXTRA_ARGS} exclude:[NotWorking]")
|
||||||
|
|||||||
@@ -489,7 +489,7 @@ static constexpr float gsizef = 100.0; // grid size in mm (box volume side leng
|
|||||||
static constexpr float wsizef = 0.50; // grid window size in mm (roughly line segment length).
|
static constexpr float wsizef = 0.50; // grid window size in mm (roughly line segment length).
|
||||||
static constexpr float psizef = 0.01; // raster pixel size in mm (roughly point accuracy).
|
static constexpr float psizef = 0.01; // raster pixel size in mm (roughly point accuracy).
|
||||||
static constexpr float isoval = 0.0; // iso value threshold to use.
|
static constexpr float isoval = 0.0; // iso value threshold to use.
|
||||||
static constexpr size_t wsize = std::round(wsizef / psizef);
|
static const long wsize = std::round(wsizef / psizef);
|
||||||
|
|
||||||
static float period = 10.0; // gyroid "wavelength" in mm (2x line spacing).
|
static float period = 10.0; // gyroid "wavelength" in mm (2x line spacing).
|
||||||
static float freq = 2 * PI / period; // gyroid frequency in waves per mm.
|
static float freq = 2 * PI / period; // gyroid frequency in waves per mm.
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ TEST_CASE("Check SSL certificates paths", "[Http][NotWorking]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Http digest authentication", "[Http][NotWorking]") {
|
TEST_CASE("Http digest authentication", "[Http][NotWorking]") {
|
||||||
Slic3r::Http g = Slic3r::Http::get("https://httpbin.org/digest-auth/guest/guest");
|
Slic3r::Http g = Slic3r::Http::get("https://httpbin.org/digest-auth/auth/guest/guest");
|
||||||
|
|
||||||
g.auth_digest("guest", "guest");
|
g.auth_digest("guest", "guest");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user