Refactored build conditionals in highgui tests

This commit is contained in:
Andrey Kamaev
2012-04-18 21:32:56 +00:00
parent b14df1c1e7
commit 2bedf5bfd5
9 changed files with 190 additions and 114 deletions
+2
View File
@@ -406,8 +406,10 @@ int CV_DrawingTest_C::checkLineIterator( Mat& _img )
return 0;
}
#ifdef HAVE_JPEG
TEST(Highgui_Drawing_CPP, regression) { CV_DrawingTest_CPP test; test.safe_run(); }
TEST(Highgui_Drawing_C, regression) { CV_DrawingTest_C test; test.safe_run(); }
#endif
class CV_FillConvexPolyTest : public cvtest::BaseTest
{
+2 -7
View File
@@ -55,9 +55,6 @@ public:
void CV_FramecountTest::run(int)
{
#if defined WIN32 || (defined __linux__ && !defined ANDROID) || (defined __APPLE__ && defined HAVE_FFMPEG)
#if !defined HAVE_GSTREAMER || defined HAVE_GSTREAMER_APP
const int time_sec = 5, fps = 25;
const string ext[] = {"avi", "mov", "mp4", "mpg", "wmv"};
@@ -126,9 +123,7 @@ 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
}
#if BUILD_WITH_VIDEO_INPUT_SUPPORT
TEST(HighguiFramecount, regression) {CV_FramecountTest test; test.safe_run();}
#endif
+6
View File
@@ -201,7 +201,13 @@ public:
}
};
#ifdef HAVE_PNG
TEST(Highgui_Grfmt_WriteBigImage, regression) { CV_GrfmtWriteBigImageTest test; test.safe_run(); }
#endif
#if defined(HAVE_PNG) && defined(HAVE_TIFF) && defined(HAVE_JPEG)
TEST(Highgui_Grfmt_WriteSequenceImage, regression) { CV_GrfmtWriteSequenceImageTest test; test.safe_run(); }
#endif
TEST(GrfmtReadBMPRLE8, regression) { CV_GrfmtReadBMPRLE8Test test; test.safe_run(); }
+2 -12
View File
@@ -209,25 +209,15 @@ void CV_VideoPositioningTest::run_test(int method)
void CV_VideoProgressivePositioningTest::run(int)
{
#if defined WIN32 || (defined __linux__ && !defined ANDROID) || (defined __APPLE__ && defined HAVE_FFMPEG)
#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) || (defined __APPLE__ && defined HAVE_FFMPEG)
#if !defined HAVE_GSTREAMER || defined HAVE_GSTREAMER_APP
run_test(RANDOM);
#endif
#endif
}
#if BUILD_WITH_VIDEO_INPUT_SUPPORT
TEST (HighguiPositioning, progressive) { CV_VideoProgressivePositioningTest test; test.safe_run(); }
TEST (HighguiPositioning, random) { CV_VideoRandomPositioningTest test; test.safe_run(); }
#endif
+48
View File
@@ -10,4 +10,52 @@
#include "opencv2/imgproc/imgproc_c.h"
#include <iostream>
#if defined(HAVE_VIDEOINPUT) || \
defined(HAVE_TYZX) || \
defined(HAVE_VFW) || \
defined(HAVE_LIBV4L) || \
(defined(HAVE_CAMV4L) && defined(HAVE_CAMV4L2)) || \
defined(HAVE_GSTREAMER) || \
defined(HAVE_DC1394_2) || \
defined(HAVE_DC1394) || \
defined(HAVE_CMU1394) || \
defined(HAVE_MIL) || \
defined(HAVE_QUICKTIME) || \
defined(HAVE_UNICAP) || \
defined(HAVE_PVAPI) || \
defined(HAVE_OPENNI) || \
defined(HAVE_XIMEA) || \
defined(HAVE_AVFOUNDATION) || \
(0)
//defined(HAVE_ANDROID_NATIVE_CAMERA) || - enable after #1193
# define BUILD_WITH_CAMERA_SUPPORT 1
#else
# define BUILD_WITH_CAMERA_SUPPORT 0
#endif
#if defined(HAVE_XINE) || \
defined(HAVE_GSTREAMER) || \
defined(HAVE_QUICKTIME) || \
defined(HAVE_AVFOUNDATION) || \
/*defined(HAVE_OPENNI) || too specialized */ \
defined(HAVE_FFMPEG) || \
defined(WIN32) /* assume that we have ffmpeg */
# define BUILD_WITH_VIDEO_INPUT_SUPPORT 1
#else
# define BUILD_WITH_VIDEO_INPUT_SUPPORT 0
#endif
#if /*defined(HAVE_XINE) || */\
defined(HAVE_GSTREAMER) || \
defined(HAVE_QUICKTIME) || \
defined(HAVE_AVFOUNDATION) || \
defined(HAVE_FFMPEG) || \
defined(WIN32) /* assume that we have ffmpeg */
# define BUILD_WITH_VIDEO_OUTPUT_SUPPORT 1
#else
# define BUILD_WITH_VIDEO_OUTPUT_SUPPORT 0
#endif
#endif
+30 -20
View File
@@ -141,7 +141,26 @@ void CV_HighGuiTest::ImageTest(const string& dir)
return;
}
const string exts[] = {"png", "bmp", "tiff", "jpg", "jp2", "ppm", "ras" };
const string exts[] = {
#ifdef HAVE_PNG
"png",
#endif
#ifdef HAVE_TIFF
"tiff",
#endif
#ifdef HAVE_JPEG
"jpg",
#endif
#ifdef HAVE_JASPER
"jp2",
#endif
#ifdef HAVE_OPENEXR
"exr",
#endif
"bmp",
"ppm",
"ras"
};
const size_t ext_num = sizeof(exts)/sizeof(exts[0]);
for(size_t i = 0; i < ext_num; ++i)
@@ -632,9 +651,6 @@ void CV_SpecificImageTest::run(int)
void CV_VideoTest::run(int)
{
#if defined WIN32 || (defined __linux__ && !defined ANDROID) || (defined __APPLE__ && defined HAVE_FFMPEG)
#if !defined HAVE_GSTREAMER || defined HAVE_GSTREAMER_APP
const char codecs[][4] = { {'I', 'Y', 'U', 'V'},
{'X', 'V', 'I', 'D'},
{'m', 'p', 'e', 'g'},
@@ -648,16 +664,10 @@ void CV_VideoTest::run(int)
{
VideoTest(ts->get_data_path(), CV_FOURCC(codecs[i][0], codecs[i][1], codecs[i][2], codecs[i][3]));
}
#endif
#endif
}
void CV_SpecificVideoFileTest::run(int)
{
#if defined WIN32 || (defined __linux__ && !defined ANDROID) || (defined __APPLE__ && defined HAVE_FFMPEG)
#if !defined HAVE_GSTREAMER || defined HAVE_GSTREAMER_APP
const char codecs[][4] = { {'m', 'p', 'e', 'g'},
{'X', 'V', 'I', 'D'},
{'M', 'J', 'P', 'G'},
@@ -669,16 +679,10 @@ void CV_SpecificVideoFileTest::run(int)
{
SpecificVideoFileTest(ts->get_data_path(), codecs[i]);
}
#endif
#endif
}
void CV_SpecificVideoCameraTest::run(int)
{
#if defined WIN32 || (defined __linux__ && !defined ANDROID)
#if !defined HAVE_GSTREAMER || defined HAVE_GSTREAMER_APP
const char codecs[][4] = { {'m', 'p', 'e', 'g'},
{'X', 'V', 'I', 'D'},
{'M', 'J', 'P', 'G'},
@@ -690,13 +694,19 @@ void CV_SpecificVideoCameraTest::run(int)
{
SpecificVideoCameraTest(ts->get_data_path(), codecs[i]);
}
#endif
#endif
}
#ifdef HAVE_JPEG
TEST(Highgui_Image, regression) { CV_ImageTest test; test.safe_run(); }
#endif
#if BUILD_WITH_VIDEO_INPUT_SUPPORT && BUILD_WITH_VIDEO_OUTPUT_SUPPORT
TEST(Highgui_Video, regression) { CV_VideoTest test; test.safe_run(); }
TEST(Highgui_SpecificImage, regression) { CV_SpecificImageTest test; test.safe_run(); }
TEST(Highgui_SpecificVideoFile, regression) { CV_SpecificVideoFileTest test; test.safe_run(); }
#endif
#if BUILD_WITH_VIDEO_INPUT_SUPPORT && BUILD_WITH_VIDEO_OUTPUT_SUPPORT && BUILD_WITH_CAMERA_SUPPORT
TEST(Highgui_SpecificVideoCamera, regression) { CV_SpecificVideoCameraTest test; test.safe_run(); }
#endif
TEST(Highgui_SpecificImage, regression) { CV_SpecificImageTest test; test.safe_run(); }
+1 -11
View File
@@ -43,10 +43,6 @@
#include "test_precomp.hpp"
#include "opencv2/highgui/highgui.hpp"
#ifdef HAVE_FFMPEG
#include "ffmpeg_codecs.hpp"
using namespace cv;
using namespace std;
@@ -102,9 +98,6 @@ void CV_PositioningTest::CreateTestVideo(const string& format, int codec, int fr
void CV_PositioningTest::run(int)
{
#if defined WIN32 || (defined __linux__ && !defined ANDROID) || (defined __APPLE__ && defined HAVE_FFMPEG)
#if !defined HAVE_GSTREAMER || defined HAVE_GSTREAMER_APP
const string format[] = {"avi", "mov", "mp4", "mpg", "wmv", "3gp"};
const char codec[][4] = { {'X', 'V', 'I', 'D'},
@@ -219,11 +212,8 @@ void CV_PositioningTest::run(int)
ts->printf(ts->LOG, "\nSuccessfull iterations: %d(%d%%) Failed iterations: %d(%d%%) %s\n", N-failed, (N-failed)*100/N, failed, failed*100/N, status.c_str());
if( i < n_format-1 || j < n_codec-1 ) ts->printf(ts->LOG, "\n----------");
}
#endif
#endif
}
#if BUILD_WITH_VIDEO_INPUT_SUPPORT && BUILD_WITH_VIDEO_OUTPUT_SUPPORT
TEST(Highgui_Positioning, regression) { CV_PositioningTest test; test.safe_run(); }
#endif