コード例 #1
0
    def test_allCallbacks(self):
        actual = InputManagerBase(self.mock.method1, self.mock.method2, self.mock.method3, self.mock.method4,
                                  self.mock.method5, self.mock.method6, self.mock.method7, self.mock.method8, self.mock.method9)
        actual.onMoveRight()
        actual.onMoveLeft()
        actual.onMoveUp()
        actual.onMoveDown()
        actual.onJump()
        actual.onStart()
        actual.onExit()
        actual.onButtonUp()
        actual.onJumpButtonRelease()

        self.assertTrue(self.mock._method1Called)
        self.assertTrue(self.mock._method2Called)
        self.assertTrue(self.mock._method3Called)
        self.assertTrue(self.mock._method4Called)
        self.assertTrue(self.mock._method5Called)
        self.assertTrue(self.mock._method6Called)
        self.assertTrue(self.mock._method7Called)
        self.assertTrue(self.mock._method8Called)
        self.assertTrue(self.mock._method9Called)
コード例 #2
0
 def test_onMoveUpAssigned(self):
     actual = InputManagerBase(moveUp=self.mock.method3)
     actual.onMoveUp()
     self.assertFalse(self.mock._method1Called)
     self.assertTrue(self.mock._method3Called)
     pass