Beispiel #1
0
    def test_remove_action(self):
        global rec, next_done
        next_done = 0
        node = CocosNode()
        name1 = '1'
        action1 = UAction(name1)
        name2 = '2'
        action2 = UAction(name2)
        a1_copy = node.do(action1)
        a2_copy = node.do(action2)
        assert len(node.actions) == 2
        rec = []
        node.remove_action(a1_copy)

        recx = [e for e in rec if e[0] == name1]
        assert recx[0] == (name1, 'stop')
        assert len(recx) == 1

        rec = []
        dt = 0.1
        node._step(
            dt)  # needed to complete delete, will traceback if remove failed
        assert len(node.actions) == 1
        assert a2_copy in node.actions
        recx = [e for e in rec if e[0] == name1]
        assert len(recx) == 0
    def test_remove_action(self):
        global rec, next_done
        next_done = 0
        node = CocosNode()
        name1 = '1'
        action1 = UAction(name1)
        name2 = '2'
        action2 = UAction(name2)
        a1_copy = node.do(action1)
        a2_copy = node.do(action2)
        assert len(node.actions)==2
        rec = []
        node.remove_action(a1_copy)

        recx = [ e for e in rec if e[0]==name1]
        assert recx[0]==(name1, 'stop')
        assert len(recx)==1

        rec =[]
        dt = 0.1
        node._step(dt)# needed to complete delete, will traceback if remove failed
        assert len(node.actions)==1
        assert a2_copy in node.actions
        recx = [ e for e in rec if e[0]==name1]
        assert len(recx)==0
 def test_remove_action(self):
     node = CocosNode()
     self.assertTrue(len(node.actions)==0)
     action = ac.Action()
     a_copy = node.do(action)
     self.assertTrue(len(node.actions)==1)
     node.remove_action(a_copy)
     dt = 0.1
     node._step(dt)# needed to complete delete, will traceback if remove failed
     self.assertTrue(len(node.actions)==0)
Beispiel #4
0
 def test_remove_action(self):
     node = CocosNode()
     self.assertTrue(len(node.actions) == 0)
     action = ac.Action()
     a_copy = node.do(action)
     self.assertTrue(len(node.actions) == 1)
     node.remove_action(a_copy)
     dt = 0.1
     node._step(
         dt)  # needed to complete delete, will traceback if remove failed
     self.assertTrue(len(node.actions) == 0)