summaryrefslogtreecommitdiffstats
path: root/tests_camera
diff options
context:
space:
mode:
authorAngus Kong <shkong@google.com>2013-08-09 14:55:20 -0700
committerAngus Kong <shkong@google.com>2013-08-09 17:12:11 -0700
commitb50b5cbfbc0a67db6fc43373363b10381c9c61a3 (patch)
treeb66054bcd1fbbae3ccf4f79d82c29ea1fb643ebf /tests_camera
parent4b2cb93c3f652734c41b4eb7449215178c586e8a (diff)
downloadandroid_packages_apps_Snap-b50b5cbfbc0a67db6fc43373363b10381c9c61a3.zip
android_packages_apps_Snap-b50b5cbfbc0a67db6fc43373363b10381c9c61a3.tar.gz
android_packages_apps_Snap-b50b5cbfbc0a67db6fc43373363b10381c9c61a3.tar.bz2
Clean up Gallery codes.
bug:10263696 Change-Id: I3a16dba3aabe52b8103a2c591cfa39907265a263
Diffstat (limited to 'tests_camera')
-rw-r--r--tests_camera/src/com/android/camera/activity/CameraTestCase.java4
-rw-r--r--tests_camera/src/com/android/camera/unittest/CameraUnitTest.java92
2 files changed, 48 insertions, 48 deletions
diff --git a/tests_camera/src/com/android/camera/activity/CameraTestCase.java b/tests_camera/src/com/android/camera/activity/CameraTestCase.java
index 27be3c7..4aae6b4 100644
--- a/tests_camera/src/com/android/camera/activity/CameraTestCase.java
+++ b/tests_camera/src/com/android/camera/activity/CameraTestCase.java
@@ -31,7 +31,7 @@ import android.view.View;
import com.android.camera.CameraHolder;
import com.android.camera.CameraManager.CameraProxy;
-import com.android.camera.Util;
+import com.android.camera.util.CameraUtil;
import com.android.gallery3d.R;
import static com.google.testing.littlemock.LittleMock.mock;
@@ -161,7 +161,7 @@ public class CameraTestCase<T extends Activity> extends ActivityInstrumentationT
} catch (IOException e) {
// ignore
} finally {
- Util.closeSilently(ins);
+ CameraUtil.closeSilently(ins);
}
mBlankJpeg = outputStream.toByteArray();
}
diff --git a/tests_camera/src/com/android/camera/unittest/CameraUnitTest.java b/tests_camera/src/com/android/camera/unittest/CameraUnitTest.java
index 0b4fc80..70faa5c 100644
--- a/tests_camera/src/com/android/camera/unittest/CameraUnitTest.java
+++ b/tests_camera/src/com/android/camera/unittest/CameraUnitTest.java
@@ -16,7 +16,7 @@
package com.android.camera.unittest;
-import com.android.camera.Util;
+import com.android.camera.util.CameraUtil;
import android.graphics.Matrix;
import android.test.suitebuilder.annotation.SmallTest;
@@ -26,47 +26,47 @@ 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));
+ 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() {
@@ -74,25 +74,25 @@ public class CameraUnitTest extends TestCase {
float[] points;
int[] expected;
- Util.prepareMatrix(matrix, false, 0, 800, 480);
+ 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);
- Util.prepareMatrix(matrix, false, 90, 800, 480);
+ 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);
- Util.prepareMatrix(matrix, false, 180, 800, 480);
+ 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);
- Util.prepareMatrix(matrix, true, 180, 800, 480);
+ 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);