mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-03 04:40:40 +08:00
Expanded tests slightly for config and laid out framework for external input files.
This commit is contained in:
parent
ff7ed5bd60
commit
8bac95a208
@ -67,9 +67,13 @@ find_package(Boost REQUIRED COMPONENTS system thread filesystem)
|
||||
|
||||
set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/../xs/src/)
|
||||
set(GUI_LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/GUI/)
|
||||
|
||||
set(TESTDIR ${CMAKE_CURRENT_SOURCE_DIR}/test)
|
||||
set(GUI_TESTDIR ${CMAKE_CURRENT_SOURCE_DIR}/test/GUI/)
|
||||
|
||||
# directory that contains the dependent non-source files, like models and configurations
|
||||
set(TESTFILE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test/inputs/)
|
||||
|
||||
include_directories(${LIBDIR})
|
||||
include_directories(${LIBDIR}/libslic3r)
|
||||
include_directories(${LIBDIR}/slic3r/GUI/)
|
||||
@ -376,11 +380,14 @@ 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)
|
||||
configure_file("${LIBDIR}/test/test_options.hpp.in" "${LIBDIR}/test/test_options.hpp")
|
||||
add_executable(slic3r_test ${SLIC3R_TEST_SOURCES})
|
||||
add_test(NAME TestSlic3r COMMAND slic3r_test)
|
||||
|
||||
target_link_libraries(slic3r_test PUBLIC libslic3r Catch ${LIBSLIC3R_DEPENDS})
|
||||
endif()
|
||||
|
||||
if (BUILD_EXTRUDE_TIN)
|
||||
target_link_libraries (extrude-tin libslic3r ${LIBSLIC3R_DEPENDS})
|
||||
endif()
|
||||
endif(
|
||||
|
12
src/test/inputs/README.md
Normal file
12
src/test/inputs/README.md
Normal file
@ -0,0 +1,12 @@
|
||||
Directory containing test-specific input files that are not source code.
|
||||
|
||||
===
|
||||
|
||||
Rules
|
||||
===
|
||||
* Each folder shall be named for the test that it supports.
|
||||
* `test_config` directory supports `test_config.cpp`, etc.
|
||||
* If a specific test file is reused across multiple tests, it should go in the `common` directory.
|
||||
* Each extra input file should be named in such a way that it is relevant to the specific feature of it.
|
||||
* No files should have special characters in the name (unless those special characters are part of the test).
|
||||
* No spaces should be in the file paths (again, unless testing the presence of spaces is part of the test).
|
0
src/test/inputs/test_config/new_from_ini.ini
Normal file
0
src/test/inputs/test_config/new_from_ini.ini
Normal file
@ -1,8 +1,12 @@
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "Config.hpp"
|
||||
#include <test_paths.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
using namespace Slic3r;
|
||||
using namespace std::string_literals;
|
||||
|
||||
SCENARIO("Generic config validation performs as expected.", "[!mayfail]") {
|
||||
GIVEN("A config generated from default options") {
|
||||
@ -96,5 +100,10 @@ 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) };
|
||||
THEN("Config object contains ini file options.") {
|
||||
}
|
||||
}
|
||||
REQUIRE(false);
|
||||
}
|
||||
|
6
src/test/test_options.hpp.in
Normal file
6
src/test/test_options.hpp.in
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef TEST_OPTIONS_HPP
|
||||
|
||||
/// Directory path, passed in from the outside, for the path to the test inputs dir.
|
||||
constexpr auto* testfile_dir {U"@TESTFILE_DIR@"};
|
||||
|
||||
#endif // TEST_OPTIONS_HPP
|
Loading…
x
Reference in New Issue
Block a user