From deee349ba76abd4e4b57cc02dc8f97fa37ef35fb Mon Sep 17 00:00:00 2001 From: Alexander Reshetnikov Date: Wed, 15 Feb 2012 12:06:46 +0000 Subject: [PATCH] removed highgui video tests execution on macos; also minor code changes --- modules/highgui/test/test_framecount.cpp | 6 ++++++ modules/highgui/test/test_positioning.cpp | 12 ++++++++++++ modules/highgui/test/test_video_io.cpp | 20 +++++++++++++------- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/modules/highgui/test/test_framecount.cpp b/modules/highgui/test/test_framecount.cpp index 095fe31..cdf0590 100644 --- a/modules/highgui/test/test_framecount.cpp +++ b/modules/highgui/test/test_framecount.cpp @@ -55,6 +55,9 @@ public: void CV_FramecountTest::run(int) { +#if defined WIN32 || (defined __linux__ && !defined ANDROID) +#if !defined HAVE_GSTREAMER || defined HAVE_GSTREAMER_APP + const int time_sec = 5, fps = 25; const string ext[] = {"avi", "mov", "mp4", "mpg", "wmv"}; @@ -123,6 +126,9 @@ void CV_FramecountTest::run(int) ts->printf(cvtest::TS::LOG, "\nSuccessfull experiments: %d (%d%%)\n", n-failed, (n - failed)*100/n); ts->printf(cvtest::TS::LOG, "Failed experiments: %d (%d%%)\n", failed, failed*100/n); + +#endif +#endif } TEST(HighguiFramecount, regression) {CV_FramecountTest test; test.safe_run();} diff --git a/modules/highgui/test/test_positioning.cpp b/modules/highgui/test/test_positioning.cpp index 72b708d..c9cdb59 100644 --- a/modules/highgui/test/test_positioning.cpp +++ b/modules/highgui/test/test_positioning.cpp @@ -209,12 +209,24 @@ void CV_VideoPositioningTest::run_test(int method) void CV_VideoProgressivePositioningTest::run(int) { +#if defined WIN32 || (defined __linux__ && !defined ANDROID) +#if !defined HAVE_GSTREAMER || defined HAVE_GSTREAMER_APP + run_test(PROGRESSIVE); + +#endif +#endif } void CV_VideoRandomPositioningTest::run(int) { +#if defined WIN32 || (defined __linux__ && !defined ANDROID) +#if !defined HAVE_GSTREAMER || defined HAVE_GSTREAMER_APP + run_test(RANDOM); + +#endif +#endif } TEST (HighguiPositioning, progressive) { CV_VideoProgressivePositioningTest test; test.safe_run(); } diff --git a/modules/highgui/test/test_video_io.cpp b/modules/highgui/test/test_video_io.cpp index 4cedbfa..9afc1ad 100644 --- a/modules/highgui/test/test_video_io.cpp +++ b/modules/highgui/test/test_video_io.cpp @@ -403,8 +403,8 @@ void CV_HighGuiTest::SpecificVideoFileTest(const string& dir, const char codecch if (img.empty()) { - ts->printf(ts->LOG, "Creating a video in %s\n", video_file.c_str()); - ts->printf(ts->LOG, "Cannot read frame in %s\n", (ts->get_data_path()+",,/python/images/QCIF_"+s_digit.str()+"."+ext[j]).c_str()); + ts->printf(ts->LOG, "Creating a video in %s...\n", video_file.c_str()); + ts->printf(ts->LOG, "Error: cannot read frame from %s.\n", (ts->get_data_path()+"../python/images/QCIF_"+s_digit.str()+".bmp").c_str()); ts->printf(ts->LOG, "Continue creating the video file...\n"); ts->set_failed_test_info(ts->FAIL_INVALID_TEST_DATA); continue; @@ -426,7 +426,7 @@ void CV_HighGuiTest::SpecificVideoFileTest(const string& dir, const char codecch if (!writer.isOpened()) { - ts->printf(ts->LOG, "Creating a video in %s\n", video_file.c_str()); + ts->printf(ts->LOG, "Creating a video in %s...\n", video_file.c_str()); ts->printf(ts->LOG, "Cannot create VideoWriter with codec %s.\n", string(&codecchars[0], 4).c_str()); ts->set_failed_test_info(ts->FAIL_MISMATCH); return; @@ -445,7 +445,7 @@ void CV_HighGuiTest::SpecificVideoFileTest(const string& dir, const char codecch if (FRAME_COUNT != IMAGE_COUNT) { ts->printf(ts->LOG, "\nFrame count checking for video_%s.%s...\n", string(&codecchars[0], 4).c_str(), ext[j].c_str()); - ts->printf(ts->LOG, "Video codec: %s\n.", string(&codecchars[0], 4).c_str()); + ts->printf(ts->LOG, "Video codec: %s\n", string(&codecchars[0], 4).c_str()); ts->printf(ts->LOG, "Required frame count: %d; Returned frame count: %d\n", IMAGE_COUNT, FRAME_COUNT); ts->printf(ts->LOG, "Error: Incorrect frame count in the video.\n"); ts->set_failed_test_info(ts->FAIL_BAD_ACCURACY); @@ -459,7 +459,7 @@ void CV_HighGuiTest::SpecificVideoFileTest(const string& dir, const char codecch cv::Mat frame; cap >> frame; if (frame.empty()) { - ts->printf(ts->LOG, "\nError: cannot read the next frame with index %d\n", i+1); + ts->printf(ts->LOG, "\nError: cannot read the next frame with index %d.\n", i+1); ts->set_failed_test_info(ts->FAIL_MISSING_TEST_DATA); break; } @@ -472,7 +472,7 @@ void CV_HighGuiTest::SpecificVideoFileTest(const string& dir, const char codecch if (img.empty()) { - ts->printf(ts->LOG, "\nError: cannot read an image with index %d\n", i+1); + ts->printf(ts->LOG, "\nError: cannot read an image with index %d.\n", i+1); ts->set_failed_test_info(ts->FAIL_MISMATCH); break; } @@ -526,7 +526,7 @@ void CV_HighGuiTest::SpecificVideoCameraTest(const string& dir, const char codec { ts->printf(ts->LOG, "\nVideo file directory: %s\n", dir.c_str()); ts->printf(ts->LOG, "Video codec: %s\n", std::string(&codecchars[0], 4).c_str()); - ts->printf(ts->LOG, "Error: cannot create VideoWriter object for video_%s.%s\n", string(&codecchars[0]).c_str(), ext[i].c_str()); + ts->printf(ts->LOG, "Error: cannot create VideoWriter object for video_%s.%s.\n", string(&codecchars[0]).c_str(), ext[i].c_str()); ts->set_failed_test_info(ts->FAIL_EXCEPTION); continue; } @@ -652,6 +652,9 @@ void CV_VideoTest::run(int) void CV_SpecificVideoFileTest::run(int) { +#if defined WIN32 || (defined __linux__ && !defined ANDROID) +#if !defined HAVE_GSTREAMER || defined HAVE_GSTREAMER_APP + const char codecs[][4] = { {'M', 'P', 'G', '2'}, {'X', 'V', 'I', 'D'}, {'M', 'J', 'P', 'G'}, @@ -663,6 +666,9 @@ void CV_SpecificVideoFileTest::run(int) { SpecificVideoFileTest(ts->get_data_path(), codecs[i]); } + +#endif +#endif } void CV_SpecificVideoCameraTest::run(int) -- 2.7.4