Fixing some compilation issues of the C++ test cases on OSX.

This commit is contained in:
bubnikv 2019-10-15 18:38:40 +02:00
parent abe856f9fe
commit 72e99cf35f
2 changed files with 14 additions and 11 deletions

View File

@ -203,15 +203,21 @@ TriangleMesh mesh(TestMesh m)
return _mesh;
}
static bool verbose_gcode()
{
const char *v = std::getenv("SLIC3R_TESTS_GCODE");
if (v == nullptr)
return false;
std::string s(v);
return s == "1" || s == "on" || s == "yes";
}
std::shared_ptr<Print> init_print(std::initializer_list<TestMesh> meshes, Slic3r::Model& model, std::shared_ptr<DynamicPrintConfig> _config, bool comments)
{
std::shared_ptr<DynamicPrintConfig> config(Slic3r::DynamicPrintConfig::new_from_defaults());
config->apply(*_config);
const char* v {std::getenv("SLIC3R_TESTS_GCODE")};
auto tests_gcode {(v == nullptr ? "" : std::string(v))};
if (tests_gcode != "")
if (verbose_gcode())
config->set_key_value("gcode_comments", new ConfigOptionBool(true));
std::shared_ptr<Print> print {std::make_shared<Slic3r::Print>()};
@ -241,10 +247,7 @@ std::shared_ptr<Print> init_print(std::initializer_list<TriangleMesh> meshes, Sl
std::shared_ptr<DynamicPrintConfig> config(Slic3r::DynamicPrintConfig::new_from_defaults());
config->apply(*_config);
const char* v {std::getenv("SLIC3R_TESTS_GCODE")};
auto tests_gcode {(v == nullptr ? "" : std::string(v))};
if (tests_gcode != "")
if (verbose_gcode())
config->set_key_value("gcode_comments", new ConfigOptionBool(true));
std::shared_ptr<Print> print { std::make_shared<Slic3r::Print>() };

View File

@ -28,11 +28,11 @@ SCENARIO("Extrusion width specifics", "[!mayfail]") {
WHEN("first layer width set to 2mm") {
Slic3r::Model model;
config->set_deserialize("first_layer_extrusion_width", "2");
auto print {Slic3r::Test::init_print({TestMesh::cube_20x20x20}, model, config)};
std::shared_ptr<Print> print = Slic3r::Test::init_print({TestMesh::cube_20x20x20}, model, config);
std::vector<double> E_per_mm_bottom;
std::string gcode = ::Test::gcode(print);
auto parser {Slic3r::GCodeReader()};
std::string gcode = Test::gcode(print);
Slic3r::GCodeReader parser;
const auto layer_height { config->opt_float("layer_height") };
parser.parse_buffer(gcode, [&E_per_mm_bottom, layer_height] (Slic3r::GCodeReader& self, const Slic3r::GCodeReader::GCodeLine& line)
{