summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJason Noguchi <jnoguchi@google.com>2013-08-20 14:20:35 -0700
committerJason Noguchi <jnoguchi@google.com>2013-08-20 14:20:54 -0700
commit3189c037886fda47be73da9885e6760df50efd71 (patch)
treebf5a98d2a16f0e388d1eabb0502b836e7375d8df /tests
parent1571239c21fc4be7fd3c8db6ff1b8dc22f4d7e6f (diff)
downloadandroid_packages_apps_Snap-3189c037886fda47be73da9885e6760df50efd71.tar.gz
android_packages_apps_Snap-3189c037886fda47be73da9885e6760df50efd71.tar.bz2
android_packages_apps_Snap-3189c037886fda47be73da9885e6760df50efd71.zip
Updating the Camera tests makefile and source to reflect recent split between camera and gallery
apps. Change-Id: Ie5b3eb918c67b1f9e77f9a1f53d3cb562d78a001
Diffstat (limited to 'tests')
-rw-r--r--tests/AndroidManifest.xml26
-rwxr-xr-xtests/src/com/android/camera/CameraTestRunner.java (renamed from tests/src/com/android/gallery3d/CameraTestRunner.java)10
-rwxr-xr-xtests/src/com/android/camera/StressTests.java (renamed from tests/src/com/android/gallery3d/StressTests.java)15
-rw-r--r--tests/src/com/android/camera/functional/CameraTest.java (renamed from tests/src/com/android/gallery3d/functional/CameraTest.java)2
-rw-r--r--tests/src/com/android/camera/functional/ImageCaptureIntentTest.java (renamed from tests/src/com/android/gallery3d/functional/ImageCaptureIntentTest.java)2
-rw-r--r--tests/src/com/android/camera/functional/VideoCaptureIntentTest.java (renamed from tests/src/com/android/gallery3d/functional/VideoCaptureIntentTest.java)2
-rwxr-xr-xtests/src/com/android/camera/stress/CameraLatency.java (renamed from tests/src/com/android/gallery3d/stress/CameraLatency.java)2
-rw-r--r--tests/src/com/android/camera/stress/CameraStartUp.java (renamed from tests/src/com/android/gallery3d/stress/CameraStartUp.java)2
-rwxr-xr-xtests/src/com/android/camera/stress/CameraStressTestRunner.java (renamed from tests/src/com/android/gallery3d/stress/CameraStressTestRunner.java)2
-rwxr-xr-xtests/src/com/android/camera/stress/ImageCapture.java (renamed from tests/src/com/android/gallery3d/stress/ImageCapture.java)4
-rw-r--r--tests/src/com/android/camera/stress/ShotToShotLatency.java (renamed from tests/src/com/android/gallery3d/stress/ShotToShotLatency.java)2
-rwxr-xr-xtests/src/com/android/camera/stress/SwitchPreview.java (renamed from tests/src/com/android/gallery3d/stress/SwitchPreview.java)2
-rw-r--r--tests/src/com/android/camera/stress/TestUtil.java (renamed from tests/src/com/android/gallery3d/stress/TestUtil.java)2
-rwxr-xr-xtests/src/com/android/camera/stress/VideoCapture.java (renamed from tests/src/com/android/gallery3d/stress/VideoCapture.java)6
-rw-r--r--tests/src/com/android/camera/unittest/CameraUnitTest.java107
-rw-r--r--tests/src/com/android/gallery3d/unittest/CameraUnitTest.java107
16 files changed, 144 insertions, 149 deletions
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index f44156ea4..a19dd387e 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -15,7 +15,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.gallery3d.tests">
+ package="com.android.camera.tests">
<application
android:debuggable="true">
@@ -23,26 +23,22 @@
</application>
<instrumentation android:name="android.test.InstrumentationTestRunner"
- android:targetPackage="com.android.gallery3d"
- android:label="Tests for GalleryNew3D application."/>
+ android:targetPackage="com.android.camera2"
+ android:label="Tests for Camera2 application."/>
- <instrumentation android:name="com.android.gallery3d.CameraTestRunner"
- android:targetPackage="com.android.gallery3d"
+ <instrumentation android:name="com.android.camera.CameraTestRunner"
+ android:targetPackage="com.android.camera2"
android:label="Camera continuous test runner"/>
- <instrumentation android:name="com.android.gallery3d.exif.ExifTestRunner"
- android:targetPackage="com.android.gallery3d"
+ <instrumentation android:name="com.android.camera.exif.ExifTestRunner"
+ android:targetPackage="com.android.camera2"
android:label="Tests for ExifParser."/>
- <instrumentation android:name="com.android.gallery3d.jpegstream.JpegStreamTestRunner"
- android:targetPackage="com.android.gallery3d"
+ <instrumentation android:name="com.android.camera.jpegstream.JpegStreamTestRunner"
+ android:targetPackage="com.android.camera2"
android:label="Tests for JpegStream classes."/>
- <instrumentation android:name="com.android.gallery3d.stress.CameraStressTestRunner"
- android:targetPackage="com.android.gallery3d"
+ <instrumentation android:name="com.android.camera.stress.CameraStressTestRunner"
+ android:targetPackage="com.android.camera2"
android:label="Camera stress test runner"/>
-
- <instrumentation android:name="com.android.photos.data.DataTestRunner"
- android:targetPackage="com.android.gallery3d"
- android:label="Tests for android photo DataProviders."/>
</manifest>
diff --git a/tests/src/com/android/gallery3d/CameraTestRunner.java b/tests/src/com/android/camera/CameraTestRunner.java
index 503233675..03ec6b3be 100755
--- a/tests/src/com/android/gallery3d/CameraTestRunner.java
+++ b/tests/src/com/android/camera/CameraTestRunner.java
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package com.android.gallery3d;
+package com.android.camera;
import android.test.InstrumentationTestRunner;
import android.test.InstrumentationTestSuite;
-import com.android.gallery3d.functional.CameraTest;
-import com.android.gallery3d.functional.ImageCaptureIntentTest;
-import com.android.gallery3d.functional.VideoCaptureIntentTest;
-import com.android.gallery3d.unittest.CameraUnitTest;
+import com.android.camera.functional.CameraTest;
+import com.android.camera.functional.ImageCaptureIntentTest;
+import com.android.camera.functional.VideoCaptureIntentTest;
+import com.android.camera.unittest.CameraUnitTest;
import junit.framework.TestSuite;
diff --git a/tests/src/com/android/gallery3d/StressTests.java b/tests/src/com/android/camera/StressTests.java
index b991e9e8d..1734ef010 100755
--- a/tests/src/com/android/gallery3d/StressTests.java
+++ b/tests/src/com/android/camera/StressTests.java
@@ -14,25 +14,24 @@
* limitations under the License.
*/
-package com.android.gallery3d;
+package com.android.camera;
-import com.android.gallery3d.stress.CameraLatency;
-import com.android.gallery3d.stress.CameraStartUp;
-import com.android.gallery3d.stress.ImageCapture;
-import com.android.gallery3d.stress.SwitchPreview;
+import com.android.camera.stress.CameraLatency;
+import com.android.camera.stress.CameraStartUp;
+import com.android.camera.stress.ImageCapture;
+import com.android.camera.stress.SwitchPreview;
import junit.framework.Test;
import junit.framework.TestSuite;
-
/**
* Instrumentation Test Runner for all Camera tests.
*
* Running all tests:
*
* adb shell am instrument \
- * -e class com.android.gallery3d.StressTests \
- * -w com.google.android.gallery3d.tests/com.android.gallery3d.stress.CameraStressTestRunner
+ * -e class com.android.camera.StressTests \
+ * -w com.google.android.camera.tests/com.android.camera.stress.CameraStressTestRunner
*/
public class StressTests extends TestSuite {
diff --git a/tests/src/com/android/gallery3d/functional/CameraTest.java b/tests/src/com/android/camera/functional/CameraTest.java
index c293c0d4a..3fdebc030 100644
--- a/tests/src/com/android/gallery3d/functional/CameraTest.java
+++ b/tests/src/com/android/camera/functional/CameraTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.functional;
+package com.android.camera.functional;
import com.android.camera.CameraActivity;
diff --git a/tests/src/com/android/gallery3d/functional/ImageCaptureIntentTest.java b/tests/src/com/android/camera/functional/ImageCaptureIntentTest.java
index 9ea912864..45af1ba08 100644
--- a/tests/src/com/android/gallery3d/functional/ImageCaptureIntentTest.java
+++ b/tests/src/com/android/camera/functional/ImageCaptureIntentTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.functional;
+package com.android.camera.functional;
import com.android.camera.CameraActivity;
import com.android.camera2.R;
diff --git a/tests/src/com/android/gallery3d/functional/VideoCaptureIntentTest.java b/tests/src/com/android/camera/functional/VideoCaptureIntentTest.java
index 349398949..269b84f73 100644
--- a/tests/src/com/android/gallery3d/functional/VideoCaptureIntentTest.java
+++ b/tests/src/com/android/camera/functional/VideoCaptureIntentTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.functional;
+package com.android.camera.functional;
import com.android.camera.CameraActivity;
import com.android.camera2.R;
diff --git a/tests/src/com/android/gallery3d/stress/CameraLatency.java b/tests/src/com/android/camera/stress/CameraLatency.java
index 2cdc2f1b7..527b5860d 100755
--- a/tests/src/com/android/gallery3d/stress/CameraLatency.java
+++ b/tests/src/com/android/camera/stress/CameraLatency.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import com.android.camera.CameraActivity;
diff --git a/tests/src/com/android/gallery3d/stress/CameraStartUp.java b/tests/src/com/android/camera/stress/CameraStartUp.java
index 3ca163227..4a9b773d1 100644
--- a/tests/src/com/android/gallery3d/stress/CameraStartUp.java
+++ b/tests/src/com/android/camera/stress/CameraStartUp.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import com.android.camera.CameraActivity;
diff --git a/tests/src/com/android/gallery3d/stress/CameraStressTestRunner.java b/tests/src/com/android/camera/stress/CameraStressTestRunner.java
index d3fb10dad..b1bb2a899 100755
--- a/tests/src/com/android/gallery3d/stress/CameraStressTestRunner.java
+++ b/tests/src/com/android/camera/stress/CameraStressTestRunner.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import android.os.Bundle;
import android.test.InstrumentationTestRunner;
diff --git a/tests/src/com/android/gallery3d/stress/ImageCapture.java b/tests/src/com/android/camera/stress/ImageCapture.java
index 5a9ee6a6c..fd7e2afa7 100755
--- a/tests/src/com/android/gallery3d/stress/ImageCapture.java
+++ b/tests/src/com/android/camera/stress/ImageCapture.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import com.android.camera.CameraActivity;
-import com.android.gallery3d.stress.CameraStressTestRunner;
+import com.android.camera.stress.CameraStressTestRunner;
import android.app.Instrumentation;
import android.content.Intent;
diff --git a/tests/src/com/android/gallery3d/stress/ShotToShotLatency.java b/tests/src/com/android/camera/stress/ShotToShotLatency.java
index 0d5749e7d..345379f2a 100644
--- a/tests/src/com/android/gallery3d/stress/ShotToShotLatency.java
+++ b/tests/src/com/android/camera/stress/ShotToShotLatency.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import android.app.Instrumentation;
import android.os.Environment;
diff --git a/tests/src/com/android/gallery3d/stress/SwitchPreview.java b/tests/src/com/android/camera/stress/SwitchPreview.java
index 3545f3b3e..a818bdf60 100755
--- a/tests/src/com/android/gallery3d/stress/SwitchPreview.java
+++ b/tests/src/com/android/camera/stress/SwitchPreview.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import com.android.camera.CameraActivity;
diff --git a/tests/src/com/android/gallery3d/stress/TestUtil.java b/tests/src/com/android/camera/stress/TestUtil.java
index 56ab715f7..64e2039f2 100644
--- a/tests/src/com/android/gallery3d/stress/TestUtil.java
+++ b/tests/src/com/android/camera/stress/TestUtil.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import android.os.Environment;
import java.io.FileWriter;
diff --git a/tests/src/com/android/gallery3d/stress/VideoCapture.java b/tests/src/com/android/camera/stress/VideoCapture.java
index 8211badf7..3688d8909 100755
--- a/tests/src/com/android/gallery3d/stress/VideoCapture.java
+++ b/tests/src/com/android/camera/stress/VideoCapture.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import com.android.camera.CameraActivity;
-import com.android.gallery3d.stress.TestUtil;
+import com.android.camera.stress.TestUtil;
import android.app.Activity;
import android.app.Instrumentation;
@@ -27,7 +27,7 @@ import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.KeyEvent;
-import com.android.gallery3d.stress.CameraStressTestRunner;
+import com.android.camera.stress.CameraStressTestRunner;
/**
* Junit / Instrumentation test case for camera test
diff --git a/tests/src/com/android/camera/unittest/CameraUnitTest.java b/tests/src/com/android/camera/unittest/CameraUnitTest.java
new file mode 100644
index 000000000..70faa5c8d
--- /dev/null
+++ b/tests/src/com/android/camera/unittest/CameraUnitTest.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.camera.unittest;
+
+import com.android.camera.util.CameraUtil;
+
+import android.graphics.Matrix;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import junit.framework.TestCase;
+
+@SmallTest
+public class CameraUnitTest extends TestCase {
+ public void testRoundOrientation() {
+ int h = CameraUtil.ORIENTATION_HYSTERESIS;
+ assertEquals(0, CameraUtil.roundOrientation(0, 0));
+ assertEquals(0, CameraUtil.roundOrientation(359, 0));
+ assertEquals(0, CameraUtil.roundOrientation(0 + 44 + h, 0));
+ assertEquals(90, CameraUtil.roundOrientation(0 + 45 + h, 0));
+ assertEquals(0, CameraUtil.roundOrientation(360 - 44 - h, 0));
+ assertEquals(270, CameraUtil.roundOrientation(360 - 45 - h, 0));
+
+ assertEquals(90, CameraUtil.roundOrientation(90, 90));
+ assertEquals(90, CameraUtil.roundOrientation(90 + 44 + h, 90));
+ assertEquals(180, CameraUtil.roundOrientation(90 + 45 + h, 90));
+ assertEquals(90, CameraUtil.roundOrientation(90 - 44 - h, 90));
+ assertEquals(0, CameraUtil.roundOrientation(90 - 45 - h, 90));
+
+ assertEquals(180, CameraUtil.roundOrientation(180, 180));
+ assertEquals(180, CameraUtil.roundOrientation(180 + 44 + h, 180));
+ assertEquals(270, CameraUtil.roundOrientation(180 + 45 + h, 180));
+ assertEquals(180, CameraUtil.roundOrientation(180 - 44 - h, 180));
+ assertEquals(90, CameraUtil.roundOrientation(180 - 45 - h, 180));
+
+ assertEquals(270, CameraUtil.roundOrientation(270, 270));
+ assertEquals(270, CameraUtil.roundOrientation(270 + 44 + h, 270));
+ assertEquals(0, CameraUtil.roundOrientation(270 + 45 + h, 270));
+ assertEquals(270, CameraUtil.roundOrientation(270 - 44 - h, 270));
+ assertEquals(180, CameraUtil.roundOrientation(270 - 45 - h, 270));
+
+ assertEquals(90, CameraUtil.roundOrientation(90, 0));
+ assertEquals(180, CameraUtil.roundOrientation(180, 0));
+ assertEquals(270, CameraUtil.roundOrientation(270, 0));
+
+ assertEquals(0, CameraUtil.roundOrientation(0, 90));
+ assertEquals(180, CameraUtil.roundOrientation(180, 90));
+ assertEquals(270, CameraUtil.roundOrientation(270, 90));
+
+ assertEquals(0, CameraUtil.roundOrientation(0, 180));
+ assertEquals(90, CameraUtil.roundOrientation(90, 180));
+ assertEquals(270, CameraUtil.roundOrientation(270, 180));
+
+ assertEquals(0, CameraUtil.roundOrientation(0, 270));
+ assertEquals(90, CameraUtil.roundOrientation(90, 270));
+ assertEquals(180, CameraUtil.roundOrientation(180, 270));
+ }
+
+ public void testPrepareMatrix() {
+ Matrix matrix = new Matrix();
+ float[] points;
+ int[] expected;
+
+ CameraUtil.prepareMatrix(matrix, false, 0, 800, 480);
+ points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
+ expected = new int[] {0, 0, 400, 240, 800, 480, 400, 480, 100, 300};
+ matrix.mapPoints(points);
+ assertEquals(expected, points);
+
+ CameraUtil.prepareMatrix(matrix, false, 90, 800, 480);
+ points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
+ expected = new int[] {800, 0, 400, 240, 0, 480, 0, 240, 300, 60};
+ matrix.mapPoints(points);
+ assertEquals(expected, points);
+
+ CameraUtil.prepareMatrix(matrix, false, 180, 800, 480);
+ points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
+ expected = new int[] {800, 480, 400, 240, 0, 0, 400, 0, 700, 180};
+ matrix.mapPoints(points);
+ assertEquals(expected, points);
+
+ CameraUtil.prepareMatrix(matrix, true, 180, 800, 480);
+ points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
+ expected = new int[] {0, 480, 400, 240, 800, 0, 400, 0, 100, 180};
+ matrix.mapPoints(points);
+ assertEquals(expected, points);
+ }
+
+ private void assertEquals(int expected[], float[] actual) {
+ for (int i = 0; i < expected.length; i++) {
+ assertEquals("Array index " + i + " mismatch", expected[i], Math.round(actual[i]));
+ }
+ }
+}
diff --git a/tests/src/com/android/gallery3d/unittest/CameraUnitTest.java b/tests/src/com/android/gallery3d/unittest/CameraUnitTest.java
deleted file mode 100644
index b8fb05fc2..000000000
--- a/tests/src/com/android/gallery3d/unittest/CameraUnitTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.unittest;
-
-import com.android.camera.Util;
-
-import android.graphics.Matrix;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import junit.framework.TestCase;
-
-@SmallTest
-public class CameraUnitTest extends TestCase {
- public void testRoundOrientation() {
- int h = Util.ORIENTATION_HYSTERESIS;
- assertEquals(0, Util.roundOrientation(0, 0));
- assertEquals(0, Util.roundOrientation(359, 0));
- assertEquals(0, Util.roundOrientation(0 + 44 + h, 0));
- assertEquals(90, Util.roundOrientation(0 + 45 + h, 0));
- assertEquals(0, Util.roundOrientation(360 - 44 - h, 0));
- assertEquals(270, Util.roundOrientation(360 - 45 - h, 0));
-
- assertEquals(90, Util.roundOrientation(90, 90));
- assertEquals(90, Util.roundOrientation(90 + 44 + h, 90));
- assertEquals(180, Util.roundOrientation(90 + 45 + h, 90));
- assertEquals(90, Util.roundOrientation(90 - 44 - h, 90));
- assertEquals(0, Util.roundOrientation(90 - 45 - h, 90));
-
- assertEquals(180, Util.roundOrientation(180, 180));
- assertEquals(180, Util.roundOrientation(180 + 44 + h, 180));
- assertEquals(270, Util.roundOrientation(180 + 45 + h, 180));
- assertEquals(180, Util.roundOrientation(180 - 44 - h, 180));
- assertEquals(90, Util.roundOrientation(180 - 45 - h, 180));
-
- assertEquals(270, Util.roundOrientation(270, 270));
- assertEquals(270, Util.roundOrientation(270 + 44 + h, 270));
- assertEquals(0, Util.roundOrientation(270 + 45 + h, 270));
- assertEquals(270, Util.roundOrientation(270 - 44 - h, 270));
- assertEquals(180, Util.roundOrientation(270 - 45 - h, 270));
-
- assertEquals(90, Util.roundOrientation(90, 0));
- assertEquals(180, Util.roundOrientation(180, 0));
- assertEquals(270, Util.roundOrientation(270, 0));
-
- assertEquals(0, Util.roundOrientation(0, 90));
- assertEquals(180, Util.roundOrientation(180, 90));
- assertEquals(270, Util.roundOrientation(270, 90));
-
- assertEquals(0, Util.roundOrientation(0, 180));
- assertEquals(90, Util.roundOrientation(90, 180));
- assertEquals(270, Util.roundOrientation(270, 180));
-
- assertEquals(0, Util.roundOrientation(0, 270));
- assertEquals(90, Util.roundOrientation(90, 270));
- assertEquals(180, Util.roundOrientation(180, 270));
- }
-
- public void testPrepareMatrix() {
- Matrix matrix = new Matrix();
- float[] points;
- int[] expected;
-
- Util.prepareMatrix(matrix, false, 0, 800, 480);
- points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
- expected = new int[] {0, 0, 400, 240, 800, 480, 400, 480, 100, 300};
- matrix.mapPoints(points);
- assertEquals(expected, points);
-
- Util.prepareMatrix(matrix, false, 90, 800, 480);
- points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
- expected = new int[] {800, 0, 400, 240, 0, 480, 0, 240, 300, 60};
- matrix.mapPoints(points);
- assertEquals(expected, points);
-
- Util.prepareMatrix(matrix, false, 180, 800, 480);
- points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
- expected = new int[] {800, 480, 400, 240, 0, 0, 400, 0, 700, 180};
- matrix.mapPoints(points);
- assertEquals(expected, points);
-
- Util.prepareMatrix(matrix, true, 180, 800, 480);
- points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
- expected = new int[] {0, 480, 400, 240, 800, 0, 400, 0, 100, 180};
- matrix.mapPoints(points);
- assertEquals(expected, points);
- }
-
- private void assertEquals(int expected[], float[] actual) {
- for (int i = 0; i < expected.length; i++) {
- assertEquals("Array index " + i + " mismatch", expected[i], Math.round(actual[i]));
- }
- }
-}