96 lines
2.3 KiB
Java
96 lines
2.3 KiB
Java
package ch.epfl.alpano;
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
import org.junit.Test;
|
|
|
|
public class PanoramaParametersTest {
|
|
|
|
private GeoPoint vp = new GeoPoint(Math.toRadians(6.8087),Math.toRadians(47.0085));
|
|
private PanoramaParameters pp = new PanoramaParameters(vp, 1380, Math.toRadians(162),
|
|
Math.toRadians(27), 300, 2500, 800);
|
|
|
|
|
|
@Test
|
|
public void testAzimuthForX() {
|
|
assertEquals(pp.azimuthForX(1),Math.toRadians(148.5108043217287),0.000001);
|
|
}
|
|
|
|
@Test
|
|
public void testXForAzimuth() {
|
|
assertEquals(pp.xForAzimuth(pp.azimuthForX(1)),1,0.000000001);
|
|
}
|
|
|
|
@Test(expected = IllegalArgumentException.class)
|
|
public void testXForAzimuthFails() {
|
|
pp.xForAzimuth(Math.toRadians(27-81.5));
|
|
}
|
|
|
|
@Test
|
|
public void testAltitudeForY() {
|
|
assertEquals(pp.altitudeForY(0),Math.toRadians(4.316326530612245),0.00000001);
|
|
|
|
}
|
|
|
|
@Test
|
|
public void testYForAltitude() {
|
|
assertEquals(pp.yForAltitude(pp.altitudeForY(1)),1,0.000000001);
|
|
}
|
|
|
|
@Test
|
|
public void testIsValidSampleIndexFails1() {
|
|
assertEquals(pp.isValidSampleIndex(2500, 800),false);
|
|
}
|
|
@Test
|
|
public void testIsValidSampleIndexFails2() {
|
|
assertEquals(pp.isValidSampleIndex(-1, -1),false);
|
|
}
|
|
|
|
@Test
|
|
public void testLinearSampleIndexSucces() {
|
|
assertEquals(pp.linearSampleIndex(0, 0),0);
|
|
assertEquals(pp.linearSampleIndex(2500-1, 800-1),(2500*800)-1);
|
|
}
|
|
|
|
@Test
|
|
public void testObserverPosition() {
|
|
assertEquals(pp.observerPosition(),vp);
|
|
}
|
|
|
|
@Test
|
|
public void testObserverElevation() {
|
|
assertEquals(pp.observerElevation(),1380,0);
|
|
}
|
|
|
|
@Test
|
|
public void testCenterAzimuth() {
|
|
assertEquals(pp.centerAzimuth(),Math.toRadians(162),0.00000001);
|
|
}
|
|
|
|
@Test
|
|
public void testHorizontalFieldOfView() {
|
|
assertEquals(pp.horizontalFieldOfView(),Math.toRadians(27),0.0000001);
|
|
}
|
|
|
|
@Test
|
|
public void testVerticalFieldOfView() {
|
|
assertEquals(pp.verticalFieldOfView(),Math.toRadians(8.63265306122),0.000000001);
|
|
}
|
|
|
|
@Test
|
|
public void testMaxDistance() {
|
|
assertEquals(pp.maxDistance(),300,0);
|
|
}
|
|
|
|
@Test
|
|
public void testWidth() {
|
|
assertEquals(pp.width(),2500,0);
|
|
}
|
|
|
|
@Test
|
|
public void testHeight() {
|
|
assertEquals(pp.height(),800,0);
|
|
}
|
|
|
|
}
|