Also apply precision and fixed to speed rewrite.

This commit is contained in:
Joseph Lenox 2019-03-30 17:50:12 -05:00 committed by Joseph Lenox
parent 205cb02efa
commit 8cf8736516
3 changed files with 8 additions and 1 deletions

View File

@ -303,6 +303,7 @@ set(SLIC3R_TEST_SOURCES
${TESTDIR}/libslic3r/test_fill.cpp
${TESTDIR}/libslic3r/test_flow.cpp
${TESTDIR}/libslic3r/test_gcodewriter.cpp
${TESTDIR}/libslic3r/test_gcode.cpp
${TESTDIR}/libslic3r/test_geometry.cpp
${TESTDIR}/libslic3r/test_log.cpp
${TESTDIR}/libslic3r/test_model.cpp
@ -544,6 +545,7 @@ if (SLIC3R_BUILD_TESTS)
endif()
configure_file("${TESTDIR}/test_options.hpp.in" "${TESTDIR}/test_options.hpp")
add_executable(slic3r_test ${SLIC3R_TEST_SOURCES})
target_compile_options(slic3r_test PUBLIC -DSLIC3R_TEST)
add_test(NAME TestSlic3r COMMAND slic3r_test)
target_compile_features(slic3r_test PUBLIC cxx_std_14)
target_include_directories(slic3r_test PUBLIC cxx_std_14 ${SLIC3R_INCLUDES})

View File

@ -50,7 +50,8 @@ apply_speed_factor(std::string &line, float speed_factor, float min_print_speed)
// replace speed in string
{
std::ostringstream oss;
oss << speed;
oss.precision(3);
oss << std::fixed << speed;
line.replace(pos+1, (last_pos-pos), oss.str());
}
}

View File

@ -37,6 +37,10 @@ class CoolingBuffer {
float _min_print_speed;
};
#ifdef SLIC3R_TEST
void apply_speed_factor(std::string &line, float speed_factor, float min_print_speed);
#endif
}
#endif