package com.knecon.fforesight.service.layoutparser.processor.docstrum.model;

import static org.junit.jupiter.api.Assertions.*;

import java.awt.geom.Rectangle2D;

import org.junit.jupiter.api.Test;

class BoundingBoxTest {

    @Test
    void testHorizontalDistance_NoOverlap() {

        ConcreteBoundingBox box1 = new ConcreteBoundingBox(0, 0, 10, 10);
        ConcreteBoundingBox box2 = new ConcreteBoundingBox(20, 0, 10, 10);

        assertEquals(10, box1.horizontalDistance(box2));
    }


    @Test
    void testHorizontalDistance_Overlap() {

        ConcreteBoundingBox box1 = new ConcreteBoundingBox(0, 0, 10, 10);
        ConcreteBoundingBox box2 = new ConcreteBoundingBox(5, 0, 10, 10);

        assertEquals(0, box1.horizontalDistance(box2));
    }


    @Test
    void testVerticalDistance_NoOverlap() {

        ConcreteBoundingBox box1 = new ConcreteBoundingBox(0, 0, 10, 10);
        ConcreteBoundingBox box2 = new ConcreteBoundingBox(0, 20, 10, 10);

        assertEquals(10, box1.verticalDistance(box2));
    }


    @Test
    void testVerticalDistance_Overlap() {

        ConcreteBoundingBox box1 = new ConcreteBoundingBox(0, 0, 10, 10);
        ConcreteBoundingBox box2 = new ConcreteBoundingBox(0, 5, 10, 10);

        assertEquals(0, box1.verticalDistance(box2));
    }


    @Test
    void testVerticalDistance_PartialOverlap() {

        ConcreteBoundingBox box1 = new ConcreteBoundingBox(0, 0, 10, 10);
        ConcreteBoundingBox box2 = new ConcreteBoundingBox(0, 8, 10, 10);

        assertEquals(0, box1.verticalDistance(box2));
    }


    @Test
    void testHorizontalDistance_PartialOverlap() {

        ConcreteBoundingBox box1 = new ConcreteBoundingBox(0, 0, 10, 10);
        ConcreteBoundingBox box2 = new ConcreteBoundingBox(8, 0, 10, 10);

        assertEquals(0, box1.horizontalDistance(box2));
    }

}