summaryrefslogtreecommitdiffstats
path: root/tests/camera2
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2012-12-14 16:33:46 -0800
committerIgor Murashkin <iam@google.com>2012-12-18 11:30:09 -0800
commit02f3ac01890e406c63ea5d8145e314474af8273a (patch)
treef0f70b97fbade68a489f57276a8daee9cef3158c /tests/camera2
parent00b597f428ddb584a8251cd030cb8e3547ee869d (diff)
downloadhardware_libhardware-02f3ac01890e406c63ea5d8145e314474af8273a.zip
hardware_libhardware-02f3ac01890e406c63ea5d8145e314474af8273a.tar.gz
hardware_libhardware-02f3ac01890e406c63ea5d8145e314474af8273a.tar.bz2
Camera2: Tests: Skip stream tests /w formats that are not available.
Change-Id: I187ca983010483d1cb3ac951da2aa8b886828ef7
Diffstat (limited to 'tests/camera2')
-rw-r--r--tests/camera2/CameraBurstTests.cpp10
-rw-r--r--tests/camera2/CameraModuleFixture.h6
-rw-r--r--tests/camera2/CameraStreamTests.cpp32
3 files changed, 38 insertions, 10 deletions
diff --git a/tests/camera2/CameraBurstTests.cpp b/tests/camera2/CameraBurstTests.cpp
index 356ed37..e39970c 100644
--- a/tests/camera2/CameraBurstTests.cpp
+++ b/tests/camera2/CameraBurstTests.cpp
@@ -122,16 +122,6 @@ public:
return acc;
}
-
-protected:
-
- camera_metadata_ro_entry GetStaticEntry(uint32_t tag) const {
- const CameraMetadata& staticInfo = mDevice->info();
- camera_metadata_ro_entry entry = staticInfo.find(tag);
- return entry;
- }
-
-
};
TEST_F(CameraBurstTest, ManualExposureControl) {
diff --git a/tests/camera2/CameraModuleFixture.h b/tests/camera2/CameraModuleFixture.h
index d604ff7..6ad1ae8 100644
--- a/tests/camera2/CameraModuleFixture.h
+++ b/tests/camera2/CameraModuleFixture.h
@@ -47,6 +47,12 @@ struct CameraModuleFixture {
TearDown();
}
+ camera_metadata_ro_entry GetStaticEntry(uint32_t tag) const {
+ const CameraMetadata& staticInfo = mDevice->info();
+ camera_metadata_ro_entry entry = staticInfo.find(tag);
+ return entry;
+ }
+
private:
void SetUp() {
diff --git a/tests/camera2/CameraStreamTests.cpp b/tests/camera2/CameraStreamTests.cpp
index cff8394..b076296 100644
--- a/tests/camera2/CameraStreamTests.cpp
+++ b/tests/camera2/CameraStreamTests.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <iostream>
+#include <iomanip>
#include <gtest/gtest.h>
#define LOG_TAG "CameraStreamTest"
@@ -67,6 +69,36 @@ TEST_P(CameraStreamTest, CreateStream) {
TEST_EXTENSION_FORKING_INIT;
+ /** Make sure the format requested is supported. PASS this test if it's not
+ * not supported.
+ *
+ * TODO: would be nice of not running this test in the first place
+ * somehow.
+ */
+ {
+ camera_metadata_ro_entry availableFormats =
+ GetStaticEntry(ANDROID_SCALER_AVAILABLE_FORMATS);
+
+ bool hasFormat = false;
+ for (size_t i = 0; i < availableFormats.count; ++i) {
+ if (availableFormats.data.i32[i] == GetParam().mFormat) {
+ hasFormat = true;
+ break;
+ }
+ }
+
+ if (!hasFormat) {
+ const ::testing::TestInfo* const test_info =
+ ::testing::UnitTest::GetInstance()->current_test_info();
+ std::cerr << "Skipping test "
+ << test_info->test_case_name() << "."
+ << test_info->name()
+ << " because the format was not available: 0x"
+ << std::hex << GetParam().mFormat << std::endl;
+ return;
+ }
+ }
+
ASSERT_NO_FATAL_FAILURE(CreateStream());
ASSERT_NO_FATAL_FAILURE(DeleteStream());
}