Fixing unit tests

This commit is contained in:
Vojtech Bubnik 2021-04-21 15:31:06 +02:00
parent 0c1953a929
commit 542d95a593
2 changed files with 8 additions and 5 deletions

View file

@ -24,7 +24,7 @@ SCENARIO("Extrusion width specifics", "[Flow]") {
{ "skirts", 1 }, { "skirts", 1 },
{ "perimeters", 3 }, { "perimeters", 3 },
{ "fill_density", "40%" }, { "fill_density", "40%" },
{ "first_layer_height", "100%" } { "first_layer_height", 0.3 }
}); });
WHEN("first layer width set to 2mm") { WHEN("first layer width set to 2mm") {

View file

@ -14,9 +14,12 @@ SCENARIO("Placeholder parser scripting", "[PlaceholderParser]") {
{ "nozzle_diameter", "0.6;0.6;0.6;0.6" }, { "nozzle_diameter", "0.6;0.6;0.6;0.6" },
{ "temperature", "357;359;363;378" } { "temperature", "357;359;363;378" }
}); });
// To test the "first_layer_extrusion_width" over "first_layer_heigth" over "layer_height" chain. // To test the "first_layer_extrusion_width" over "first_layer_heigth".
config.option<ConfigOptionFloatOrPercent>("first_layer_height")->value = 150.; // "first_layer_heigth" over "layer_height" is no more supported after first_layer_height was moved from PrintObjectConfig to PrintConfig.
config.option<ConfigOptionFloatOrPercent>("first_layer_height")->percent = true; // config.option<ConfigOptionFloatOrPercent>("first_layer_height")->value = 150.;
// config.option<ConfigOptionFloatOrPercent>("first_layer_height")->percent = true;
config.option<ConfigOptionFloatOrPercent>("first_layer_height")->value = 1.5 * config.opt_float("layer_height");
config.option<ConfigOptionFloatOrPercent>("first_layer_height")->percent = false;
// To let the PlaceholderParser throw when referencing first_layer_speed if it is set to percent, as the PlaceholderParser does not know // To let the PlaceholderParser throw when referencing first_layer_speed if it is set to percent, as the PlaceholderParser does not know
// a percent to what. // a percent to what.
config.option<ConfigOptionFloatOrPercent>("first_layer_speed")->value = 50.; config.option<ConfigOptionFloatOrPercent>("first_layer_speed")->value = 50.;
@ -50,7 +53,7 @@ SCENARIO("Placeholder parser scripting", "[PlaceholderParser]") {
SECTION("math: int(-13.4)") { REQUIRE(parser.process("{int(-13.4)}") == "-13"); } SECTION("math: int(-13.4)") { REQUIRE(parser.process("{int(-13.4)}") == "-13"); }
// Test the "coFloatOrPercent" and "xxx_extrusion_width" substitutions. // Test the "coFloatOrPercent" and "xxx_extrusion_width" substitutions.
// first_layer_extrusion_width ratio_over first_layer_heigth ratio_over layer_height // first_layer_extrusion_width ratio_over first_layer_heigth.
SECTION("perimeter_extrusion_width") { REQUIRE(std::stod(parser.process("{perimeter_extrusion_width}")) == Approx(0.67500001192092896)); } SECTION("perimeter_extrusion_width") { REQUIRE(std::stod(parser.process("{perimeter_extrusion_width}")) == Approx(0.67500001192092896)); }
SECTION("first_layer_extrusion_width") { REQUIRE(std::stod(parser.process("{first_layer_extrusion_width}")) == Approx(0.9)); } SECTION("first_layer_extrusion_width") { REQUIRE(std::stod(parser.process("{first_layer_extrusion_width}")) == Approx(0.9)); }
SECTION("support_material_xy_spacing") { REQUIRE(std::stod(parser.process("{support_material_xy_spacing}")) == Approx(0.3375)); } SECTION("support_material_xy_spacing") { REQUIRE(std::stod(parser.process("{support_material_xy_spacing}")) == Approx(0.3375)); }