package org.opennms.features.topology.api;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class BoundingBoxTest {

    @Test
    public void test() {
        BoundingBox rBBox = new BoundingBox(0,0, 100, 150).computeWithAspectRatio(1.5);
        
        assertEquals(225, rBBox.getWidth());
        assertEquals(150, rBBox.getHeight());
        assertEquals(50, rBBox.getCenter().getX());
        assertEquals(75, rBBox.getCenter().getY());
        
        BoundingBox bBox = new BoundingBox(0, 0, 600, 100).computeWithAspectRatio(1.5);
        assertEquals(600, bBox.getWidth());
        assertEquals(400, bBox.getHeight());
        assertEquals(300, bBox.getCenter().getX());
        assertEquals(50, bBox.getCenter().getY());
        
        
        //custom size
        BoundingBox customBBox = new BoundingBox(60, 53, 2389, 1301).computeWithAspectRatio(1449.0/843.0);
        assertEquals(2389, customBBox.getWidth());
        assertEquals(1390, customBBox.getHeight());
        
    }
    

}

@@ -262,32 +262,53 @@
 o(1.5);%0A        
+double delta = 0.001;
 %0A        assertE
@@ -316,16 +316,18 @@
 uals(225
+.0
 , rBBox.
@@ -328,32 +328,39 @@
 rBBox.getWidth()
+, delta
 );%0A        asser
@@ -370,16 +370,18 @@
 uals(150
+.0
 , rBBox.
@@ -383,32 +383,39 @@
 BBox.getHeight()
+, delta
 );%0A        asser
@@ -442,32 +442,39 @@
 tCenter().getX()
+, delta
 );%0A        asser
@@ -501,32 +501,39 @@
 tCenter().getY()
+, delta
 );%0A        %0A    
@@ -640,16 +640,18 @@
 uals(600
+.0
 , bBox.g
@@ -651,32 +651,39 @@
  bBox.getWidth()
+, delta
 );%0A        asser
@@ -693,16 +693,18 @@
 uals(400
+.0
 , bBox.g
@@ -705,32 +705,39 @@
 bBox.getHeight()
+, delta
 );%0A        asser
@@ -747,16 +747,18 @@
 uals(300
+.0
 , bBox.g
@@ -774,16 +774,23 @@
 ).getX()
+, delta
 );%0A     
@@ -807,16 +807,18 @@
 quals(50
+.0
 , bBox.g
@@ -834,16 +834,23 @@
 ).getY()
+, delta
 );%0A     
@@ -1016,16 +1016,18 @@
 als(2389
+.0
 , custom
@@ -1041,16 +1041,23 @@
 tWidth()
+, delta
 );%0A     
@@ -1076,16 +1076,18 @@
 als(1390
+.0
 , custom
@@ -1102,16 +1102,23 @@
 Height()
+, delta
 );%0A     

update assertEquals for floating point numbers