Example #1
0
    def readMove(self):
        """
        read and return a move to pass to a board
        """

        k = keypress.getKey()
        return Game.__dirs.get(k)
Example #2
0
 def test_getKey_arrow_key_down(self):
     k = keypress.DOWN
     self._pushArrowKey(k)
     self.assertEqual(keypress.getKey(), k)
Example #3
0
 def test_getKey_arrow_key_up(self):
     k = keypress.UP
     self._pushArrowKey(k)
     self.assertEqual(keypress.getKey(), k)
Example #4
0
 def test_getKey_read_stdin(self):
     x = 42
     self._pushChars(x)
     self.assertEqual(keypress.getKey(), x)
Example #5
0
 def test_getKey_vim_key_right(self):
     self._pushArrowKey(keypress.L)
     self.assertEqual(keypress.getKey(), keypress.RIGHT)
Example #6
0
 def test_getKey_vim_key_left(self):
     self._pushArrowKey(keypress.H)
     self.assertEqual(keypress.getKey(), keypress.LEFT)
Example #7
0
 def test_getKey_arrow_key_right(self):
     k = keypress.RIGHT
     self._pushArrowKey(k)
     self.assertEqual(keypress.getKey(), k)
Example #8
0
 def test_getKey_vim_key_up(self):
     self._pushChars(keypress.K)
     self.assertEqual(keypress.getKey(), keypress.UP)
Example #9
0
 def test_getKey_arrow_key_down(self):
     k = keypress.DOWN
     self._pushArrowKey(k)
     self.assertEqual(keypress.getKey(), k)
Example #10
0
 def test_getKey_arrow_key_left(self):
     k = keypress.LEFT
     self._pushArrowKey(k)
     self.assertEqual(keypress.getKey(), k)
Example #11
0
 def test_getKey_arrow_key_up(self):
     k = keypress.UP
     self._pushArrowKey(k)
     self.assertEqual(keypress.getKey(), k)
Example #12
0
 def test_getKey_read_stdin(self):
     x = 42
     self._pushChars(x)
     self.assertEqual(keypress.getKey(), x)
Example #13
0
 def readMove(self):
     """
     read and return a move to pass to a board
     """
     k = keypress.getKey()
     return Game.__dirs.get(k)
Example #14
0
 def test_getKey_arrow_key_left(self):
     k = keypress.LEFT
     self._pushArrowKey(k)
     self.assertEqual(keypress.getKey(), k)
Example #15
0
 def test_getKey_vim_key_up(self):
     self._pushChars(keypress.K)
     self.assertEqual(keypress.getKey(), keypress.UP)
Example #16
0
 def test_getKey_arrow_key_right(self):
     k = keypress.RIGHT
     self._pushArrowKey(k)
     self.assertEqual(keypress.getKey(), k)
Example #17
0
 def test_getKey_vim_key_down(self):
     self._pushArrowKey(keypress.J)
     self.assertEqual(keypress.getKey(), keypress.DOWN)
Example #18
0
 def test_getKey_vim_key_down(self):
     self._pushArrowKey(keypress.J)
     self.assertEqual(keypress.getKey(), keypress.DOWN)
Example #19
0
 def test_getKey_vim_key_left(self):
     self._pushArrowKey(keypress.H)
     self.assertEqual(keypress.getKey(), keypress.LEFT)
Example #20
0
 def test_getKey_vim_key_right(self):
     self._pushArrowKey(keypress.L)
     self.assertEqual(keypress.getKey(), keypress.RIGHT)
Example #21
0
 def test_termios_fallback_on_msvcrt_getKey(self):
     self.assertEqual(keypress.getKey(), helpers.msvcrt_key)