From 72e99cf35f7d5b5aeb1c476b0806f66d31e16e6e Mon Sep 17 00:00:00 2001 From: bubnikv Date: Tue, 15 Oct 2019 18:38:40 +0200 Subject: [PATCH] Fixing some compilation issues of the C++ test cases on OSX. --- tests/fff_print/test_data.cpp | 19 +++++++++++-------- tests/fff_print/test_flow.cpp | 6 +++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/fff_print/test_data.cpp b/tests/fff_print/test_data.cpp index 7144ce5de..a02b7d1bb 100644 --- a/tests/fff_print/test_data.cpp +++ b/tests/fff_print/test_data.cpp @@ -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 init_print(std::initializer_list meshes, Slic3r::Model& model, std::shared_ptr _config, bool comments) { std::shared_ptr 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 {std::make_shared()}; @@ -241,10 +247,7 @@ std::shared_ptr init_print(std::initializer_list meshes, Sl std::shared_ptr 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 { std::make_shared() }; diff --git a/tests/fff_print/test_flow.cpp b/tests/fff_print/test_flow.cpp index eef47b943..810e97729 100644 --- a/tests/fff_print/test_flow.cpp +++ b/tests/fff_print/test_flow.cpp @@ -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 = Slic3r::Test::init_print({TestMesh::cube_20x20x20}, model, config); std::vector 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) {