Updating the Camera tests makefile and source to reflect recent split between camera and gallery
apps.
Change-Id: Ie5b3eb918c67b1f9e77f9a1f53d3cb562d78a001
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index f44156e..a19dd38 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
similarity index 82%
rename from tests/src/com/android/gallery3d/CameraTestRunner.java
rename to tests/src/com/android/camera/CameraTestRunner.java
index 5032336..03ec6b3 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
similarity index 75%
rename from tests/src/com/android/gallery3d/StressTests.java
rename to tests/src/com/android/camera/StressTests.java
index b991e9e..1734ef0 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
similarity index 98%
rename from tests/src/com/android/gallery3d/functional/CameraTest.java
rename to tests/src/com/android/camera/functional/CameraTest.java
index c293c0d..3fdebc0 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
similarity index 98%
rename from tests/src/com/android/gallery3d/functional/ImageCaptureIntentTest.java
rename to tests/src/com/android/camera/functional/ImageCaptureIntentTest.java
index 9ea9128..45af1ba 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
similarity index 99%
rename from tests/src/com/android/gallery3d/functional/VideoCaptureIntentTest.java
rename to tests/src/com/android/camera/functional/VideoCaptureIntentTest.java
index 3493989..269b84f 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
similarity index 99%
rename from tests/src/com/android/gallery3d/stress/CameraLatency.java
rename to tests/src/com/android/camera/stress/CameraLatency.java
index 2cdc2f1..527b586 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
similarity index 99%
rename from tests/src/com/android/gallery3d/stress/CameraStartUp.java
rename to tests/src/com/android/camera/stress/CameraStartUp.java
index 3ca1632..4a9b773 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
similarity index 97%
rename from tests/src/com/android/gallery3d/stress/CameraStressTestRunner.java
rename to tests/src/com/android/camera/stress/CameraStressTestRunner.java
index d3fb10d..b1bb2a8 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
similarity index 97%
rename from tests/src/com/android/gallery3d/stress/ImageCapture.java
rename to tests/src/com/android/camera/stress/ImageCapture.java
index 5a9ee6a..fd7e2af 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
similarity index 98%
rename from tests/src/com/android/gallery3d/stress/ShotToShotLatency.java
rename to tests/src/com/android/camera/stress/ShotToShotLatency.java
index 0d5749e..345379f 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
similarity index 98%
rename from tests/src/com/android/gallery3d/stress/SwitchPreview.java
rename to tests/src/com/android/camera/stress/SwitchPreview.java
index 3545f3b..a818bdf 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
similarity index 97%
rename from tests/src/com/android/gallery3d/stress/TestUtil.java
rename to tests/src/com/android/camera/stress/TestUtil.java
index 56ab715..64e2039 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
similarity index 96%
rename from tests/src/com/android/gallery3d/stress/VideoCapture.java
rename to tests/src/com/android/camera/stress/VideoCapture.java
index 8211bad..3688d89 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.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 0000000..70faa5c
--- /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 b8fb05f..0000000
--- 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]));
- }
- }
-}