test_utils.hpp 658 B

123456789101112131415161718192021222324252627
  1. #ifndef SLIC3R_TEST_UTILS
  2. #define SLIC3R_TEST_UTILS
  3. #include <libslic3r/TriangleMesh.hpp>
  4. #include <libslic3r/Format/OBJ.hpp>
  5. #if defined(WIN32) || defined(_WIN32)
  6. #define PATH_SEPARATOR R"(\)"
  7. #else
  8. #define PATH_SEPARATOR R"(/)"
  9. #endif
  10. inline Slic3r::TriangleMesh load_model(const std::string &obj_filename)
  11. {
  12. Slic3r::TriangleMesh mesh;
  13. auto fpath = TEST_DATA_DIR PATH_SEPARATOR + obj_filename;
  14. Slic3r::load_obj(fpath.c_str(), &mesh);
  15. return mesh;
  16. }
  17. inline std::string get_model_path(const std::string &obj_filename)
  18. {
  19. std::string fpath = TEST_DATA_DIR PATH_SEPARATOR + obj_filename;
  20. return fpath;
  21. }
  22. #endif // SLIC3R_TEST_UTILS