mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-27 10:51:22 +00:00
Merge branch 'main' into feature/texture_displacement
This commit is contained in:
@@ -43,3 +43,41 @@ TEST_CASE("AppConfig network version helpers", "[AppConfig]") {
|
||||
REQUIRE(config.is_network_version_skipped("02.01.01.52"));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("AppConfig Speed Dial recent count defaults, clamps and parses", "[AppConfig]") {
|
||||
AppConfig config;
|
||||
|
||||
SECTION("unset falls back to the default") {
|
||||
REQUIRE(config.get_speed_dial_recent_count() == SPEED_DIAL_RECENT_COUNT_DEFAULT);
|
||||
}
|
||||
|
||||
SECTION("zero disables recents") {
|
||||
config.set(SETTING_SPEED_DIAL_RECENT_COUNT, "0");
|
||||
REQUIRE(config.get_speed_dial_recent_count() == 0);
|
||||
}
|
||||
|
||||
SECTION("a value in range is returned as-is") {
|
||||
config.set(SETTING_SPEED_DIAL_RECENT_COUNT, "7");
|
||||
REQUIRE(config.get_speed_dial_recent_count() == 7);
|
||||
}
|
||||
|
||||
SECTION("the maximum is kept") {
|
||||
config.set(SETTING_SPEED_DIAL_RECENT_COUNT, "10");
|
||||
REQUIRE(config.get_speed_dial_recent_count() == SPEED_DIAL_RECENT_COUNT_MAX);
|
||||
}
|
||||
|
||||
SECTION("values above the maximum clamp down") {
|
||||
config.set(SETTING_SPEED_DIAL_RECENT_COUNT, "42");
|
||||
REQUIRE(config.get_speed_dial_recent_count() == SPEED_DIAL_RECENT_COUNT_MAX);
|
||||
}
|
||||
|
||||
SECTION("negative values clamp up to 0") {
|
||||
config.set(SETTING_SPEED_DIAL_RECENT_COUNT, "-3");
|
||||
REQUIRE(config.get_speed_dial_recent_count() == 0);
|
||||
}
|
||||
|
||||
SECTION("garbage falls back to the default") {
|
||||
config.set(SETTING_SPEED_DIAL_RECENT_COUNT, "abc");
|
||||
REQUIRE(config.get_speed_dial_recent_count() == SPEED_DIAL_RECENT_COUNT_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -594,3 +594,47 @@ TEST_CASE("update_values_from_multi_to_multi_2 sizes the destination row to the
|
||||
CHECK(object_config.update_values_from_multi_to_multi_2(src_variants, {}, dst, keys) == -1);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("get_index_for_extruder returns -1 when no variant column matches the extruder", "[Config]")
|
||||
{
|
||||
DynamicPrintConfig config;
|
||||
config.option<ConfigOptionInts>("print_extruder_id", true)->values = {1};
|
||||
config.option<ConfigOptionStrings>("print_extruder_variant", true)->values = {"Direct Drive Standard"};
|
||||
|
||||
SECTION("the extruder that owns the column resolves to its slot") {
|
||||
REQUIRE(config.get_index_for_extruder(1, "print_extruder_id", etDirectDrive, nvtStandard, "print_extruder_variant") == 0);
|
||||
}
|
||||
|
||||
SECTION("an extruder with no matching column resolves to -1") {
|
||||
REQUIRE(config.get_index_for_extruder(2, "print_extruder_id", etDirectDrive, nvtStandard, "print_extruder_variant") == -1);
|
||||
}
|
||||
}
|
||||
|
||||
// stride scales the returned slot so callers can address stride-2 options (machine_max_*, a
|
||||
// Normal/Silent pair per column) by their pair's base slot. The printer Tab's extruder sync
|
||||
// relies on this to copy the right slots on the Motion ability page.
|
||||
TEST_CASE("get_index_for_extruder scales the variant column by the requested stride", "[Config]")
|
||||
{
|
||||
DynamicPrintConfig config;
|
||||
config.option<ConfigOptionInts>("printer_extruder_id", true)->values = {1, 2};
|
||||
config.option<ConfigOptionStrings>("printer_extruder_variant", true)->values = {"Direct Drive Standard",
|
||||
"Direct Drive High Flow"};
|
||||
|
||||
// extruder 1 resolves to column 0, extruder 2 to column 1
|
||||
const int col0_stride1 = config.get_index_for_extruder(1, "printer_extruder_id", etDirectDrive, nvtStandard,
|
||||
"printer_extruder_variant", 1);
|
||||
const int col1_stride1 = config.get_index_for_extruder(2, "printer_extruder_id", etDirectDrive, nvtHighFlow,
|
||||
"printer_extruder_variant", 1);
|
||||
REQUIRE(col0_stride1 == 0);
|
||||
REQUIRE(col1_stride1 == 1);
|
||||
|
||||
// stride 2 returns exactly twice the stride-1 index (the pair's base slot)
|
||||
const int col0_stride2 = config.get_index_for_extruder(1, "printer_extruder_id", etDirectDrive, nvtStandard,
|
||||
"printer_extruder_variant", 2);
|
||||
const int col1_stride2 = config.get_index_for_extruder(2, "printer_extruder_id", etDirectDrive, nvtHighFlow,
|
||||
"printer_extruder_variant", 2);
|
||||
REQUIRE(col0_stride2 == col0_stride1 * 2);
|
||||
REQUIRE(col1_stride2 == col1_stride1 * 2);
|
||||
REQUIRE(col0_stride2 == 0);
|
||||
REQUIRE(col1_stride2 == 2);
|
||||
}
|
||||
|
||||
@@ -335,6 +335,10 @@ TEST_CASE("The shipped defaults size the tower from the flush matrix", "[WipeTow
|
||||
const double flush_volume = WipeTower2::estimate_semm_flush_volume(config, 2);
|
||||
const double expected = std::max(double(WipeTower::get_limit_depth_by_height(5.f)), flush_volume / (0.2 * 50.));
|
||||
CHECK_THAT(estimate(config, 2, 0.2, 5.).depth, WithinAbs(expected, 1e-6));
|
||||
|
||||
// The flush volume is nonzero for one slot, but a lone filament makes no tool change.
|
||||
REQUIRE(WipeTower2::estimate_semm_flush_volume(config, 1) > 0.);
|
||||
CHECK_THAT(estimate(config, 1, 0.2, 5.).depth, WithinAbs(0., 1e-9));
|
||||
}
|
||||
|
||||
TEST_CASE("A config missing a tower key falls back to that key's default", "[WipeTowerEstimate]") {
|
||||
|
||||
Reference in New Issue
Block a user