Archive format registration refactored
Fix tests
This commit is contained in:
parent
ed41dbc7cf
commit
d4ad9deb94
11 changed files with 285 additions and 205 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "libslic3r/SLAPrint.hpp"
|
||||
#include "libslic3r/TriangleMesh.hpp"
|
||||
#include "libslic3r/Format/SLAArchiveFormatRegistry.hpp"
|
||||
#include "libslic3r/Format/SLAArchiveWriter.hpp"
|
||||
#include "libslic3r/Format/SLAArchiveReader.hpp"
|
||||
|
||||
|
@ -11,16 +12,18 @@
|
|||
using namespace Slic3r;
|
||||
|
||||
TEST_CASE("Archive export test", "[sla_archives]") {
|
||||
auto registry = registered_sla_archives();
|
||||
|
||||
for (const char * pname : {"20mm_cube", "extruder_idler"})
|
||||
for (auto &archname : SLAArchiveWriter::registered_archives()) {
|
||||
INFO(std::string("Testing archive type: ") + archname + " -- writing...");
|
||||
for (const ArchiveEntry &entry : registry) {
|
||||
INFO(std::string("Testing archive type: ") + entry.id + " -- writing...");
|
||||
SLAPrint print;
|
||||
SLAFullPrintConfig fullcfg;
|
||||
|
||||
auto m = Model::read_from_file(TEST_DATA_DIR PATH_SEPARATOR + std::string(pname) + ".obj", nullptr);
|
||||
|
||||
fullcfg.printer_technology.setInt(ptSLA); // FIXME this should be ensured
|
||||
fullcfg.set("sla_archive_format", archname);
|
||||
fullcfg.set("sla_archive_format", entry.id);
|
||||
fullcfg.set("supports_enable", false);
|
||||
fullcfg.set("pad_enable", false);
|
||||
|
||||
|
@ -32,7 +35,7 @@ TEST_CASE("Archive export test", "[sla_archives]") {
|
|||
print.process();
|
||||
|
||||
ThumbnailsList thumbnails;
|
||||
auto outputfname = std::string("output_") + pname + "." + SLAArchiveWriter::get_extension(archname);
|
||||
auto outputfname = std::string("output_") + pname + "." + entry.ext;
|
||||
|
||||
print.export_print(outputfname, thumbnails, pname);
|
||||
|
||||
|
@ -41,12 +44,8 @@ TEST_CASE("Archive export test", "[sla_archives]") {
|
|||
|
||||
double vol_written = m.mesh().volume();
|
||||
|
||||
auto readable_formats = SLAArchiveReader::registered_archives();
|
||||
if (std::any_of(readable_formats.begin(), readable_formats.end(),
|
||||
[&archname](const std::string &a) { return a == archname; })) {
|
||||
|
||||
INFO(std::string("Testing archive type: ") + archname + " -- reading back...");
|
||||
|
||||
if (entry.rdfactoryfn) {
|
||||
INFO(std::string("Testing archive type: ") + entry.id + " -- reading back...");
|
||||
indexed_triangle_set its;
|
||||
DynamicPrintConfig cfg;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue