mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-15 19:11:51 +08:00
Test the inhibition of duplicate set_speed() calls.
Shows fix for #2915
This commit is contained in:
parent
f25b2b0d68
commit
a9e32aa4ae
@ -134,3 +134,26 @@ SCENARIO("set_fan rescales based on fan_percentage.", "[GCode][GCodeWriter]") {
|
||||
}
|
||||
}
|
||||
}
|
||||
SCENARIO("set_fan saves state.", "[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;
|
||||
writer.config.fan_percentage.value = true;
|
||||
WHEN("set_fan is called to set speed to 100\%, saving") {
|
||||
THEN("Fan gcode is emitted.") {
|
||||
CHECK_THAT(writer.set_fan(100, false), Catch::Equals("M106 S100\n"));
|
||||
}
|
||||
}
|
||||
AND_WHEN("Another call is made to set_fan for 100\%") {
|
||||
THEN("No fan output gcode is emitted.") {
|
||||
REQUIRE_THAT(writer.set_fan(100, false), Catch::Equals(""));
|
||||
}
|
||||
}
|
||||
AND_WHEN("Another call is made to set_fan for 90\%") {
|
||||
THEN("Fan gcode is emitted.") {
|
||||
REQUIRE_THAT(writer.set_fan(90, false), Catch::Equals("M106 S90\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user