source: josm/trunk/test/unit/org/openstreetmap/josm/data/BoundsTest.java@ 8926

Last change on this file since 8926 was 8509, checked in by Don-vip, 9 years ago

fix many checkstyle violations

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data;
3
4import static org.junit.Assert.assertEquals;
5import static org.junit.Assert.assertFalse;
6import static org.junit.Assert.assertTrue;
7
8import org.junit.Test;
9import org.openstreetmap.josm.data.coor.LatLon;
10
11public class BoundsTest {
12
13 @Test
14 public void crossingTests() {
15 Bounds b1 = new Bounds(0, 170, 50, -170);
16 assertTrue(b1.crosses180thMeridian());
17 assertFalse(b1.contains(new LatLon(-10, -180)));
18 assertTrue(b1.contains(new LatLon(0, -180)));
19 assertTrue(b1.contains(new LatLon(50, -180)));
20 assertFalse(b1.contains(new LatLon(60, -180)));
21 assertFalse(b1.contains(new LatLon(-10, 180)));
22 assertTrue(b1.contains(new LatLon(0, 180)));
23 assertTrue(b1.contains(new LatLon(50, 180)));
24 assertFalse(b1.contains(new LatLon(60, 180)));
25
26 Bounds b2 = new Bounds(60, 170, 90, -170);
27 assertFalse(b1.intersects(b2));
28 assertFalse(b2.intersects(b1));
29
30 Bounds b3 = new Bounds(25, 170, 90, -170);
31 assertTrue(b1.intersects(b3));
32 assertTrue(b3.intersects(b1));
33 assertTrue(b2.intersects(b3));
34 assertTrue(b3.intersects(b2));
35
36 b3.extend(b1);
37 assertEquals(b3, new Bounds(0, 170, 90, -170));
38 assertTrue(b1.intersects(b3));
39 assertTrue(b3.intersects(b1));
40 assertTrue(b2.intersects(b3));
41 assertTrue(b3.intersects(b2));
42
43 b3.extend(new LatLon(0, 0));
44 assertEquals(b3, new Bounds(0, 0, 90, -170));
45 }
46}
Note: See TracBrowser for help on using the repository browser.