OSDN Git Service

Camera2: Add test for construct_default_request.
authorEino-Ville Talvala <etalvala@google.com>
Mon, 14 May 2012 22:25:27 +0000 (15:25 -0700)
committerEino-Ville Talvala <etalvala@google.com>
Mon, 14 May 2012 22:27:00 +0000 (15:27 -0700)
Bug: 6243944
Change-Id: I59b03d7ebece2a4b7672b265bd9f960b3faea621

include/hardware/camera2.h
tests/camera2/camera2.cpp

index 7f06c52..0764cb1 100644 (file)
@@ -400,7 +400,10 @@ enum {
      * full-resolution images without compromising preview frame rate. 3A on
      * auto.
      */
-    CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG
+    CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG,
+
+    /* Total number of templates */
+    CAMERA2_TEMPLATE_COUNT
 };
 
 
index cc2face..6c22426 100644 (file)
@@ -572,4 +572,34 @@ TEST_F(Camera2Test, CaptureBurstRaw) {
     }
 }
 
+TEST_F(Camera2Test, ConstructDefaultRequests) {
+    status_t res;
+
+    for (int id = 0; id < getNumCameras(); id++) {
+        if (!isHal2Supported(id)) continue;
+
+        ASSERT_NO_FATAL_FAILURE(setUpCamera(id));
+
+        for (int i = CAMERA2_TEMPLATE_PREVIEW; i < CAMERA2_TEMPLATE_COUNT;
+             i++) {
+            camera_metadata_t *request = NULL;
+            res = mDevice->ops->construct_default_request(mDevice,
+                    i,
+                    &request);
+            EXPECT_EQ(NO_ERROR, res) <<
+                    "Unable to construct request from template type %d", i;
+            EXPECT_TRUE(request != NULL);
+            EXPECT_LT((size_t)0, get_camera_metadata_entry_count(request));
+            EXPECT_LT((size_t)0, get_camera_metadata_data_count(request));
+
+            IF_ALOGV() {
+                std::cout << "  ** Template type " << i << ":"<<std::endl;
+                dump_camera_metadata(request, 0, 2);
+            }
+
+            free_camera_metadata(request);
+        }
+    }
+}
+
 } // namespace android