Author: desruisseaux
Date: Sat Jan 18 00:28:22 2014
New Revision: 1559296

URL: http://svn.apache.org/r1559296
Log:
More tests.

Modified:
    
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java
    
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java

Modified: 
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java?rev=1559296&r1=1559295&r2=1559296&view=diff
==============================================================================
--- 
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java
 [UTF-8] Sat Jan 18 00:28:22 2014
@@ -17,6 +17,8 @@
 package org.apache.sis.internal.referencing;
 
 import org.opengis.referencing.cs.AxisDirection;
+import org.opengis.referencing.cs.CoordinateSystem;
+import org.apache.sis.referencing.cs.HardCodedCS;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -308,4 +310,13 @@ public final strictfp class AxisDirectio
         assertSame(GEOCENTRIC_Z, AxisDirections.valueOf("Geocentre > north 
pole"));
         assertSame(GEOCENTRIC_Z, AxisDirections.valueOf("Geocentre>north pole 
"));
     }
+
+    /**
+     * Tests {@link AxisDirections#indexOf(CoordinateSystem, AxisDirection)}.
+     */
+    @Test
+    public void testIndexOf() {
+        assertEquals(1, AxisDirections.indexOf(HardCodedCS.GEODETIC_3D, 
AxisDirection.NORTH));
+        assertEquals(1, AxisDirections.indexOf(HardCodedCS.GEODETIC_3D, 
AxisDirection.SOUTH));
+    }
 }

Modified: 
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java?rev=1559296&r1=1559295&r2=1559296&view=diff
==============================================================================
--- 
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java
 [UTF-8] Sat Jan 18 00:28:22 2014
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.referencing.cs;
 
+import javax.measure.unit.SI;
 import javax.measure.converter.ConversionException;
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.cs.AxisDirection;
@@ -31,6 +32,7 @@ import org.junit.Test;
 import static java.lang.Double.NaN;
 import static java.util.Collections.singletonMap;
 import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
+import static org.apache.sis.referencing.IdentifiedObjects.getProperties;
 import static org.apache.sis.referencing.cs.CoordinateSystems.*;
 import static org.apache.sis.test.Assert.*;
 
@@ -240,4 +242,31 @@ public final strictfp class CoordinateSy
                -1,    0,    0,    0,
                 0,    0,    0,    1}), swapAndScaleAxes(yxh, hxy), STRICT);
     }
+
+    /**
+     * Tests {@link CoordinateSystems#swapAndScaleAxes(CoordinateSystem, 
CoordinateSystem)} with a non-square matrix.
+     *
+     * @throws ConversionException Should not happen.
+     */
+    @Test
+    @DependsOnMethod("testSwapAndScaleAxes")
+    public void testScaleAndSwapAxesNonSquare() throws ConversionException {
+        final DefaultCartesianCS cs = new 
DefaultCartesianCS(singletonMap(NAME_KEY, "Test"),
+                new 
DefaultCoordinateSystemAxis(getProperties(HardCodedAxes.SOUTHING), "y", 
AxisDirection.SOUTH, SI.CENTIMETRE),
+                new 
DefaultCoordinateSystemAxis(getProperties(HardCodedAxes.EASTING),  "x", 
AxisDirection.EAST,  SI.MILLIMETRE));
+
+        Matrix matrix = swapAndScaleAxes(HardCodedCS.CARTESIAN_2D, cs);
+        assertMatrixEquals("(x,y) → (y,x)", Matrices.create(3, 3, new double[] 
{
+                0,  -100,    0,
+                1000,  0,    0,
+                0,     0,    1
+        }), matrix, STRICT);
+
+        matrix = swapAndScaleAxes(HardCodedCS.CARTESIAN_3D, cs);
+        assertMatrixEquals("(x,y,z) → (y,x)", Matrices.create(3, 4, new 
double[] {
+                0,  -100,   0,   0,
+                1000,  0,   0,   0,
+                0,     0,   0,   1
+        }), matrix, STRICT);
+    }
 }


Reply via email to