test_gcode.cpp 559 B

12345678910111213141516171819202122
  1. #include <catch2/catch.hpp>
  2. #include <memory>
  3. #include "libslic3r/GCode.hpp"
  4. using namespace Slic3r;
  5. SCENARIO("Origin manipulation", "[GCode]") {
  6. Slic3r::GCode gcodegen;
  7. WHEN("set_origin to (10,0)") {
  8. gcodegen.set_origin(Vec2d(10,0));
  9. REQUIRE(gcodegen.origin() == Vec2d(10, 0));
  10. }
  11. WHEN("set_origin to (10,0) and translate by (5, 5)") {
  12. gcodegen.set_origin(Vec2d(10,0));
  13. gcodegen.set_origin(gcodegen.origin() + Vec2d(5, 5));
  14. THEN("origin returns reference to point") {
  15. REQUIRE(gcodegen.origin() == Vec2d(15,5));
  16. }
  17. }
  18. }