am 2a5c0e2a
: Camera2: Tests: Skip stream tests /w formats that are not available.: DO NOT MERGE
* commit '2a5c0e2a466fe5252cd12c0199d4868efcc83264': Camera2: Tests: Skip stream tests /w formats that are not available.: DO NOT MERGE
This commit is contained in:
commit
5a6b76d2ae
3 changed files with 38 additions and 10 deletions
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue