summaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2011-05-09 18:30:45 +0800
committerWu-cheng Li <wuchengli@google.com>2011-05-10 14:59:53 +0800
commit0d604e2af9eeed22685fd62e2281c2cd9728d58b (patch)
tree8133ac2ab86fdba7c1e92c2b04b0f46e6a7631da /tests/src
parent15e50f3db82768bc6952a2007eeba3d354e37b5c (diff)
downloadLegacyCamera-0d604e2af9eeed22685fd62e2281c2cd9728d58b.zip
LegacyCamera-0d604e2af9eeed22685fd62e2281c2cd9728d58b.tar.gz
LegacyCamera-0d604e2af9eeed22685fd62e2281c2cd9728d58b.tar.bz2
Add test for converting touch point to focus area.
Also add license for some files. Change-Id: I492799aefad5afe771a082b90bf44f4301480be0
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/camera/functional/CameraTest.java16
-rw-r--r--tests/src/com/android/camera/functional/ImageCaptureIntentTest.java16
-rw-r--r--tests/src/com/android/camera/functional/VideoCaptureIntentTest.java16
-rw-r--r--tests/src/com/android/camera/stress/CameraStartUp.java16
-rw-r--r--tests/src/com/android/camera/unittest/CameraTest.java33
5 files changed, 97 insertions, 0 deletions
diff --git a/tests/src/com/android/camera/functional/CameraTest.java b/tests/src/com/android/camera/functional/CameraTest.java
index 789310a..5d2fd2d 100644
--- a/tests/src/com/android/camera/functional/CameraTest.java
+++ b/tests/src/com/android/camera/functional/CameraTest.java
@@ -1,3 +1,19 @@
+/*
+ * 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.functional;
import com.android.camera.Camera;
diff --git a/tests/src/com/android/camera/functional/ImageCaptureIntentTest.java b/tests/src/com/android/camera/functional/ImageCaptureIntentTest.java
index 1de65d6..e9067be 100644
--- a/tests/src/com/android/camera/functional/ImageCaptureIntentTest.java
+++ b/tests/src/com/android/camera/functional/ImageCaptureIntentTest.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2011 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.functional;
import com.android.camera.Camera;
diff --git a/tests/src/com/android/camera/functional/VideoCaptureIntentTest.java b/tests/src/com/android/camera/functional/VideoCaptureIntentTest.java
index 57dac17..b2a007e 100644
--- a/tests/src/com/android/camera/functional/VideoCaptureIntentTest.java
+++ b/tests/src/com/android/camera/functional/VideoCaptureIntentTest.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2011 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.functional;
import com.android.camera.VideoCamera;
diff --git a/tests/src/com/android/camera/stress/CameraStartUp.java b/tests/src/com/android/camera/stress/CameraStartUp.java
index 3e1ae25..781093d 100644
--- a/tests/src/com/android/camera/stress/CameraStartUp.java
+++ b/tests/src/com/android/camera/stress/CameraStartUp.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2009 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.stress;
import com.android.camera.Camera;
diff --git a/tests/src/com/android/camera/unittest/CameraTest.java b/tests/src/com/android/camera/unittest/CameraTest.java
index 0e851e4..b0aa13b 100644
--- a/tests/src/com/android/camera/unittest/CameraTest.java
+++ b/tests/src/com/android/camera/unittest/CameraTest.java
@@ -1,7 +1,24 @@
+/*
+ * 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.Camera;
+import android.graphics.Rect;
import android.test.suitebuilder.annotation.SmallTest;
import junit.framework.TestCase;
@@ -23,4 +40,20 @@ public class CameraTest extends TestCase {
assertEquals(0, Camera.roundOrientation(270 + 45));
assertEquals(0, Camera.roundOrientation(359));
}
+
+ public void testConvertToFocusArea() {
+ Rect rect = new Rect();
+ Camera.convertToFocusArea(0, 0, 100, 100, 800, 480, rect);
+ assertEquals(new Rect(-1000, -1000, -750, -583), rect);
+ Camera.convertToFocusArea(0, 0, 400, 240, 800, 480, rect);
+ assertEquals(new Rect(-1000, -1000, 0, 0), rect);
+ Camera.convertToFocusArea(400, 240, 400, 240, 800, 480, rect);
+ assertEquals(new Rect(0, 0, 1000, 1000), rect);
+ Camera.convertToFocusArea(200, 120, 400, 240, 800, 480, rect);
+ assertEquals(new Rect(-500, -500, 500, 500), rect);
+ Camera.convertToFocusArea(0, 0, 800, 480, 800, 480, rect);
+ assertEquals(new Rect(-1000, -1000, 1000, 1000), rect);
+ Camera.convertToFocusArea(860, 620, 100, 100, 960, 720, rect);
+ assertEquals(new Rect(792, 722, 1000, 1000), rect);
+ }
}