コード例 #1
0
    def test_setLogicalOffsetPosition_Relative(self):
        """Test the setLogicalOffsetPosition method when in relative mode."""
        unit = AxisPosition(100, 20, 50, False, 10)
        unit.setLogicalOffsetPosition(20)

        # 200 + 100 - 100 = 200, 50 + 200 = 250
        self.assertEqual(unit.offset, 250, "offset should be 250")
        self.assertEqual(unit.current, 100, "current should be 100")
        self.assertEqual(unit.homeOffset, 20, "homeOffset should be 20")
コード例 #2
0
    def test_setLogicalOffsetPosition_Absolute(self):
        """Test the setLogicalOffsetPosition method when in absolute mode."""
        unit = AxisPosition(100, 20, 50, True, 10)
        unit.setLogicalOffsetPosition(20)

        # 200 + 50 + 20 - 100 = 170, 50 + 170 = 220
        self.assertEqual(unit.offset, 220, "offset should be 220")
        self.assertEqual(unit.current, 100, "current should be 100")
        self.assertEqual(unit.homeOffset, 20, "homeOffset should be 20")