mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 05:15:57 +08:00
Tests for fan rescaling based on fan_percentage
This commit is contained in:
parent
3465f82e40
commit
f25b2b0d68
@ -94,3 +94,43 @@ SCENARIO("set_speed emits values with fixed-point output.", "[GCodeWriter]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SCENARIO("set_fan rescales based on fan_percentage.", "[GCode][GCodeWriter]") {
|
||||||
|
GIVEN("GCodeWriter instance with comments off and RepRap flavor") {
|
||||||
|
GCodeWriter writer;
|
||||||
|
writer.config.gcode_comments.value = false;
|
||||||
|
writer.config.gcode_flavor.value = gcfRepRap;
|
||||||
|
WHEN("set_fan is called to set speed to 100\% with fan_percentage = true") {
|
||||||
|
writer.config.fan_percentage.value = true;
|
||||||
|
THEN("Fan value is set to 100.") {
|
||||||
|
REQUIRE_THAT(writer.set_fan(100, true), Catch::Equals("M106 S100\n"));
|
||||||
|
}
|
||||||
|
AND_WHEN("Fan value is set to 93\%") {
|
||||||
|
THEN("Output string is 'M106 S93'") {
|
||||||
|
REQUIRE_THAT(writer.set_fan(93, true), Catch::Equals("M106 S93\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AND_WHEN("Fan value is set to 21\%") {
|
||||||
|
THEN("Output string is 'M106 S21'") {
|
||||||
|
REQUIRE_THAT(writer.set_fan(21, true), Catch::Equals("M106 S21\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WHEN("set_fan is called to set speed to 100\% with fan_percentage = false") {
|
||||||
|
writer.config.fan_percentage.value = false;
|
||||||
|
THEN("Output string is 'M106 S255'") {
|
||||||
|
REQUIRE_THAT(writer.set_fan(100, true), Catch::Equals("M106 S255\n"));
|
||||||
|
}
|
||||||
|
AND_WHEN("Fan value is set to 93\%") {
|
||||||
|
THEN("Output string is 'M106 S237'") {
|
||||||
|
REQUIRE_THAT(writer.set_fan(93, true), Catch::Equals("M106 S237.15\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AND_WHEN("Fan value is set to 21\%") {
|
||||||
|
THEN("Output string is 'M106 S54'") {
|
||||||
|
REQUIRE_THAT(writer.set_fan(21, true), Catch::Equals("M106 S53.55\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user