@@ -0,0 +1,2745 @@
+package cgeo.geocaching.geopoint;%0A%0Aimport android.test.AndroidTestCase;%0A%0Apublic class ViewportTest extends AndroidTestCase %7B%0A%0A    final private static Viewport vpRef = new Viewport(-1.0, 3.0, -2.0, 4.0);%0A%0A    public static void assertBounds(final Viewport vp) %7B%0A        assertEquals(new Geopoint(1.0, 1.0), vp.center);%0A        assertEquals(new Geopoint(3.0, 4.0), vp.topRight);%0A        assertEquals(new Geopoint(-1.0, -2.0), vp.bottomLeft);%0A    %7D%0A%0A    public static void testCreationBounds() %7B%0A        assertBounds(new Viewport(new Geopoint(-1.0, -2.0), new Geopoint(3.0, 4.0)));%0A        assertBounds(new Viewport(new Geopoint(3.0, 4.0), new Geopoint(-1.0, -2.0)));%0A        assertBounds(new Viewport(new Geopoint(-1.0, 4.0), new Geopoint(3.0, -2.0)));%0A        assertBounds(new Viewport(new Geopoint(3.0, -2.0), new Geopoint(-1.0, 4.0)));%0A    %7D%0A%0A    public static void testCreationCenter() %7B%0A        assertBounds(new Viewport(new Geopoint(1.0, 1.0), 4.0, 6.0));%0A    %7D%0A%0A    public static void testCreationSeparate() %7B%0A        assertBounds(vpRef);%0A    %7D%0A%0A    public static void testMinMax() %7B%0A        assertEquals(-1.0, vpRef.getLatitudeMin());%0A        assertEquals(3.0, vpRef.getLatitudeMax());%0A        assertEquals(-2.0, vpRef.getLongitudeMin());%0A        assertEquals(4.0, vpRef.getLongitudeMax());%0A    %7D%0A%0A    public static void testSpans() %7B%0A        assertEquals(4.0, vpRef.getLatitudeSpan());%0A        assertEquals(6.0, vpRef.getLongitudeSpan());%0A    %7D%0A%0A    public static void testInViewport() %7B%0A        assertFalse(vpRef.isInViewport(new Geopoint(-2.0, -2.0)));%0A        assertFalse(vpRef.isInViewport(new Geopoint(4.0, 4.0)));%0A        assertTrue(vpRef.isInViewport(new Geopoint(0.0, 0.0)));%0A        assertTrue(vpRef.isInViewport(new Geopoint(-1.0, -2.0)));%0A        assertTrue(vpRef.isInViewport(new Geopoint(3.0, 4.0)));%0A    %7D%0A%0A    public static void testSqlWhere() %7B%0A        assertEquals(%22latitude %3E= -1.0 and latitude %3C= 3.0 and longitude %3E= -2.0 and longitude %3C= 4.0%22, vpRef.sqlWhere());%0A    %7D%0A%0A    public static void testEquals() %7B%0A        assertEquals(vpRef, vpRef);%0A        assertEquals(vpRef, new Viewport(vpRef.bottomLeft, vpRef.topRight));%0A        assertFalse(vpRef.equals(new Viewport(new Geopoint(0.0, 0.0), 1.0, 1.0)));%0A    %7D%0A%0A    public static void testResize() %7B%0A        assertEquals(vpRef, vpRef.resize(1.0));%0A        assertEquals(new Viewport(new Geopoint(-3.0, -5.0), new Geopoint(5.0, 7.0)), vpRef.resize(2.0));%0A        assertEquals(new Viewport(new Geopoint(0.0, -0.5), new Geopoint(2.0, 2.5)), vpRef.resize(0.5));%0A    %7D%0A%0A    public static void testIncludes() %7B%0A        assertTrue(vpRef.includes(vpRef));%0A        assertTrue(vpRef.includes(vpRef.resize(0.5)));%0A        assertFalse(vpRef.includes(vpRef.resize(2.0)));%0A    %7D%0A%0A%7D%0A

add tests for Viewport