mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 14:13:57 -06:00
Moved a commented out test for DynamicPrintConfig serialization
/ deserialization into a living unit test.
This commit is contained in:
parent
60d8a7b301
commit
6c37955d75
2 changed files with 35 additions and 40 deletions
|
@ -1102,43 +1102,3 @@ bool Stack::temp_snapshot_active() const { return pimpl->temp_snapshot_active();
|
|||
|
||||
} // namespace UndoRedo
|
||||
} // namespace Slic3r
|
||||
|
||||
|
||||
//FIXME we should have unit tests for testing serialization of basic types as DynamicPrintConfig.
|
||||
#if 0
|
||||
#include "libslic3r/Config.hpp"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
namespace Slic3r {
|
||||
bool test_dynamic_print_config_serialization() {
|
||||
FullPrintConfig full_print_config;
|
||||
DynamicPrintConfig cfg;
|
||||
cfg.apply(full_print_config, false);
|
||||
|
||||
std::string serialized;
|
||||
try {
|
||||
std::ostringstream ss;
|
||||
cereal::BinaryOutputArchive oarchive(ss);
|
||||
oarchive(cfg);
|
||||
serialized = ss.str();
|
||||
} catch (std::runtime_error e) {
|
||||
e.what();
|
||||
}
|
||||
|
||||
DynamicPrintConfig cfg2;
|
||||
try {
|
||||
std::stringstream ss(serialized);
|
||||
cereal::BinaryInputArchive iarchive(ss);
|
||||
iarchive(cfg2);
|
||||
} catch (std::runtime_error e) {
|
||||
e.what();
|
||||
}
|
||||
|
||||
if (cfg == cfg2) {
|
||||
printf("Yes!\n");
|
||||
return true;
|
||||
}
|
||||
printf("No!\n");
|
||||
return false;
|
||||
}
|
||||
} // namespace Slic3r
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue