Пример #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)
Пример #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)
Пример #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))
Пример #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))