mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-01 12:51:12 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a493c3c80f |
@@ -1301,54 +1301,6 @@ if (WIN32)
|
|||||||
endif()
|
endif()
|
||||||
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
|
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
|
||||||
include(InstallRequiredSystemLibraries)
|
include(InstallRequiredSystemLibraries)
|
||||||
|
|
||||||
# CMake 3.31 does not recognize the v145 toolset shipped with VS 2026.
|
|
||||||
# The Windows ARM64 build is pinned to CMake 3.31 for its assembler
|
|
||||||
# support, so the runtime collector can leave this list without the CRT.
|
|
||||||
# Pick up the target-architecture redistributable directly in that case.
|
|
||||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
|
|
||||||
set(_orca_has_msvcp140 FALSE)
|
|
||||||
set(_orca_has_vcruntime140 FALSE)
|
|
||||||
foreach (_runtime IN LISTS CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
|
|
||||||
get_filename_component(_runtime_name "${_runtime}" NAME)
|
|
||||||
if (_runtime_name STREQUAL "msvcp140.dll")
|
|
||||||
set(_orca_has_msvcp140 TRUE)
|
|
||||||
elseif (_runtime_name STREQUAL "vcruntime140.dll")
|
|
||||||
set(_orca_has_vcruntime140 TRUE)
|
|
||||||
endif ()
|
|
||||||
endforeach ()
|
|
||||||
|
|
||||||
if (NOT _orca_has_msvcp140 OR NOT _orca_has_vcruntime140)
|
|
||||||
file(GLOB _orca_arm64_crt_dirs
|
|
||||||
"$ENV{ProgramFiles}/Microsoft Visual Studio/*/*/VC/Redist/MSVC/*/arm64/Microsoft.VC*.CRT")
|
|
||||||
if (NOT _orca_arm64_crt_dirs)
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"CMake did not collect the ARM64 MSVC runtime, and no ARM64 CRT redistributable directory was found.")
|
|
||||||
endif ()
|
|
||||||
# Multiple Visual Studio servicing versions can coexist; take the
|
|
||||||
# newest matching redistributable directory.
|
|
||||||
list(SORT _orca_arm64_crt_dirs ORDER DESCENDING)
|
|
||||||
list(GET _orca_arm64_crt_dirs 0 _orca_arm64_crt_dir)
|
|
||||||
file(GLOB _orca_arm64_crt_dlls "${_orca_arm64_crt_dir}/*.dll")
|
|
||||||
list(APPEND CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${_orca_arm64_crt_dlls})
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Catch a bad VS layout or an incomplete redistributable before CPack
|
|
||||||
# can silently emit an installer that fails on a clean ARM64 machine.
|
|
||||||
set(_orca_has_msvcp140 FALSE)
|
|
||||||
set(_orca_has_vcruntime140 FALSE)
|
|
||||||
foreach (_runtime IN LISTS CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
|
|
||||||
get_filename_component(_runtime_name "${_runtime}" NAME)
|
|
||||||
if (_runtime_name STREQUAL "msvcp140.dll")
|
|
||||||
set(_orca_has_msvcp140 TRUE)
|
|
||||||
elseif (_runtime_name STREQUAL "vcruntime140.dll")
|
|
||||||
set(_orca_has_vcruntime140 TRUE)
|
|
||||||
endif ()
|
|
||||||
endforeach ()
|
|
||||||
if (NOT _orca_has_msvcp140 OR NOT _orca_has_vcruntime140)
|
|
||||||
message(FATAL_ERROR "The ARM64 installer must contain msvcp140.dll and vcruntime140.dll.")
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
install (PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ".")
|
install (PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ".")
|
||||||
elseif (SLIC3R_FHS)
|
elseif (SLIC3R_FHS)
|
||||||
# CMAKE_INSTALL_FULL_DATAROOTDIR: read-only architecture-independent data root (share)
|
# CMAKE_INSTALL_FULL_DATAROOTDIR: read-only architecture-independent data root (share)
|
||||||
|
|||||||
Vendored
+1
-11
@@ -151,12 +151,6 @@ elseif(APPLE)
|
|||||||
# the post-install -add_rpath below.
|
# the post-install -add_rpath below.
|
||||||
set(_python_ldflags "${_python_arch_flags} -Wl,-headerpad_max_install_names")
|
set(_python_ldflags "${_python_arch_flags} -Wl,-headerpad_max_install_names")
|
||||||
|
|
||||||
# The macOS 27 SDK declares pipe2() and dup3() as available from macOS 27, so
|
|
||||||
# configure finds them and CPython 3.12 calls them without a runtime check.
|
|
||||||
# Below a macOS 27 deployment target they are weak-linked and resolve to NULL
|
|
||||||
# on older systems, where os.pipe() then segfaults -- in `make install`
|
|
||||||
# (compileall, ensurepip) and in the shipped app alike. Every configure below
|
|
||||||
# keeps the pipe()/dup2() fallbacks (python/cpython#153711).
|
|
||||||
if(IS_CROSS_COMPILE)
|
if(IS_CROSS_COMPILE)
|
||||||
set(_python_build_tgt --build=${_python_build_arch}-apple-darwin --host=${_python_host_arch}-apple-darwin)
|
set(_python_build_tgt --build=${_python_build_arch}-apple-darwin --host=${_python_host_arch}-apple-darwin)
|
||||||
set(_python_build_arch_flags "-arch ${_python_build_arch_flag} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
set(_python_build_arch_flags "-arch ${_python_build_arch_flag} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||||
@@ -180,8 +174,7 @@ elseif(APPLE)
|
|||||||
--enable-shared \
|
--enable-shared \
|
||||||
--without-static-libpython \
|
--without-static-libpython \
|
||||||
--disable-test-modules \
|
--disable-test-modules \
|
||||||
--build=${_python_build_arch}-apple-darwin \
|
--build=${_python_build_arch}-apple-darwin && \
|
||||||
ac_cv_func_pipe2=no ac_cv_func_dup3=no && \
|
|
||||||
make -j${NPROC} python && \
|
make -j${NPROC} python && \
|
||||||
cd '<SOURCE_DIR>' && \
|
cd '<SOURCE_DIR>' && \
|
||||||
env \
|
env \
|
||||||
@@ -198,7 +191,6 @@ elseif(APPLE)
|
|||||||
--without-static-libpython \
|
--without-static-libpython \
|
||||||
--with-openssl='${DESTDIR}' \
|
--with-openssl='${DESTDIR}' \
|
||||||
--disable-test-modules \
|
--disable-test-modules \
|
||||||
ac_cv_func_pipe2=no ac_cv_func_dup3=no \
|
|
||||||
${_python_build_tgt} \
|
${_python_build_tgt} \
|
||||||
--with-build-python='${_python_build_python}' \
|
--with-build-python='${_python_build_python}' \
|
||||||
py_cv_module__tkinter=n/a"
|
py_cv_module__tkinter=n/a"
|
||||||
@@ -221,8 +213,6 @@ elseif(APPLE)
|
|||||||
--with-openssl=${DESTDIR}
|
--with-openssl=${DESTDIR}
|
||||||
--disable-test-modules
|
--disable-test-modules
|
||||||
${_python_build_tgt}
|
${_python_build_tgt}
|
||||||
ac_cv_func_pipe2=no
|
|
||||||
ac_cv_func_dup3=no
|
|
||||||
# Tcl/Tk 9.0 (e.g. from Homebrew) is incompatible with CPython 3.12's
|
# Tcl/Tk 9.0 (e.g. from Homebrew) is incompatible with CPython 3.12's
|
||||||
# _tkinter; OrcaSlicer's embedded Python does not need tkinter anyway.
|
# _tkinter; OrcaSlicer's embedded Python does not need tkinter anyway.
|
||||||
py_cv_module__tkinter=n/a
|
py_cv_module__tkinter=n/a
|
||||||
|
|||||||
@@ -1692,9 +1692,9 @@ void Layer::make_ironing()
|
|||||||
ironing_params.just_infill = false;
|
ironing_params.just_infill = false;
|
||||||
// ORCA: Get filament-specific overrides if configured, otherwise use process values
|
// ORCA: Get filament-specific overrides if configured, otherwise use process values
|
||||||
size_t extruder_idx = ironing_params.extruder - 1;
|
size_t extruder_idx = ironing_params.extruder - 1;
|
||||||
ironing_params.line_spacing = std::max(IRONING_SPACING_MIN, !config.filament_ironing_spacing.is_nil(extruder_idx)
|
ironing_params.line_spacing = (!config.filament_ironing_spacing.is_nil(extruder_idx)
|
||||||
? config.filament_ironing_spacing.get_at(extruder_idx)
|
? config.filament_ironing_spacing.get_at(extruder_idx)
|
||||||
: config.ironing_spacing.value);
|
: config.ironing_spacing);
|
||||||
ironing_params.inset = (!config.filament_ironing_inset.is_nil(extruder_idx)
|
ironing_params.inset = (!config.filament_ironing_inset.is_nil(extruder_idx)
|
||||||
? config.filament_ironing_inset.get_at(extruder_idx)
|
? config.filament_ironing_inset.get_at(extruder_idx)
|
||||||
: config.ironing_inset);
|
: config.ironing_inset);
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ void FillConcentric::_fill_surface_single(
|
|||||||
|
|
||||||
coord_t min_spacing = scale_(this->spacing) * params.multiline;
|
coord_t min_spacing = scale_(this->spacing) * params.multiline;
|
||||||
coord_t distance = coord_t(min_spacing / params.density);
|
coord_t distance = coord_t(min_spacing / params.density);
|
||||||
// A non-positive step never shrinks the region, so the inset loop below would not end.
|
|
||||||
if (min_spacing <= 0 || distance <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (params.density > 0.9999f && !params.dont_adjust) {
|
if (params.density > 0.9999f && !params.dont_adjust) {
|
||||||
distance = this->_adjust_solid_spacing(bounding_box.size()(0), distance);
|
distance = this->_adjust_solid_spacing(bounding_box.size()(0), distance);
|
||||||
@@ -111,8 +108,6 @@ void FillConcentric::_fill_surface_single(const FillParams& params,
|
|||||||
// no rotation is supported for this infill pattern
|
// no rotation is supported for this infill pattern
|
||||||
Point bbox_size = expolygon.contour.bounding_box().size();
|
Point bbox_size = expolygon.contour.bounding_box().size();
|
||||||
coord_t min_spacing = scaled<coord_t>(this->spacing);
|
coord_t min_spacing = scaled<coord_t>(this->spacing);
|
||||||
if (min_spacing <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (params.density > 0.9999f && !params.dont_adjust) {
|
if (params.density > 0.9999f && !params.dont_adjust) {
|
||||||
coord_t loops_count = std::max(bbox_size.x(), bbox_size.y()) / min_spacing + 1;
|
coord_t loops_count = std::max(bbox_size.x(), bbox_size.y()) / min_spacing + 1;
|
||||||
|
|||||||
@@ -180,10 +180,6 @@ enum class IroningType {
|
|||||||
Count,
|
Count,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Smallest usable ironing line spacing. Anything tighter yields an unprintable number of lines,
|
|
||||||
// and zero stops the fillers from making progress.
|
|
||||||
constexpr double IRONING_SPACING_MIN = 0.05;
|
|
||||||
|
|
||||||
//BBS
|
//BBS
|
||||||
enum class WallInfillOrder {
|
enum class WallInfillOrder {
|
||||||
InnerOuterInfill,
|
InnerOuterInfill,
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ struct SupportParameters {
|
|||||||
|
|
||||||
this->ironing = object_config.support_ironing;
|
this->ironing = object_config.support_ironing;
|
||||||
this->ironing_flow = support_material_interface_flow.with_height(support_material_interface_flow.height() * 0.01 * object_config.support_ironing_flow.value);
|
this->ironing_flow = support_material_interface_flow.with_height(support_material_interface_flow.height() * 0.01 * object_config.support_ironing_flow.value);
|
||||||
this->ironing_spacing = std::max(IRONING_SPACING_MIN, object_config.support_ironing_spacing.value);
|
this->ironing_spacing = object_config.support_ironing_spacing;
|
||||||
this->ironing_pattern = object_config.support_ironing_pattern;
|
this->ironing_pattern = object_config.support_ironing_pattern;
|
||||||
|
|
||||||
// Calculate a minimum support layer height as a minimum over all extruders, but not smaller than 10um.
|
// Calculate a minimum support layer height as a minimum over all extruders, but not smaller than 10um.
|
||||||
|
|||||||
@@ -212,30 +212,6 @@ void ConfigManipulation::check_filament_max_volumetric_speed(DynamicPrintConfig
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigManipulation::check_filament_ironing_spacing(DynamicPrintConfig *config)
|
|
||||||
{
|
|
||||||
const auto *opt = config->option<ConfigOptionFloatsNullable>("filament_ironing_spacing");
|
|
||||||
if (opt == nullptr)
|
|
||||||
return;
|
|
||||||
std::vector<double> values = opt->values;
|
|
||||||
bool reset = false;
|
|
||||||
for (size_t i = 0; i < values.size(); ++i)
|
|
||||||
if (!opt->is_nil(i) && values[i] < IRONING_SPACING_MIN) {
|
|
||||||
values[i] = 0.1;
|
|
||||||
reset = true;
|
|
||||||
}
|
|
||||||
if (!reset)
|
|
||||||
return;
|
|
||||||
const wxString msg_text = _(L("Ironing spacing too small\nIt has been reset to 0.1"));
|
|
||||||
MessageDialog dialog(nullptr, msg_text, "", wxICON_WARNING | wxOK);
|
|
||||||
DynamicPrintConfig new_conf = *config;
|
|
||||||
is_msg_dlg_already_exist = true;
|
|
||||||
dialog.ShowModal();
|
|
||||||
new_conf.set_key_value("filament_ironing_spacing", new ConfigOptionFloatsNullable(values));
|
|
||||||
apply(config, &new_conf);
|
|
||||||
is_msg_dlg_already_exist = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigManipulation::check_chamber_temperature(DynamicPrintConfig* config)
|
void ConfigManipulation::check_chamber_temperature(DynamicPrintConfig* config)
|
||||||
{
|
{
|
||||||
bool support_chamber_temp_control=GUI::wxGetApp().preset_bundle->printers.get_selected_preset().config.opt_bool("support_chamber_temp_control");
|
bool support_chamber_temp_control=GUI::wxGetApp().preset_bundle->printers.get_selected_preset().config.opt_bool("support_chamber_temp_control");
|
||||||
@@ -358,7 +334,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
//BBS: ironing_spacing shouldn't be too small or equal to zero
|
//BBS: ironing_spacing shouldn't be too small or equal to zero
|
||||||
if (config->opt_float("ironing_spacing") < IRONING_SPACING_MIN)
|
if (config->opt_float("ironing_spacing") < 0.05)
|
||||||
{
|
{
|
||||||
const wxString msg_text = _(L("Ironing spacing too small\nIt has been reset to 0.1"));
|
const wxString msg_text = _(L("Ironing spacing too small\nIt has been reset to 0.1"));
|
||||||
MessageDialog dialog(nullptr, msg_text, "", wxICON_WARNING | wxOK);
|
MessageDialog dialog(nullptr, msg_text, "", wxICON_WARNING | wxOK);
|
||||||
@@ -369,7 +345,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
|
|||||||
apply(config, &new_conf);
|
apply(config, &new_conf);
|
||||||
is_msg_dlg_already_exist = false;
|
is_msg_dlg_already_exist = false;
|
||||||
}
|
}
|
||||||
if (config->opt_float("support_ironing_spacing") < IRONING_SPACING_MIN)
|
if (config->opt_float("support_ironing_spacing") < 0.05)
|
||||||
{
|
{
|
||||||
const wxString msg_text = _(L("Ironing spacing too small\nIt has been reset to 0.1"));
|
const wxString msg_text = _(L("Ironing spacing too small\nIt has been reset to 0.1"));
|
||||||
MessageDialog dialog(nullptr, msg_text, "", wxICON_WARNING | wxOK);
|
MessageDialog dialog(nullptr, msg_text, "", wxICON_WARNING | wxOK);
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ public:
|
|||||||
void check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config, unsigned int variant_index);
|
void check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config, unsigned int variant_index);
|
||||||
void check_adaptive_pressure_advance_model(DynamicPrintConfig* config);
|
void check_adaptive_pressure_advance_model(DynamicPrintConfig* config);
|
||||||
void check_filament_max_volumetric_speed(DynamicPrintConfig *config);
|
void check_filament_max_volumetric_speed(DynamicPrintConfig *config);
|
||||||
void check_filament_ironing_spacing(DynamicPrintConfig *config);
|
|
||||||
void check_chamber_temperature(DynamicPrintConfig* config);
|
void check_chamber_temperature(DynamicPrintConfig* config);
|
||||||
void check_chamber_minimal_temperature(DynamicPrintConfig* config);
|
void check_chamber_minimal_temperature(DynamicPrintConfig* config);
|
||||||
bool check_layer_height(DynamicPrintConfig* config);
|
bool check_layer_height(DynamicPrintConfig* config);
|
||||||
|
|||||||
@@ -4911,7 +4911,6 @@ void TabFilament::update()
|
|||||||
return; // ys_FIXME
|
return; // ys_FIXME
|
||||||
|
|
||||||
m_config_manipulation.check_filament_max_volumetric_speed(m_config);
|
m_config_manipulation.check_filament_max_volumetric_speed(m_config);
|
||||||
m_config_manipulation.check_filament_ironing_spacing(m_config);
|
|
||||||
|
|
||||||
m_update_cnt++;
|
m_update_cnt++;
|
||||||
|
|
||||||
|
|||||||
@@ -748,61 +748,6 @@ TEST_CASE("A region with ironing turned off is never ironed", "[Fill]")
|
|||||||
REQUIRE(Layer::choose_ironing_extruder(cfg, spiral_mode, /*is_topmost_layer=*/true) == -1);
|
REQUIRE(Layer::choose_ironing_extruder(cfg, spiral_mode, /*is_topmost_layer=*/true) == -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ironing path count and total length in mm, over the whole object.
|
|
||||||
static std::pair<size_t, double> ironing_extent(const Print &print)
|
|
||||||
{
|
|
||||||
size_t paths = 0;
|
|
||||||
double length = 0.;
|
|
||||||
for (const Layer *layer : print.objects().front()->layers())
|
|
||||||
for (const LayerRegion *region : layer->regions())
|
|
||||||
for (const ExtrusionEntity *entity : region->fills.flatten().entities)
|
|
||||||
if (ironing_role(entity->role())) {
|
|
||||||
++paths;
|
|
||||||
length += unscale<double>(entity->length());
|
|
||||||
}
|
|
||||||
return {paths, length};
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Ironing spacing below the minimum irons at the minimum spacing", "[Fill]")
|
|
||||||
{
|
|
||||||
const std::string pattern = GENERATE("rectilinear", "concentric");
|
|
||||||
const bool via_filament = GENERATE(false, true);
|
|
||||||
const double spacing = GENERATE(0., 0.001);
|
|
||||||
CAPTURE(pattern, via_filament, spacing);
|
|
||||||
|
|
||||||
auto ironing_for = [&pattern, via_filament](double spacing) {
|
|
||||||
DynamicPrintConfig config = DynamicPrintConfig::full_print_config();
|
|
||||||
config.set_deserialize_strict({{"ironing_type", "top"},
|
|
||||||
{"ironing_pattern", pattern},
|
|
||||||
{"layer_height", 0.2}});
|
|
||||||
// The filament override replaces the process spacing, which stays at a usable value.
|
|
||||||
if (via_filament)
|
|
||||||
config.set_deserialize_strict({{"ironing_spacing", 0.1}, {"filament_ironing_spacing", spacing}});
|
|
||||||
else
|
|
||||||
config.set_deserialize_strict({{"ironing_spacing", spacing}});
|
|
||||||
Print print;
|
|
||||||
Slic3r::Test::init_and_process_print({Slic3r::Test::cube(20)}, print, config);
|
|
||||||
return ironing_extent(print);
|
|
||||||
};
|
|
||||||
|
|
||||||
const std::pair<size_t, double> clamped = ironing_for(spacing);
|
|
||||||
const std::pair<size_t, double> minimum = ironing_for(IRONING_SPACING_MIN);
|
|
||||||
REQUIRE(minimum.first > 0);
|
|
||||||
CHECK(clamped.first == minimum.first);
|
|
||||||
CHECK_THAT(clamped.second, Catch::Matchers::WithinRel(minimum.second, 1e-9));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Concentric fill at zero spacing returns without paths", "[Fill]")
|
|
||||||
{
|
|
||||||
std::unique_ptr<Fill> filler(Fill::new_from_type(ipConcentric));
|
|
||||||
filler->spacing = 0.;
|
|
||||||
filler->bounding_box = BoundingBox(Point(0, 0), Point::new_scale(10, 10));
|
|
||||||
FillParams params;
|
|
||||||
params.density = 1.f;
|
|
||||||
Surface surface(stTop, ExPolygon({Point(0, 0), Point::new_scale(10, 0), Point::new_scale(10, 10), Point::new_scale(0, 10)}));
|
|
||||||
CHECK(filler->fill_surface(&surface, params).empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Solid infill direction offsets every layer when no template is set", "[Fill]")
|
TEST_CASE("Solid infill direction offsets every layer when no template is set", "[Fill]")
|
||||||
{
|
{
|
||||||
auto angles_for = [](int direction) {
|
auto angles_for = [](int direction) {
|
||||||
|
|||||||
@@ -1,39 +1,6 @@
|
|||||||
#include <catch2/catch_all.hpp>
|
#include <catch2/catch_all.hpp>
|
||||||
|
|
||||||
#include "slic3r/Utils/Http.hpp"
|
#include "slic3r/Utils/Http.hpp"
|
||||||
#include "slic3r/Utils/OrcaCloudServiceAgent.hpp"
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
nlohmann::json flat_session_json(const nlohmann::json& fields)
|
|
||||||
{
|
|
||||||
nlohmann::json session = {
|
|
||||||
{"access_token", "test-token"},
|
|
||||||
{"user_id", "test-user-id"}
|
|
||||||
};
|
|
||||||
session.update(fields);
|
|
||||||
return session;
|
|
||||||
}
|
|
||||||
|
|
||||||
nlohmann::json nested_session_json(const nlohmann::json& metadata)
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
{"access_token", "test-token"},
|
|
||||||
{"user", {
|
|
||||||
{"id", "test-user-id"},
|
|
||||||
{"user_metadata", metadata}
|
|
||||||
}}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string resolved_display_name(const nlohmann::json& session)
|
|
||||||
{
|
|
||||||
Slic3r::OrcaCloudServiceAgent agent("");
|
|
||||||
REQUIRE(agent.set_user_session(session, false));
|
|
||||||
return agent.get_user_nickname();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
TEST_CASE("Check SSL certificates paths", "[Http][NotWorking]") {
|
TEST_CASE("Check SSL certificates paths", "[Http][NotWorking]") {
|
||||||
|
|
||||||
@@ -53,62 +20,6 @@ TEST_CASE("Check SSL certificates paths", "[Http][NotWorking]") {
|
|||||||
REQUIRE(status == 200);
|
REQUIRE(status == 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Orca cloud flat session resolves display name consistently", "[OrcaCloudServiceAgent]")
|
|
||||||
{
|
|
||||||
CHECK(resolved_display_name(flat_session_json({
|
|
||||||
{"username", "orca_username"},
|
|
||||||
{"display_name", "Display Name"},
|
|
||||||
{"nickname", "Nickname"}
|
|
||||||
})) == "Display Name");
|
|
||||||
|
|
||||||
CHECK(resolved_display_name(flat_session_json({
|
|
||||||
{"username", "orca_username"},
|
|
||||||
{"nickname", "Nickname"}
|
|
||||||
})) == "Nickname");
|
|
||||||
|
|
||||||
CHECK(resolved_display_name(flat_session_json({
|
|
||||||
{"username", "orca_username"},
|
|
||||||
{"full_name", "Full Name"}
|
|
||||||
})) == "Full Name");
|
|
||||||
|
|
||||||
CHECK(resolved_display_name(flat_session_json({
|
|
||||||
{"username", "orca_username"},
|
|
||||||
{"name", "Provider Name"}
|
|
||||||
})) == "Provider Name");
|
|
||||||
|
|
||||||
CHECK(resolved_display_name(flat_session_json({
|
|
||||||
{"username", "orca_username"}
|
|
||||||
})) == "orca_username");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Orca cloud nested session resolves display name consistently", "[OrcaCloudServiceAgent]")
|
|
||||||
{
|
|
||||||
CHECK(resolved_display_name(nested_session_json({
|
|
||||||
{"username", "orca_username"},
|
|
||||||
{"display_name", "Display Name"},
|
|
||||||
{"nickname", "Nickname"}
|
|
||||||
})) == "Display Name");
|
|
||||||
|
|
||||||
CHECK(resolved_display_name(nested_session_json({
|
|
||||||
{"username", "orca_username"},
|
|
||||||
{"nickname", "Nickname"}
|
|
||||||
})) == "Nickname");
|
|
||||||
|
|
||||||
CHECK(resolved_display_name(nested_session_json({
|
|
||||||
{"username", "orca_username"},
|
|
||||||
{"full_name", "Full Name"}
|
|
||||||
})) == "Full Name");
|
|
||||||
|
|
||||||
CHECK(resolved_display_name(nested_session_json({
|
|
||||||
{"username", "orca_username"},
|
|
||||||
{"name", "Provider Name"}
|
|
||||||
})) == "Provider Name");
|
|
||||||
|
|
||||||
CHECK(resolved_display_name(nested_session_json({
|
|
||||||
{"username", "orca_username"}
|
|
||||||
})) == "orca_username");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Http digest authentication", "[Http][NotWorking]") {
|
TEST_CASE("Http digest authentication", "[Http][NotWorking]") {
|
||||||
Slic3r::Http g = Slic3r::Http::get("https://httpbingo.org/digest-auth/auth/guest/guest");
|
Slic3r::Http g = Slic3r::Http::get("https://httpbingo.org/digest-auth/auth/guest/guest");
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,37 @@ std::unique_ptr<OrcaCloudServiceAgent> make_file_backed_agent(const fs::path& di
|
|||||||
|
|
||||||
fs::path secret_file(const fs::path& dir) { return dir / secret_constants::USER_SECRET_FILENAME; }
|
fs::path secret_file(const fs::path& dir) { return dir / secret_constants::USER_SECRET_FILENAME; }
|
||||||
|
|
||||||
|
nlohmann::json flat_session_json(const nlohmann::json& fields)
|
||||||
|
{
|
||||||
|
nlohmann::json session = {
|
||||||
|
{"access_token", "test-token"},
|
||||||
|
{"user_id", "test-user-id"}
|
||||||
|
};
|
||||||
|
session.update(fields);
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
|
||||||
|
nlohmann::json nested_session_json(const nlohmann::json& metadata)
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
{"access_token", "test-token"},
|
||||||
|
{"user", {
|
||||||
|
{"id", "test-user-id"},
|
||||||
|
{"user_metadata", metadata}
|
||||||
|
}}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// set_user_session() persists the session, so it goes to a throwaway token file rather than the
|
||||||
|
// system keychain of whoever runs the tests.
|
||||||
|
std::string resolved_display_name(const nlohmann::json& session)
|
||||||
|
{
|
||||||
|
ScopedTemporaryDir dir("orca-secret");
|
||||||
|
auto agent = make_file_backed_agent(dir.path());
|
||||||
|
REQUIRE(agent->set_user_session(session, false));
|
||||||
|
return agent->get_user_nickname();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TEST_CASE("Logging out removes the secret this instance saved", "[OrcaCloudServiceAgent]")
|
TEST_CASE("Logging out removes the secret this instance saved", "[OrcaCloudServiceAgent]")
|
||||||
@@ -84,3 +115,59 @@ TEST_CASE("Logging out leaves a secret this instance could not read alone", "[Or
|
|||||||
agent->user_logout(false);
|
agent->user_logout(false);
|
||||||
CHECK(fs::exists(secret_file(dir.path())));
|
CHECK(fs::exists(secret_file(dir.path())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Orca cloud flat session resolves display name consistently", "[OrcaCloudServiceAgent]")
|
||||||
|
{
|
||||||
|
CHECK(resolved_display_name(flat_session_json({
|
||||||
|
{"username", "orca_username"},
|
||||||
|
{"display_name", "Display Name"},
|
||||||
|
{"nickname", "Nickname"}
|
||||||
|
})) == "Display Name");
|
||||||
|
|
||||||
|
CHECK(resolved_display_name(flat_session_json({
|
||||||
|
{"username", "orca_username"},
|
||||||
|
{"nickname", "Nickname"}
|
||||||
|
})) == "Nickname");
|
||||||
|
|
||||||
|
CHECK(resolved_display_name(flat_session_json({
|
||||||
|
{"username", "orca_username"},
|
||||||
|
{"full_name", "Full Name"}
|
||||||
|
})) == "Full Name");
|
||||||
|
|
||||||
|
CHECK(resolved_display_name(flat_session_json({
|
||||||
|
{"username", "orca_username"},
|
||||||
|
{"name", "Provider Name"}
|
||||||
|
})) == "Provider Name");
|
||||||
|
|
||||||
|
CHECK(resolved_display_name(flat_session_json({
|
||||||
|
{"username", "orca_username"}
|
||||||
|
})) == "orca_username");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Orca cloud nested session resolves display name consistently", "[OrcaCloudServiceAgent]")
|
||||||
|
{
|
||||||
|
CHECK(resolved_display_name(nested_session_json({
|
||||||
|
{"username", "orca_username"},
|
||||||
|
{"display_name", "Display Name"},
|
||||||
|
{"nickname", "Nickname"}
|
||||||
|
})) == "Display Name");
|
||||||
|
|
||||||
|
CHECK(resolved_display_name(nested_session_json({
|
||||||
|
{"username", "orca_username"},
|
||||||
|
{"nickname", "Nickname"}
|
||||||
|
})) == "Nickname");
|
||||||
|
|
||||||
|
CHECK(resolved_display_name(nested_session_json({
|
||||||
|
{"username", "orca_username"},
|
||||||
|
{"full_name", "Full Name"}
|
||||||
|
})) == "Full Name");
|
||||||
|
|
||||||
|
CHECK(resolved_display_name(nested_session_json({
|
||||||
|
{"username", "orca_username"},
|
||||||
|
{"name", "Provider Name"}
|
||||||
|
})) == "Provider Name");
|
||||||
|
|
||||||
|
CHECK(resolved_display_name(nested_session_json({
|
||||||
|
{"username", "orca_username"}
|
||||||
|
})) == "orca_username");
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user