Exemplo n.º 1
0
 def test_forward(self):
     output = StringIO()
     t = GcodeTurtle(fd=output)
     t.set_heading(0)
     t.forward(100)
     self.assertEqual(t.x, 0)
     self.assertEqual(t.y, 100)
Exemplo n.º 2
0
 def test_right(self):
     output = StringIO()
     t = GcodeTurtle(fd=output)
     t.set_heading(0)
     t.right(30)
     t.forward(100)
     self.assertAlmostEqual(t.x, 50)
     self.assertAlmostEqual(t.y, 50 * (3 ** .5))
Exemplo n.º 3
0
 def test_pen_up(self):
     output = StringIO()
     t = GcodeTurtle(fd=output)
     prelude = output.getvalue()
     t.pen_up()
     output_line = output.getvalue().replace(prelude, "")
     self.assertEqual(output_line, "G1 E-1.000 F6000.000\r\n")
     prelude = output.getvalue()
     t.forward(10)
     output_line = output.getvalue().replace(prelude, "")
     self.assertNotEqual(output_line.split(" ")[-1][0], "E")