Exemplo n.º 1
0
    def testRectangleEquals(self):
        aRectangle = RectangleInt.fromCoordinates(5,10,20,30);
        bRectangle = RectangleInt(SizeInt(1,1), Point2DInt(3,7))

        self.assertNotEqual(aRectangle, bRectangle)

        bRectangle._origin = Point2DInt(5,10)
        self.assertNotEqual(aRectangle, bRectangle)

        bRectangle._size = SizeInt(16,21)
        self.assertEqual(aRectangle, bRectangle)
Exemplo n.º 2
0
    def testRectangleEquals(self):
        aRectangle = RectangleInt.fromCoordinates(5, 10, 20, 30)
        bRectangle = RectangleInt(SizeInt(1, 1), Point2DInt(3, 7))

        self.assertNotEqual(aRectangle, bRectangle)

        bRectangle._origin = Point2DInt(5, 10)
        self.assertNotEqual(aRectangle, bRectangle)

        bRectangle._size = SizeInt(16, 21)
        self.assertEqual(aRectangle, bRectangle)
Exemplo n.º 3
0
    def testRectangleContainsPoint(self):
        aRectangle = RectangleInt.fromCoordinates(0,0,20,10);
        aPoint = Point2DInt(-1,-1)
        
        self.assertFalse(aRectangle.contains(aPoint))

        aPoint._x = 0       
        self.assertFalse(aRectangle.contains(aPoint))

        aPoint._y = 0
        self.assertTrue(aRectangle.contains(aPoint))

        aPoint._x = 20
        self.assertTrue(aRectangle.contains(aPoint))

        aPoint._y = 10
        self.assertTrue(aRectangle.contains(aPoint))

        aPoint._x = 21
        self.assertFalse(aRectangle.contains(aPoint))
Exemplo n.º 4
0
    def testRectangleContainsPoint(self):
        aRectangle = RectangleInt.fromCoordinates(0, 0, 20, 10)
        aPoint = Point2DInt(-1, -1)

        self.assertFalse(aRectangle.contains(aPoint))

        aPoint._x = 0
        self.assertFalse(aRectangle.contains(aPoint))

        aPoint._y = 0
        self.assertTrue(aRectangle.contains(aPoint))

        aPoint._x = 20
        self.assertTrue(aRectangle.contains(aPoint))

        aPoint._y = 10
        self.assertTrue(aRectangle.contains(aPoint))

        aPoint._x = 21
        self.assertFalse(aRectangle.contains(aPoint))