#define dout if (0) std::cout
#endif
+#define WARN_UNLESS(condition) (!(condition) ? (std::cerr) : (std::ostream(NULL)) << "Warning: ")
+#define WARN_LE(exp, act) WARN_UNLESS((exp) <= (act))
+#define WARN_LT(exp, act) WARN_UNLESS((exp) < (act))
+#define WARN_GT(exp, act) WARN_UNLESS((exp) > (act))
+
using namespace android;
using namespace android::camera2;
dout << "max doubling count: " << max_doubling_count << std::endl;
- EXPECT_LE(CAMERA_EXPOSURE_DOUBLING_COUNT, max_doubling_count)
- << "average brightness should double at least "
- << CAMERA_EXPOSURE_DOUBLING_COUNT
- << " times over each consecutive frame as the exposure is doubled";
+ /**
+ * Make this check warning only, since the brightness calculation is not reliable
+ * and we have separate test to cover this case. Plus it is pretty subtle to make
+ * it right without complicating the test too much.
+ */
+ WARN_LE(CAMERA_EXPOSURE_DOUBLING_COUNT, max_doubling_count)
+ << "average brightness should double at least "
+ << CAMERA_EXPOSURE_DOUBLING_COUNT
+ << " times over each consecutive frame as the exposure is doubled"
+ << std::endl;
}
/**
float evRatio = (prevEv > currentEv) ? (currentEv / prevEv) :
(prevEv / currentEv);
if ( evRatio > EV_MATCH_BOUND ) {
- EXPECT_LT( fabs(brightnesses[i] - brightnesses[i - 1]),
+ WARN_LT(fabs(brightnesses[i] - brightnesses[i - 1]),
BRIGHTNESS_MATCH_BOUND) <<
"Capture brightness different from previous, even though "
"they have the same EV value. Ev now: " << currentEv <<
", previous: " << prevEv << ". Brightness now: " <<
- brightnesses[i] << ", previous: " << brightnesses[i-1];
+ brightnesses[i] << ", previous: " << brightnesses[i-1] <<
+ std::endl;
}
// Only check timing if not saving to disk, since that slows things
// down substantially
nsecs_t timeDelta = captureTimes[i] - captureTimes[i-1];
nsecs_t expectedDelta = expList[i] > durationList[i] ?
expList[i] : durationList[i];
- EXPECT_LT(timeDelta, expectedDelta + DURATION_UPPER_BOUND) <<
+ WARN_LT(timeDelta, expectedDelta + DURATION_UPPER_BOUND) <<
"Capture took " << timeDelta << " ns to receive, but expected"
- " frame duration was " << expectedDelta << " ns.";
- EXPECT_GT(timeDelta, expectedDelta - DURATION_LOWER_BOUND) <<
+ " frame duration was " << expectedDelta << " ns." <<
+ std::endl;
+ WARN_GT(timeDelta, expectedDelta - DURATION_LOWER_BOUND) <<
"Capture took " << timeDelta << " ns to receive, but expected"
- " frame duration was " << expectedDelta << " ns.";
+ " frame duration was " << expectedDelta << " ns." <<
+ std::endl;
dout << "Time delta from previous frame: " << timeDelta / 1e6 <<
" ms. Expected " << expectedDelta / 1e6 << " ms" << std::endl;
}
TEST_EXTENSION_FORKING_INIT;
int idx[] = { -1, mNumberOfCameras, mNumberOfCameras + 1 };
+ hw_device_t *device = NULL;
for (unsigned i = 0; i < sizeof(idx)/sizeof(idx[0]); ++i) {
- CreateCamera(idx[i], &mDevice);
- status_t deviceInitializeCode = initializeDevice(idx[i]);
- EXPECT_NE(OK, deviceInitializeCode);
- EXPECT_EQ(-ENODEV, deviceInitializeCode)
- << "Incorrect error code when trying to initialize invalid index "
- << idx[i];
- mDevice.clear();
+ String8 deviceName = String8::format("%d", idx[i]);
+ status_t res =
+ mModule->common.methods->open(
+ &mModule->common,
+ deviceName,
+ &device);
+ EXPECT_NE(OK, res);
+ EXPECT_EQ(-ENODEV, res)
+ << "Incorrect error code when trying to open camera with invalid id "
+ << deviceName;
}
}