converted all highgui tests to the format of google test system
This commit is contained in:
@@ -112,42 +112,48 @@ string ext_from_int(int ext)
|
||||
return "";
|
||||
}
|
||||
|
||||
class CV_FFmpegWriteSequenceImageTest : public cvtest::BaseTest
|
||||
{
|
||||
public:
|
||||
void run(int)
|
||||
{
|
||||
try
|
||||
{
|
||||
const int img_r = 640;
|
||||
const int img_c = 480;
|
||||
Size frame_s = Size(img_c, img_r);
|
||||
|
||||
for (size_t ext = 0; ext < 5; ++ext) // 0 - png, 1 - jpg, 2 - bmp, 3 - pgm, 4 - tiff
|
||||
for (size_t k = 1; k <= 3; ++k)
|
||||
for (size_t num_channels = 1; num_channels <= 4; ++num_channels)
|
||||
for (size_t depth = CV_8U; depth <= CV_16U; ++depth)
|
||||
{
|
||||
Mat img(img_r * k, img_c * k, CV_MAKETYPE(depth, num_channels), Scalar::all(0));
|
||||
circle(img, Point2i((img_c * k) / 2, (img_r * k) / 2), cv::min((img_r * k), (img_c * k)) / 4 , Scalar::all(255));
|
||||
imwrite(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext), img);
|
||||
Mat img_test = imread(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext));
|
||||
CV_Assert(img.size() == img_test.size());
|
||||
CV_Assert(img.type() == img_test.type());
|
||||
ts->printf(ts->LOG, "image type depth:%d channels:%d ext: %s\n", depth, num_channels, ext_from_int(ext).c_str());
|
||||
if (countNonZero(img != img_test) != 0)
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_GENERIC);
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_EXCEPTION);
|
||||
}
|
||||
ts->set_failed_test_info(cvtest::TS::OK);
|
||||
}
|
||||
};
|
||||
//class CV_FFmpegWriteSequenceImageTest : public cvtest::BaseTest
|
||||
//{
|
||||
// public:
|
||||
// void run(int)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// const int img_r = 640;
|
||||
// const int img_c = 480;
|
||||
// Size frame_s = Size(img_c, img_r);
|
||||
//
|
||||
// for (size_t ext = 0; ext < 5; ++ext) // 0 - png, 1 - jpg, 2 - bmp, 3 - pgm, 4 - tiff
|
||||
// for (size_t k = 1; k <= 3; ++k)
|
||||
// for (size_t num_channels = 1; num_channels <= 4; ++num_channels)
|
||||
// for (size_t depth = CV_8U; depth <= CV_16U; ++depth)
|
||||
// {
|
||||
// ts->printf(ts->LOG, "image type depth:%d channels:%d ext: %s\n", depth, num_channels, ext_from_int(ext).c_str());
|
||||
// ts->printf(ts->LOG, "creating image\n");
|
||||
// Mat img(img_r * k, img_c * k, CV_MAKETYPE(depth, num_channels), Scalar::all(0));
|
||||
// ts->printf(ts->LOG, "drawing circle\n");
|
||||
// circle(img, Point2i((img_c * k) / 2, (img_r * k) / 2), cv::min((img_r * k), (img_c * k)) / 4 , Scalar::all(255));
|
||||
// ts->printf(ts->LOG, "writing image : %s\n", string(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext)).c_str());
|
||||
// imwrite(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext), img);
|
||||
// ts->printf(ts->LOG, "reading test image : %s\n", string(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext)).c_str());
|
||||
// Mat img_test = imread(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext));
|
||||
//
|
||||
// CV_Assert(img.size() == img_test.size());
|
||||
// CV_Assert(img.type() == img_test.type());
|
||||
//
|
||||
// ts->printf(ts->LOG, "checking test image\n");
|
||||
// if (countNonZero(img != img_test) != 0)
|
||||
// ts->set_failed_test_info(cvtest::TS::FAIL_GENERIC);
|
||||
// }
|
||||
// }
|
||||
// catch(...)
|
||||
// {
|
||||
// ts->set_failed_test_info(cvtest::TS::FAIL_EXCEPTION);
|
||||
// }
|
||||
// ts->set_failed_test_info(cvtest::TS::OK);
|
||||
// }
|
||||
//};
|
||||
|
||||
|
||||
TEST(Highgui_FFmpeg_WriteSequenceImage, regression) { CV_FFmpegWriteSequenceImageTest test; test.safe_run(); }
|
||||
TEST(Highgui_FFmpeg_WriteBigImage, regression) { CV_FFmpegWriteBigImageTest test; test.safe_run(); }
|
||||
TEST(Highgui_FFmpeg_WriteBigVideo, regression) { CV_FFmpegWriteBigVideoTest test; test.safe_run(); }
|
||||
//TEST(Highgui_FFmpeg_WriteBigImage, regression) { CV_FFmpegWriteBigImageTest test; test.safe_run(); }
|
||||
//TEST(Highgui_FFmpeg_WriteBigVideo, regression) { CV_FFmpegWriteBigVideoTest test; test.safe_run(); }
|
||||
|
||||
Reference in New Issue
Block a user