Fixed unit tests.

This commit is contained in:
Vojtech Bubnik 2021-03-09 13:54:42 +01:00
parent f01f02154c
commit adcbe4347c
6 changed files with 24 additions and 20 deletions

View file

@ -150,6 +150,7 @@ Flow Flow::with_spacing(float new_spacing) const
auto new_diameter = new_spacing - gap;
out.m_width = out.m_height = new_diameter;
} else {
assert(m_width >= m_height);
out.m_width += new_spacing - m_spacing;
if (out.m_width < out.m_height)
throw Slic3r::InvalidArgument("Invalid spacing supplied to Flow::with_spacing()");
@ -162,7 +163,7 @@ Flow Flow::with_spacing(float new_spacing) const
Flow Flow::with_cross_section(float area_new) const
{
assert(! m_bridge);
assert(flow.width() >= flow.height());
assert(m_width >= m_height);
// Adjust for bridge_flow_ratio, maintain the extrusion spacing.
float area = this->mm3_per_mm();
@ -179,7 +180,7 @@ Flow Flow::with_cross_section(float area_new) const
} else if (area_new < area - EPSILON) {
// Decreasing the flow rate.
float width_new = m_width - (area - area_new) / m_height;
assert(width_dif > 0);
assert(width_new > 0);
if (width_new > m_height) {
// Shrink the extrusion width.
return this->with_width(width_new);

View file

@ -117,7 +117,8 @@ public:
private:
Flow(float width, float height, float spacing, float nozzle_diameter, bool bridge) :
m_width(width), m_height(height), m_spacing(spacing), m_nozzle_diameter(nozzle_diameter), m_bridge(bridge) {}
m_width(width), m_height(height), m_spacing(spacing), m_nozzle_diameter(nozzle_diameter), m_bridge(bridge)
{ assert(width >= height); }
float m_width { 0 };
float m_height { 0 };

View file

@ -1815,7 +1815,8 @@ namespace Skirt {
// Extrude skirt at the print_z of the raft layers and normal object layers
// not at the print_z of the interlaced support material layers.
std::map<unsigned int, std::pair<size_t, size_t>> skirt_loops_per_extruder_out;
assert(skirt_done.empty());
//For sequential print, the following test may fail when extruding the 2nd and other objects.
// assert(skirt_done.empty());
if (skirt_done.empty() && print.has_skirt() && ! print.skirt().entities.empty() && layer_tools.has_skirt) {
skirt_loops_per_extruder_all_printing(print, layer_tools, skirt_loops_per_extruder_out);
skirt_done.emplace_back(layer_tools.print_z);