#include "test_precomp.hpp"
-#ifdef HAVE_MFX
-
namespace opencv_test { namespace {
-TEST(Videoio_MFX, read_invalid)
+TEST(videoio_mfx, read_invalid)
{
+ if (!videoio_registry::hasBackend(CAP_INTEL_MFX))
+ throw SkipTestException("MediaSDK backend was not found");
+
VideoCapture cap;
ASSERT_NO_THROW(cap.open("nonexistent-file", CAP_INTEL_MFX));
ASSERT_FALSE(cap.isOpened());
ASSERT_TRUE(img.empty());
}
-TEST(Videoio_MFX, write_invalid)
+TEST(videoio_mfx, write_invalid)
{
+ if (!videoio_registry::hasBackend(CAP_INTEL_MFX))
+ throw SkipTestException("MediaSDK backend was not found");
+
const string filename = cv::tempfile(".264");
VideoWriter writer;
bool res = true;
//==================================================================================================
typedef tuple<Size, double, const char *> Size_FPS_Ext;
-typedef testing::TestWithParam< Size_FPS_Ext > Videoio_MFX;
+typedef testing::TestWithParam< Size_FPS_Ext > videoio_mfx;
-TEST_P(Videoio_MFX, read_write_raw)
+TEST_P(videoio_mfx, read_write_raw)
{
+ if (!videoio_registry::hasBackend(CAP_INTEL_MFX))
+ throw SkipTestException("MediaSDK backend was not found");
+
const Size FRAME_SIZE = get<0>(GetParam());
const double FPS = get<1>(GetParam());
const char *ext = get<2>(GetParam());
remove(filename.c_str());
}
-INSTANTIATE_TEST_CASE_P(videoio, Videoio_MFX,
+inline static std::string videoio_mfx_name_printer(const testing::TestParamInfo<videoio_mfx::ParamType>& info)
+{
+ std::ostringstream out;
+ const Size sz = get<0>(info.param);
+ const std::string ext = get<2>(info.param);
+ out << sz.width << "x" << sz.height << "x" << get<1>(info.param) << "x" << ext.substr(1, ext.size() - 1);
+ return out.str();
+}
+
+INSTANTIATE_TEST_CASE_P(videoio, videoio_mfx,
testing::Combine(
testing::Values(Size(640, 480), Size(638, 478), Size(636, 476), Size(1920, 1080)),
testing::Values(1, 30, 100),
- testing::Values(".mpeg2", ".264", ".265")));
+ testing::Values(".mpeg2", ".264", ".265")),
+ videoio_mfx_name_printer);
}} // namespace
-
-#endif