Exemplo n.º 1
0
    def test_swipe_down_gesture(self):
        move_ok = do_move(self.gd, [
            Point(0, 10, 0),
            Point(0, 20, 0),
            Point(0, 40, 0),
            Point(0, 80, 0),
            Point(0, 120, 0),
            Point(0, 210, 0),
            Point(0, 220, 0),
            Point(0, 240, 0),
            Point(0, 280, 0),
            Point(0, 220, 0),
            Point(0, 320, 0),
        ])

        self.assertTrue(move_ok)
        self.assertEquals(self.callback_called['gesture'], 'swipe_down')
Exemplo n.º 2
0
    def test_swipe_right_gesture(self):
        move_ok = do_move(self.gd, [
            Point(10, 0, 0),
            Point(20, 0, 0),
            Point(40, 0, 0),
            Point(30, 0, 0),
            Point(120, 0, 0),
            Point(210, 0, 0),
            Point(220, 0, 0),
            Point(240, 0, 0),
            Point(280, 0, 0),
            Point(220, 0, 0),
            Point(320, 0, 0),
        ])

        self.assertTrue(move_ok)
        self.assertEquals(self.callback_called['gesture'], 'swipe_right')
Exemplo n.º 3
0
    def test_swipe_left_gesture(self):
        move_ok = do_move(self.gd, [
            Point(-10, 0, 0),
            Point(-20, 0, 0),
            Point(-40, 0, 0),
            Point(-80, 0, 0),
            Point(-120, 0, 0),
            Point(-210, 0, 0),
            Point(-220, 0, 0),
            Point(-240, 0, 0),
            Point(-280, 0, 0),
            Point(-220, 0, 0),
            Point(-320, 0, 0),
        ])

        self.assertTrue(move_ok)
        self.assertEquals(self.callback_called['gesture'], 'swipe_left')
        self.assertEquals(self.callback_called['last_point'],
                          Point(-220, 0, 0))
Exemplo n.º 4
0
 def callback(gesture, last_point=Point(0, 0, 0)):
     self.callback_called = {
         "gesture": gesture,
         "last_point": last_point,
     }
Exemplo n.º 5
0
    def test_fail_swipe(self):
        move_ok = do_move(self.gd, [
            Point(0, 0, 10),
            Point(0, 0, 20),
            Point(0, 20, 50),
            Point(0, 70, 90),
            Point(0, 90, 110),
            Point(0, 0, 110),
            Point(0, 0, 110),
            Point(0, 0, 110),
            Point(0, 0, 110),
            Point(0, 0, 110),
            Point(0, 0, 110),
        ])

        self.assertFalse(move_ok)
        self.assertEquals(self.callback_called, {})
Exemplo n.º 6
0
    def test_swipe_push_gesture(self):
        move_ok = do_move(self.gd, [
            Point(0, 0, -10),
            Point(0, 0, -20),
            Point(0, 0, -40),
            Point(0, 0, -80),
            Point(0, 0, -120),
            Point(0, 0, -210),
            Point(0, 0, -220),
            Point(0, 0, -240),
            Point(0, 0, -280),
            Point(0, 0, -220),
            Point(0, 0, -320),
        ])

        self.assertTrue(move_ok)
        self.assertEquals(self.callback_called['gesture'], 'push')