Exemplo n.º 1
0
    def test_pygame2_base_Rect_x(self):

        # __doc__ (as of 2008-10-17) for pygame2.base.Rect.x:

        # Gets or sets the horizontal top left position of the Rect.
        r = Rect (1, 2, 3, 4)
        self.assertEqual (r.x, 1)
        r.topleft = 32, 10
        self.assertEqual (r.x, 32)
        r.left = -44
        self.assertEqual (r.x, -44)
        r.move_ip (10, 33)
        self.assertEqual (r.x, -34)
Exemplo n.º 2
0
    def test_pygame2_base_Rect_y(self):

        # __doc__ (as of 2008-10-17) for pygame2.base.Rect.y:

        # Gets or sets the vertical top left position of the Rect.
        r = Rect (1, 2, 3, 4)
        self.assertEqual (r.y, 2)
        r.topleft = 32, 10
        self.assertEqual (r.y, 10)
        r.top = -44
        self.assertEqual (r.y, -44)
        r.move_ip (10, 33)
        self.assertEqual (r.y, -11)
Exemplo n.º 3
0
    def test_pygame2_base_Rect_topleft(self):

        # __doc__ (as of 2008-10-17) for pygame2.base.Rect.topleft:

        # Gets or sets the top left corner position of the Rect.

        r = Rect( 1, 2, 3, 4 )
        new_topleft = (r.left+20,r.top+30)
        old_size = r.size
        
        r.topleft = new_topleft
        self.assertEqual( new_topleft, r.topleft )
        self.assertEqual( old_size, r.size )