mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-31 03:21:59 +08:00
Fixed some paths and stubbed new_from_ini
This commit is contained in:
parent
62aeb5be85
commit
2aa97855c8
@ -380,10 +380,11 @@ if (SLIC3R_BUILD_TESTS)
|
||||
target_include_directories(Catch INTERFACE ${CMAKE_BINARY_DIR}/external/Catch/include)
|
||||
target_compile_definitions(Catch INTERFACE $<$<CXX_COMPILER_ID:MSVC>:_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING>)
|
||||
endif()
|
||||
include_directories(${LIBDIR}/test)
|
||||
include_directories(${TESTDIR})
|
||||
configure_file("${TESTDIR}/test_options.hpp.in" "${TESTDIR}/test_options.hpp")
|
||||
add_executable(slic3r_test ${SLIC3R_TEST_SOURCES})
|
||||
add_test(NAME TestSlic3r COMMAND slic3r_test)
|
||||
target_compile_features(slic3r_test PUBLIC cxx_std_14)
|
||||
|
||||
target_link_libraries(slic3r_test PUBLIC libslic3r Catch ${LIBSLIC3R_DEPENDS})
|
||||
endif()
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "Config.hpp"
|
||||
#include <test_paths.hpp>
|
||||
#include <test_options.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
using namespace Slic3r;
|
||||
using namespace std::string_literals;
|
||||
using namespace std::literals::string_literals;
|
||||
|
||||
SCENARIO("Generic config validation performs as expected.", "[!mayfail]") {
|
||||
GIVEN("A config generated from default options") {
|
||||
@ -101,7 +101,7 @@ SCENARIO("Config accessor functions perform as expected.", "[!mayfail]") {
|
||||
|
||||
SCENARIO("Config ini load/save interface", "[!mayfail]") {
|
||||
WHEN("new_from_ini is called") {
|
||||
auto config {Slic3r::Config::new_from_config(std::string(testfile_dir) + "test_config/new_from_ini.ini"s) };
|
||||
auto config {Slic3r::Config::new_from_ini(std::string(testfile_dir) + "test_config/new_from_ini.ini"s) };
|
||||
THEN("Config object contains ini file options.") {
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,15 @@ new_from_cli(const int& argc, const char* argv[])
|
||||
return std::make_shared<Config>();
|
||||
}
|
||||
|
||||
std::shared_ptr<Config>
|
||||
Config::new_from_ini(const std::string& inifile)
|
||||
{
|
||||
|
||||
auto my_config(std::make_shared<Config>());
|
||||
my_config->read_ini(inifile);
|
||||
return my_config;
|
||||
}
|
||||
|
||||
bool
|
||||
Config::validate()
|
||||
{
|
||||
|
@ -40,6 +40,9 @@ public:
|
||||
/// Factory method to construct a Config from CLI options.
|
||||
static std::shared_ptr<Config> new_from_cli(const int& argc, const char* argv[]);
|
||||
|
||||
/// Factory method to construct a Config from an ini file.
|
||||
static std::shared_ptr<Config> new_from_ini(const std::string& inifile);
|
||||
|
||||
/// Write a windows-style opt=value ini file with categories from the configuration store.
|
||||
void write_ini(const std::string& file) const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user