Beispiel #1
0
def test_clip_x_infinite():
    """
    Test correctly clipping (-inf, 0, inf, 10) with (-inf, -inf, inf, inf)
    """
    box1 = Box(Rectangle(-inf, -inf, inf, inf))
    box2 = Box(Rectangle(-inf, 0, inf, 10))

    clipped = box1.clip(box2)
    assert_is_not(clipped, Box.empty_box)
    assert_equals(clipped.rect, (-inf, 0, inf, 10))
Beispiel #2
0
def test_clip_x_infinite():
    """
    Test correctly clipping (-inf, 0, inf, 10) with (-inf, -inf, inf, inf)
    """
    box1 = Box(Rectangle(-inf, -inf, inf, inf))
    box2 = Box(Rectangle(-inf, 0, inf, 10))

    clipped = box1.clip(box2)
    assert_is_not(clipped, Box.empty_box)
    assert_equals(clipped.rect, (-inf, 0, inf, 10))
Beispiel #3
0
def test_clip_identity():
    """
    Test clipping a box with itself results in the same box
    """
    box1 = Box(Rectangle(-inf, -inf, inf, inf))
    box2 = Box(Rectangle(-inf, -inf, inf, inf))

    clipped = box1.clip(box2)
    assert_is_not(clipped, Box.empty_box)
    assert_equals(clipped.rect, box1.rect)
Beispiel #4
0
def test_clip_identity():
    """
    Test clipping a box with itself results in the same box
    """
    box1 = Box(Rectangle(-inf, -inf, inf, inf))
    box2 = Box(Rectangle(-inf, -inf, inf, inf))

    clipped = box1.clip(box2)
    assert_is_not(clipped, Box.empty_box)
    assert_equals(clipped.rect, box1.rect)