コード例 #1
0
    def test_invokeDelagate_1(self):
        delegate = RobotControllerRecordingDelegate()
        delegate.recording = True
        self.robotController.addDelegate(delegate)
        event = NewPositionEvent("data")

        self.robotController.invokeEvent(event)

        assert delegate.sequence.amount() == 1
コード例 #2
0
 def test_invokeDelagate_1(self):
     delegate = RobotControllerRecordingDelegate()
     delegate.recording = True
     self.robotController.addDelegate(delegate)
     event = NewPositionEvent("data")
     
     self.robotController.invokeEvent(event)
     
     assert delegate.sequence.amount() == 1
class TestRobotControllerRecordingDelegate:
    def setup_method(self, method):
        self.delegate = RobotControllerRecordingDelegate()
        self.delegate.sequence = PositionSequence()

    def test_gotGoodNotify_amount(self):
        self.delegate.recording = True
        position = JointPosition([10, 10, 10, 10, 10, 10])
        event = NewPositionEvent(position)

        self.delegate.notify(event)
        assert self.delegate.sequence.amount() == 1

    def test_gotGoodNotify_lastPosition(self):
        self.delegate.recording = True
        position = JointPosition([10, 10, 10, 10, 10, 10])
        event = NewPositionEvent(position)

        self.delegate.notify(event)
        assert self.delegate.sequence.getCurrentPosition() == position

    def test_gotBadNotify(self):
        event = Event(0, "Wrong")

        self.delegate.notify(event)
        assert self.delegate.sequence.amount() == 0

    def test_sequenceBuilding(self):
        self.delegate.recording = True

        position = JointPosition([10, 10, 10, 10, 10, 10])
        event = NewPositionEvent(position)
        position2 = JointPosition([10, 10, 10, 10, 10, 10])
        event2 = NewPositionEvent(position2)

        self.delegate.notify(event)
        self.delegate.notify(event2)

        assert self.delegate.sequence.amount() == 2
        assert self.delegate.sequence.getPosition(1) == position2
        assert self.delegate.sequence.getCurrentPosition() == position

    def teardown_method(self, method):
        del self.delegate
コード例 #4
0
 def test_removeDelegate_simple(self):
     delegate = RobotControllerRecordingDelegate()
     self.robotController.addDelegate(delegate)
     self.robotController.removeDelegate(delegate)
     assert not self.robotController.hasDelegate(delegate)
 def setup_method(self, method):
     self.delegate = RobotControllerRecordingDelegate()
     self.delegate.sequence = PositionSequence()