Ignore:
Timestamp:
2019-10-29T20:17:53+01:00 (5 years ago)
Author:
Don-vip
Message:

fix #18274 - BBox should have a method to determine functional equivalency (patch by taylor.smock)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/osm/BBoxTest.java

    r13079 r15483  
    3737            .suppress(Warning.NONFINAL_FIELDS)
    3838            .verify();
     39    }
     40
     41    /**
     42     * Unit test of method {@link BBox#bboxesAreFunctionallyEqual}
     43     */
     44    @Test
     45    public void testBboxesAreFunctionallyEqual() {
     46        BBox bbox1 = new BBox(0, 1, 1, 0);
     47        BBox bbox2 = new BBox(0.1, 0.9, 0.9, 0.1);
     48
     49        assertFalse(BBox.bboxesAreFunctionallyEqual(bbox1, null, null));
     50        assertFalse(BBox.bboxesAreFunctionallyEqual(null, bbox2, null));
     51        assertFalse(BBox.bboxesAreFunctionallyEqual(null, null, null));
     52
     53        assertFalse(bbox1.bboxesAreFunctionallyEqual(bbox2, null));
     54        assertTrue(bbox1.bboxesAreFunctionallyEqual(bbox2, 0.1));
     55        bbox1.add(0, 1.1);
     56        assertFalse(bbox1.bboxesAreFunctionallyEqual(bbox2, 0.1));
     57        bbox1.add(2, 0);
     58        assertFalse(bbox1.bboxesAreFunctionallyEqual(bbox2, 0.1));
    3959    }
    4060
Note: See TracChangeset for help on using the changeset viewer.